Deleting and undoing through Git
GitOps 2 · 3:45
Removing a deployment document from Git and applying removes the deployment from the hub, and a revert brings it back without a new build. The video continues GitOps 1 and covers drift from a change made by hand.
What it covers
- Deleting hello's deployment document with
git rmand committing the change - A plan with
weikio diff, showing would delete for the deployment and exit code 2 - Applying with the prune name
sandbox, which deletes the deployment and leaves the integration as it was - Seeing devtest marked Not deployed on hello's page in the admin UI
- Two
git revertcommits, the first recreating the deployment and the second returning it to 0.2.0 - Stopping hello by hand, with the drift in the plan and the next apply starting it again
Commands in this video
Terminal
$ git rm sandbox/devtest/deployments/hello.yaml
$ git commit -m 'remove hello from devtest'
$ weikio diff -f sandbox/shared -f sandbox/devtest --env devtest --prune sandbox
$ echo $?
$ weikio apply -f sandbox/shared -f sandbox/devtest --env devtest --prune sandbox -y
$ git revert --no-edit HEAD
$ git revert --no-edit ba8cf4a
$ weikio stop sandbox/helloTranscript
- 0:06Video one put hello into the sandbox repository.
- 0:10The devtest environment runs its deployment at version 0.2.1.
- 0:16A plan comes before the apply.
- 0:18The named prune deletes only what an earlier apply of the same folder put on the hub and the folder no longer holds.
- 0:30git rm takes hello's deployment document out of the folder.
- 0:34The file is gone from sandbox/devtest.
- 0:42The commit message is remove hello from devtest.
- 0:45message.yaml stays, so the folder is still there to apply.
- 0:55weikio diff compares the two folders with the hub.
- 1:00The deployment row reads would delete.
- 1:03Exit code 2 means the plan would change something.
- 1:10The apply runs the same two folders with the name sandbox.
- 1:15The integration row reads unchanged, so hello stays.
- 1:20The deployment row reads deleted.
- 1:26The admin UI opens hello's page.
- 1:29devtest reads Not deployed, and the page offers Deploy.
- 1:39git revert undoes the commit that removed the file.
- 1:43The commit line names the change it undoes.
- 1:46The file is back in sandbox/devtest/deployments.
- 1:51The same apply runs with the prune.
- 1:53The row reads created, a new record at 0.2.1.
- 2:03The devtest card shows 0.2.1 running.
- 2:08The second git revert undoes the commit that set version 0.2.1.
- 2:17The integration row reads unchanged under 0.2.0,
- 2:21and the field line reads changed version: 0.2.1 -> 0.2.0.
- 2:28The deployment updates to 0.2.0 without a new build.
- 2:36You stop hello with the stop command you used on it before.
- 2:48The plan prints changed state: stopped -> started, and exits 2.
- 2:54The plan shows the hand change as drift.
- 2:59The next apply sets the state back to started.
- 3:08Hello's page shows the change the apply made.
- 3:11The Environments card reads 0.2.0 and shows Running on 1 agent.
- 3:22The removed file's deployment is deleted, and hello stays.
- 3:26A revert creates the deployment again without a new build.
- 3:30The plan shows a hand change too, and the apply puts the drift back.
- 3:35A nightly plan tells a team about drift.