Deleting and undoing through Git
GitOps 2 · 3:59
Removing a deployment document from Git and applying removes the deployment from Weik.io, and a revert brings it back without a new build. The video continues GitOps 1 and covers drift from a change made by hand.
This part of the video couldn't be loaded.
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:06The repository is where the earlier GitOps video left hello.
- 0:11devtest runs hello's deployment at version 0.2.1.
- 0:16The arc is the plan before every apply,
- 0:19comparing the folders with your Weik.io installation.
- 0:22An apply with a prune name clears the installation of documents past applies under that name put there and the folder no longer holds.
- 0:35git rm takes hello's deployment file out of the folder.
- 0:39The file is gone,
- 0:41while the variable file and hello's files under sandbox/shared stay.
- 0:47A commit named remove hello from devtest records the removal.
- 0:52Nothing has reached the installation, because an apply carries the change.
- 1:02weikio diff is the plan: the folders, devtest, the prune name sandbox.
- 1:08The deployment row reads would delete.
- 1:11Exit code 2 means the apply would change something.
- 1:17The same folders, devtest and the prune name sandbox go through the apply,
- 1:22with the yes answer up front.
- 1:25The deployment row reads deleted, the integration row unchanged.
- 1:34hello's page in the admin UI reads Not deployed for devtest and offers Deploy.
- 1:44git revert for the removal commit keeps the message Git writes,
- 1:48which quotes what it undoes.
- 1:51The deployment file stands in sandbox/devtest/deployments again.
- 1:58The same apply runs again, with the prune name and the yes answer,
- 2:02and its last row reads created.
- 2:05This apply writes a new deployment record for version 0.2.1.
- 2:14The devtest card runs hello at version 0.2.1, where the last apply left it.
- 2:21This revert goes back to the older commit that raised hello to version 0.2.1.
- 2:30Version 0.2.0 is still in the installation, so the plan only moves the deployment back,
- 2:37reading changed version 0.2.1 to 0.2.0.
- 2:43The apply moves the deployment to version 0.2.0.
- 2:50Someone stops hello by hand, and nothing in the repository changes.
- 2:57The plan reads would update, changed state stopped to started.
- 3:02Exit code 2 again: the installation has drifted from the folders.
- 3:08The apply puts hello back to the state its file states.
- 3:16hello's page in the admin UI agrees.
- 3:19The Environments card reads devtest at version 0.2.0 on agent dev,
- 3:26and names 0.2.1 as the version before.
- 3:34The removal took hello's deployment document away,
- 3:37and the apply with the prune deleted the deployment.
- 3:41A revert brought the file back,
- 3:43and an apply created the deployment with nothing built.
- 3:46An apply puts drift back, and a nightly plan is how teams hear of it.