Flatten Auto DevOps into single `.gitlab-ci.yml`
Description
Auto deploy is awesome, but because all of the logic is buried in a Docker image, it is:
- hard for developers to understand, trust, and modify,
- and outside of project version control.
Hypothesis: If we flatten the bash scripts in kubernetes-deploy
, and put all of the content in a .gitlab-ci.yml
template, we would be showing people exactly what we're doing, as well as letting them modify it as needed, or keep it stable and impervious to changes outside their control.
Known downsides:
- The flattened
.gitlab-ci.yml
is 150 lines and hard to read. - The flattened
.gitlab-ci.yml
is Kubernetes specific, whereas a simple.gitlab-ci.yml
could switch providers by just referencing a different image that implements the same "interface".
Note: Part of downsides may be relieved by adding an include
capability to .gitlab-ci.yml
so the complex Kubernetes-specific portions could be put into a subfile that is included in the master file. At that point, it is remarkably similar to the current bash script approach. The included configuration could be injected into the repo, or referenced externally, but either choice is viable for bash scripts too.
Proposal
- Move Kubernetes configuration to helm chart (https://gitlab.com/charts/charts.gitlab.io/tree/master/charts/auto-deploy-app)
- Move bash scripts into monolithic
.gitlab-ci.yml
template (https://gitlab.com/gitlab-org/gitlab-ci-yml/merge_requests/62) - Simplify script as much as possible
- Simplify Docker image to just a
Dockerfile
to installkubectl
,helm
, etc. (TBD)
Examples
- Fully flattened
.gitlab-ci.yml
: https://gitlab.com/gitlab-org/gitlab-ci-yml/blob/139e57a4769057c45cf686e074d3b315de0cfeb7/Auto-deploy-kubernetes.yml - Modularized, but still flat: https://gitlab.com/gitlab-org/gitlab-ci-yml/blob/74c3397fa251fbeb750b9c6e6f130127544a8761/Auto-deploy-kubernetes.yml
- Composable: https://gitlab.com/markpundsack/auto-deploy-mockup/find_file/master