The following is an example workflow YAML that includes a build job and a deploy job:
An example workflow YAML file
The workflow trigger
The example workflow starts with a push command to the main
repository branch, using the keyword on
.
apiVersion: automation.cloudbees.io/v1alpha1 kind: workflow name: build-n-deploy # This repository event triggers the workflow. on: push: branches: - 'main'
Steps in the build job
A job named build
is defined in the example workflow, and contains the following steps:
-
CloudBees action: Check out a Git repository is invoked to check out the repository code.
-
A shell script to build a standard Go app is run in the specified container.
-
CloudBees action: Configure AWS credentials is invoked to fetch credentials from AWS for use in subsequent steps.
-
CloudBees action: Configure Amazon ECR credentials is invoked to sign in to an ECR private registry.
-
CloudBees action: Build and publish Docker images with Kaniko is invoked to build container images from a Dockerfile.
-
A GHA YAML processor is invoked.
-
CloudBees action: Package a Helm chart is invoked to package the referenced image as a Helm chart.
-
CloudBees action: Push a Helm chart is invoked to publish the Helm chart.
Steps in the deploy job
A job named deploy
is defined in the example workflow, and contains the following steps:
-
CloudBees action: Configure AWS credentials is invoked to fetch credentials from AWS for use in subsequent steps.
-
CloudBees action: Configure EKS credentials is invoked to connect to an EKS cluster.
-
CloudBees action: Configure Amazon ECR credentials is invoked to sign in to an ECR private registry.
-
A Helm version is updated.