Skip to content

How to configure deployment pipelines

Filippo Ledda edited this page Feb 11, 2021 · 1 revision

Deployment model

Development/test pipelines

The dev pipeline builds all images, deploys the helm chart, publishes the images with a given tag.

CloudHarness - Dev Deployment Workflow

Staging/production pipelines

Production deployment pipelines reuses the images build on a previous dev pipeline and allows to publish with a definitive tag.

CloudHarness - Production Deployment Workflow

Command line commands

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.

Codefresh configuration

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

Dev/test pipeline variables

  • 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)

Staging/prod pipeline variables

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.