Skip to content

petbattle/ubiquitous-journey

Repository files navigation

☘️ pet battle ubquitous journey ☘️

Tekton pipelines for the Pet Battle suite of applications.

If you want to learn how to create this project read DEVELOPMENT.md

We use a Pull Model of deployment - Tekton for the CI pipeline, and ArgoCD to deploy changes using GitOps.

pull-model.png

🤠 For the impatient 🤠

Just run this code as a cluster admin user once logged in via command line to your cluster:

# clone this repo and
# bootstrap to install argocd and create projects
helm dependency up bootstrap/
helm upgrade --install bootstrap -f bootstrap/values-bootstrap.yaml bootstrap --create-namespace --namespace labs-bootstrap
# Create GitHub and ArgoCD secrets
# Login to ArgoCD WebUI and then run this until it succeeds (may need to run twice, fill in with your own tokens)
./tekton/secrets/create-petbattle-secrets.sh -t <GITHUB_TOKEN> -s <WEBHOOK_SECRET> -a <ARGOCD_USERNAME>
# give me ALL THE TOOLS, EXTRAS & OPSY THINGS !
helm template -f argo-app-of-apps.yaml ubiquitous-journey/ | oc -n labs-ci-cd apply -f-
# start a pipeline run
oc -n labs-ci-cd process pet-battle-api | oc -n labs-ci-cd create -f-
oc -n labs-ci-cd process pet-battle | oc -n labs-ci-cd create -f-
oc -n labs-ci-cd process pet-battle-tournament | oc -n labs-ci-cd create -f-

If you have already built and tagged images, you can redeploy the argocd application suite (helm template) using:

oc -n labs-ci-cd process pet-battle-api-deploy -p HELM_CHART_VERSION=1.0.15 | oc -n labs-ci-cd create -f-
oc -n labs-ci-cd process pet-battle-deploy -p HELM_CHART_VERSION=1.0.6 | oc -n labs-ci-cd create -f-
oc -n labs-ci-cd process pet-battle-tournament-deploy -p HELM_CHART_VERSION=1.0.39 | oc -n labs-ci-cd create -f-

If you are on a branch called develop, you can test a deployment (the same as a helm update --install) using:

# HELM_CHART_VERSION is Optional (it will pull latest chart from nexus helm chart repo if not specified)
oc -n labs-ci-cd process pet-battle-api-deploy -p GIT_SHORT_REVISION=develop -p GIT_BRANCH=develop -p HELM_CHART_VERSION=1.0.15 | oc -n labs-ci-cd create -f-
# OR
oc -n labs-ci-cd process pet-battle-api-deploy -p GIT_SHORT_REVISION=develop -p GIT_BRANCH=develop | oc -n labs-ci-cd create -f-

Or you can do a full build and deployment pipeline of a branch called develop using

oc -n labs-ci-cd process pet-battle-api -p GIT_REVISION=develop -p GIT_SHORT_REVISION=develop -p GIT_BRANCH=develop | oc -n labs-ci-cd create -f-

To create webhooks that trigger a full pipeline build and deployment in your github repos run these (TaskRuns) once manually:

oc -n labs-ci-cd process create-webhook -p GITHUB_ORG=petbattle -p GITHUB_REPO=pet-battle-api -p WEBHOOK_URL=http://$(oc -n labs-ci-cd get route webhook -o custom-columns=ROUTE:.spec.host --no-headers) | oc -n labs-ci-cd create -f-
oc -n labs-ci-cd process create-webhook -p GITHUB_ORG=petbattle -p GITHUB_REPO=pet-battle -p WEBHOOK_URL=http://$(oc -n labs-ci-cd get route webhook -o custom-columns=ROUTE:.spec.host --no-headers) | oc -n labs-ci-cd create -f-
oc -n labs-ci-cd process create-webhook -p GITHUB_ORG=petbattle -p GITHUB_REPO=tournamentservice -p WEBHOOK_URL=http://$(oc -n labs-ci-cd get route webhook -o custom-columns=ROUTE:.spec.host --no-headers) | oc -n labs-ci-cd create -f-
oc -n labs-ci-cd process create-webhook -p GITHUB_ORG=petbattle -p GITHUB_REPO=ubiquitous-journey -p WEBHOOK_URL=https://$(oc get route argocd-server --template='{{ .spec.host }}' -n labs-ci-cd)/api/webhook | oc -n labs-ci-cd create -f-

To Be Done

  • fix the need to login to argocd before running create-petbattle-secrets.sh
  • make secrets handling more realistic - use sealed secrets or hashicorp vault - https://www.openshift.com/blog/integrating-hashicorp-vault-in-openshift-4, quarkus hashicorp integration - https://quarkus.io/guides/vault, nexus, sonarqube secrets remove from code
  • ubi quarkus build image with tools, check base now we have new images (using custom ones)
  • code quality check should include the branch name generated for sonarqube
  • dev-ex-dashboard configure - REPLACE this with Console Links Chart when ready!! redhat-cop/helm-charts#109
  • add nsfw apps to this guide
  • add E2E tests written between test -> stage promotion
  • get Helm Release Notes working for pb apps in openshift
  • delete deprecated tekton conditionals once pipeline operator updated -> when syntax
  • Operator split into charts requiring privilege
  • document webhook triggers create them using tekton task
  • add github triggers work
  • split test, stage deploys - app of apps
  • boostrap crd's is two step process on an empty cluster. need this in a pipeline somewhere
  • code quality gates - configure pipeline args to fail on quality gates
  • Automate These Secrets
  • tekton-tidy.sh, clean artifacts in workspace, add to UJ day2
  • add HelmChartRepository to UJ - need this to merge for nexus support openshift/console#7711