Lab 2.3 — Ship It: Change → Build → Deploy
Your Fortune Cookie app is live. Now close the GitOps loop: make a change, push it, and watch the pipeline rebuild the image and Argo CD reconcile the deployment — without running a single deployment command manually.
|
Estimated time: 15 minutes |
The Delivery Loop
Code change (OpenCode)
│
▼
git-push.yml → pushes to personal Git repo
│
▼
build-image.yml → applies pipeline/base (Kustomize) → Tekton PipelineRun → image built
│
▼
gitops-deploy.yml → applies gitops/base (Kustomize) → Argo CD syncs → new pods
│
▼
Live at https://<app>-<namespace>.apps.<cluster>
You own the code. The three Ansible playbooks — and the platform behind them — own the delivery.
Step 1: Make a Change with OpenCode
Open OpenCode in your project directory:
cd ${PROJECT_SOURCE}
opencode
Ask the build agent to add something:
/build
Add 10 more fortune cookie messages to the slice in main.go.
Make the HTML page display the fortune in a styled card with a cookie emoji 🥠.
After making the changes, verify the build:
CGO_ENABLED=0 go build -buildvcs=false -o /dev/null .
Wait for OpenCode to confirm the build is clean.
Step 2: Push, Build, Deploy
Run the three scripts in order — same as before, no new concepts:
# 1. Push the updated code
ansible-playbook scripts/git-push.yml
# 2. Rebuild the container image (Tekton PipelineRun, ~3-5 min)
ansible-playbook scripts/build-image.yml
|
You can watch the Tekton PipelineRun in the OpenShift console:
Pipelines → PipelineRuns in the |
# 3. Update the image reference and let Argo CD sync
ansible-playbook scripts/gitops-deploy.yml
gitops-deploy.yml updates the image: field in deploy/base/deployment.yaml, commits and pushes it, then Argo CD detects the change and reconciles the deployment automatically.
Step 3: Verify Argo CD Synced the Change
oc get application $APP_NAME -n ${APP_NAME}-dev \
-o jsonpath='{.status.sync.status} / {.status.health.status}' && echo
Synced / Healthy
Check the deployment rolled out cleanly:
oc rollout status deployment/$APP_NAME -n ${APP_NAME}-dev --timeout=120s
Step 4: Verify the Live Application
ROUTE=$(oc get route $APP_NAME -n ${APP_NAME}-dev -o jsonpath='{.spec.host}')
echo "https://${ROUTE}"
curl -sk https://${ROUTE}/healthz
Open the URL in your browser — you should see the cookie emoji 🥠 and the new fortunes.
|
Open the Argo CD console to see the sync history and resource tree:
|
What Just Happened
| Playbook | Platform action |
|---|---|
|
Updated code committed and pushed to your personal Git repo |
|
Applied |
|
Applied |
You made one change. The platform delivered it — zero manual kubectl apply, zero interaction with the registry, zero cluster-admin access.
➡️ Move on to Lab 5: Validate Best Practices with OpenCode.