-
Notifications
You must be signed in to change notification settings - Fork 5
How to configure deployment pipelines
The dev pipeline builds all images, deploys the helm chart, publishes the images with a given tag.
Production deployment pipelines reuses the images build on a previous dev pipeline and allows to publish with a definitive tag.
To run a dev pipeline, first configure your kubectl env to use the cluster of choice.
For example, with google cloud gcloud container clusters get-credentials MYCLUSTER --zone=us-central1-a
REGISTRY=...
NAMESPACE=...
DOMAIN=...
DEPLOYMENT_PUBLISH_TAG=...
harness-deployment . cloud-harness -r $REGISTRY -d $DOMAIN -n $NAMESPACE --build --deploy -t $DEPLOYMENT_PUBLISH_TAG
This command will build all images, push the images on the given docker registry, create and deploy the helm chart
To deploy the same image set on a staging environment, run without the --build flag on the same tag/registry:
REGISTRY=[SAME AS DEV]
NAMESPACE=...
DOMAIN=...
DEPLOYMENT_PUBLISH_TAG=[SAME AS DEV]
harness-deployment . cloud-harness -r $REGISTRY -d $DOMAIN -n $NAMESPACE --deploy -t $DEPLOYMENT_PUBLISH_TAG
The domain, and one of cluster and namespace will be different from the one used on the dev deployment. Additional final Docker and git tagging depicted in the stage/prod pipeline are not performed automatically by the script.
Using Codefresh is a handy option to run deployment pipelines remotely. The advantage of using codefresh is the simple visual interface and the capability to configure build and deploy easily.
The command harness-deployment
generate codefresh pipeline specifications together with the helm chart.
- deployment/codefresh-dev.yaml
- deployment/codefresh-prod.yaml
- CLOUDHARNESS_BRANCH: Cloudharness branch to use (only multi-step application)
- NAMESPACE: kubernetes namespace
- CLUSTER_NAME: name of the kubernetes cluster (previously configured on Codefresh
- REGISTRY: Docker registry url where images are built
- CODEFRESH_REGISTRY: Docker registry name as configured inside codefresh. See also here
- DOMAIN: base application domain. All applications will be available from *.DOMAIN
- REGISTRY_SECRET: registry pullsecret, if any (set to '' if registry does not need pull secrets)
- DEPLOYMENT_PUBLISH_TAG: target publish tag for all images. This same tag is meant to be reused on staging and production pipeline (e.g. 1.0-RC)
- REGISTRY_PUBLISH_URL: base url for image publish (may differ from build registry)
In addition to the dev variables those variables are used on staging/production:
- DEPLOYMENT_TAG: source image tag, where images were previously pushed by a dev pipeline.
- REPO_TOKEN: github repo token. If specified, the github repo tag is pushed after approval.