Enhance the Workflow
The CStack application dev clusters for internet and GEN-routable have been decommissioned. The information on this page may be outdated, but we’re updating it soon. Thanks for your patience!
Hello and welcome again!
You’re most likely here because you’ve gone through the basic workflow on CStack at least once (or quite a few times). After some time, you may realise that the basic workflow leaves you tired from merge requests and the repetitive nature of some manual tasks.
Fret not! There’s a better way to do this and this article is all about setting it up. You may ask us: “Why didn’t you tell us this sooner?” Well… All good things are worth waiting for.
If you’re looking to enhance the basic workflow, you’ve come to the right place! What does this mean for you? It sums up to:
- Reducing steps by eliminating the merge requests from
maintoreleasebranches. - Achieving commit = deploy by automating image-update from the application code pipeline.
So, there are two parts to improving this workflow. The first part will help reduce the Merge Requests (MR) creation to deploy/release your application onto CStack. The second part will help remove the manual step of updating container image specified in the Deployment resource.
Introducing the Manifest Pipeline
This really takes the cake when improving the basic workflow on CStack.
Instead of having to create merge requests each time you want to release into an environment (dev, stg or prd), you can either merge to main or commit directly into main branch with the changes you need. Say goodbye to the many merge requests and mistake-prone process of figuring out what you need to achieve deployment. Save merge requests each time you make a minor typo in the manifests, and reduce the number of clicks and steps needed!
How to setup the Manifest Pipeline?
Refer to detailed instructions here.
1. Create a Project Access Token (PAT) on GitLab with a Maintainer role.
- Scope: api, read_repository, write_repository
Important: Ensure that the Project Access Token (PAT) has the Maintainer role, as our protected branches require this role for push and merge operations. By default, the token may be assigned the Guest role. Using a token with the Guest role will cause the sync-branch job to fail.
2. Copy the value from Step 1 and create a CI/CD variable called CSTACK_MANIFESTS_TOKEN.
- Check the masked option.
- Uncheck the protected & expand variable reference option.
3. Create a .gitlab-ci.yml in the cstack-manifests repository and include the code below.
include:
- project: wog/gvt/cstack/groups/references/pipelines/tenant-pipeline
file: /cstack-manifests/addons/sync-all-release-branches.ymlNote: If you are trying to create this for a GEN cstack-manifest repository, the code will look like:
include:
- project: wog/gvt/cstack/groups/references/pipelines/tenant-pipeline
file: /cstack-manifests/addons/sync-all-release-branches.yml
sync-all-release-branches:
variables:
TARGET\_BRANCHES: 'release/gen-dev release/gen-stg release/gen-prd'Adding the Image Updater
This add-on helps you automate away the step of copying the image tag from the CI pipeline and updating it into the manifest files in cstack-manifests repository. This essentially helps you achieve a commit = deploy workflow by updating the manifests in cstack-manifests and having Argo CD apply the deployment automatically using GitOps.
Add the code snippet below to the .gitlab-ci.yml file in cstack-manifests repository.
- project: wog/gvt/cstack/groups/references/pipelines/tenant-pipeline
ref: chore/addon-pipelines
file: /cstack-manifests/addons/manifests-pipelines.yml
stages:
- update-images
- promote-envs
- sync-branches
update-images:
variables:
GITLAB\_TOKEN: '$CSTACK\_MANIFESTS\_TOKEN'
promote-envs:
variables:
GITLAB\_TOKEN: '$CSTACK\_MANIFESTS\_TOKEN'Refer to this link for a sample.
The resulting .gitlab-ci.yml file in cstack-manifests repository should look like this:
include:
- project: wog/gvt/cstack/groups/references/pipelines/tenant-pipeline
file: /cstack-manifests/addons/sync-all-release-branches.yml
- project: wog/gvt/cstack/groups/references/pipelines/tenant-pipeline
ref: chore/addon-pipelines
file: /cstack-manifests/addons/manifests-pipelines.yml
stages:
- update-images
- promote-envs
- sync-branches
update-images:
variables:
GITLAB\_TOKEN: '$CSTACK\_MANIFESTS\_TOKEN'
promote-envs:
variables:
GITLAB\_TOKEN: '$CSTACK\_MANIFESTS\_TOKEN'Note: For a GEN cstack-manifest repository, the .gitlab-ci.yml will look like this:
include:
- project: wog/gvt/cstack/groups/references/pipelines/tenant-pipeline
file: /cstack-manifests/addons/sync-all-release-branches.yml
- project: wog/gvt/cstack/groups/references/pipelines/tenant-pipeline
ref: chore/addon-pipelines
file: /cstack-manifests/addons/manifests-pipelines.yml
stages:
- update-images
- promote-envs
- sync-branches
update-images:
variables:
GITLAB\_TOKEN: '$CSTACK\_MANIFESTS\_TOKEN'
promote-envs:
variables:
GITLAB\_TOKEN: '$CSTACK\_MANIFESTS\_TOKEN'
sync-all-release-branches:
variables:
TARGET\_BRANCHES: 'release/gen-dev release/gen-stg release/gen-prd'