Promote an Application using CD with GitOps and ArgoCD¶
Promote an Application using CD with GitOps and ArgoCD
-
Prerequisites
- Complete lab Deploy an Application using CI Pipelines with Tekton.
-
Set
TOOLKIT_USERNAMEenvironment variable. If you are participation in a workshop replaceuserdemowith your assigned username (ex.user01).TOOLKIT_USERNAME=userdemo -
(Skip if using KubeAdmin or IBM Cloud) Login to OpenShift using
oc- If using IBM Cloud cluster then login with your IBM account email and IAM API Key or Token by using the Copy Login Command

- If using a cluster that was configured with the workshop scripts outside IBM Cloud then use respective assigned username (ex.
user01), and the password ispasswordoc login $OCP_URL -u $TOOLKIT_USERNAME -p password
- If using IBM Cloud cluster then login with your IBM account email and IAM API Key or Token by using the Copy Login Command
-
Set
TOOLKIT_PROJECTenvironment variable If you are participation in a workshop replaceprojectdemobased on your assigned username (ex.project01).TOOLKIT_PROJECT=projectdemo -
Verify Application is deployed in QA
- Get ArgoCD's
adminpassword by runningoc credentials - Select ArgoCD from the Console Link and login using
adminand the password you just retrieved - Filter Applications by name
${TOOLKIT_PROJECT}-qa(ie project01-qa) - Select the application
master-qa-${TOOLKIT_PROJECT}-app(ie master-qa-project01-app)
- Get ArgoCD's
-
Verify Application is running in the QA namespace corresponding to your username
${TOOLKIT_PROJECT}-qa- Select Developer perspective, select project
${TOOLKIT_PROJECT}-qaand then select Topology from the Console and see the application running
- Select Developer perspective, select project
-
Setup environment variable
GIT_OPS_URLfor the git url using the value from previous step or as followingGIT_OPS_URL=http://${TOOLKIT_USERNAME}:password@$(oc get route -n tools gogs --template='{{.spec.host}}')/toolkit/gitops echo GIT_OPS_URL=${GIT_OPS_URL} -
Clone the git repository and change directory
cd $HOME git clone $GIT_OPS_URL cd gitops -
Review the
qaandstagingdirectory in the git repositoryls -l qa/ ls -l staging/ -
Promote the application from QA to STAGING by copying the app manifest files using git
git config --local user.email "${TOOLKIT_USERNAME}@example.com" git config --local user.name "${TOOLKIT_USERNAME}" cp -a qa/${TOOLKIT_PROJECT}/ staging/${TOOLKIT_PROJECT}/ git add . git commit -m "Promote Application from QA to STAGING environment for $TOOLKIT_PROJECT" git push -u origin master -
Verify Application is deployed in STAGING
- Get ArgoCD's
adminpassword by runningoc credentials - Select ArgoCD from the Console Link and login using
adminand the password you just retrieved - Filter Applications by namespace
${TOOLKIT_PROJECT}-staging(ie project01-staging) - It might take a couple minutes for the application to show up
- Select the application
master-staging-${TOOLKIT_PROJECT}-app(ie master-staging-project01-app) - Click Refresh

- Get ArgoCD's
-
Verify Application is running in the STAGING namespace corresponding to your username
${TOOLKIT_PROJECT}- Select Developer perspective, select project
${TOOLKIT_PROJECT}-stagingand then select Topology from the Console and see the application running
- Select Developer perspective, select project
-
Propose a change for the Application in STAGING
- Update the replica count and create a new git branch in remote repo
cat > staging/${TOOLKIT_PROJECT}/app/values.yaml <<EOF global: {} app: replicaCount: 2 EOF git diff git add . git checkout -b ${TOOLKIT_PROJECT}-pr1 git commit -m "Update Application in ${TOOLKIT_PROJECT}-staging namespace" git push -u origin ${TOOLKIT_PROJECT}-pr1 - Open Git Ops from Console Link
- Select toolkit/gitops git repository
- Create a Pull Request
- Select Pull Request
- Click New Pull Request
- Select from
comparedropdown the branch${TOOLKIT_PROJECT}-pr1 - Enter a title like
Update replica count for app in namespace $TOOLKIT_PROJECT - Enter a Comment like
We need more instances business is growing Yay! - click Create Pull Request

- Update the replica count and create a new git branch in remote repo
-
Review the PR follow the change management process established by your team.
- Click Merge Pull Request
- Click Delete Branch
-
Review that application scales out
- Review in ArgoCD UI, notice there are now two pods, it takes about 4 minutes to sync, you can click Refresh

- Review in OpenShift Console, click the Deployment circle details shows 2 Pods.

- Review in ArgoCD UI, notice there are now two pods, it takes about 4 minutes to sync, you can click Refresh
-
Congratulations you finished this activity, continue with the lab Deploy a 3 tier Microservice using React, Node.js, and Java