In this section we will create a deploy pipeline on Google Cloud to deploy the project application on an already provisioned Kubernetes cluster. This pipeline will be configured in order to be triggered every time package pipeline is executed successfully on a commit for `release/*` and `develop` branches, requiring manual launch for other branches. By default, it depends on the environment provisioning pipeline being successfully run on beforehand and, depending on the Kubernetes provider, it consumes the artifact produced by that. It also consumes variable groups created by package and environment provisioning pipeline.
The creation of the pipeline will follow the project workflow, so a new branch named feature/deploy-pipeline
will be created and the YAML file for the pipeline will be pushed to it.
Then, the new branch will be merged into the appropriate branch (provided in -b
flag).
The script located at /scripts/pipelines/gcloud/pipeline_generator.sh
will automatically create the new branch, create a deploy pipeline based on a YAML template appropriate for the project manifests files, create the Pull Request, and if it is possible, merge this new branch into the specified branch.
-
This script will commit and push the corresponding YAML template into your repository, so please be sure your local repository is up-to-date (i.e you have pulled the latest changes with
git pull
). -
The YAML containing Deployment object should be named
application-deployment.yaml
for allowing automatedimagePullSecret
injection.
pipeline_generator.sh \
-c <config file path> \
-n <pipeline name> \
-d <project local path> \
--env-provision-pipeline-name <pipeline name> \
--k8s-namespace <namespace> \
--k8s-deploy-files-path <manifests path> \
[--package-pipeline-name <pipeline name>] \
[--k8s-image-pull-secret-name <secret name>] \
[-b <branch>] \
machineType[ [-m <machine type for pipeline runner>]]
Note
|
The config file for the deploy pipeline is located at /scripts/pipelines/gcloud/templates/deploy/deploy-pipeline.cfg .
|
-c --config-file [Required] Configuration file containing pipeline definition.
-n --pipeline-name [Required] Name that will be set to the pipeline.
-d --local-directory [Required] Local directory of your project.
--env-provision-pipeline-name [Required] Environment provisioning pipeline name.
--k8s-namespace [Required] Kubernetes namespace where the application will be deployed.
--k8s-deploy-files-path [Required] Path from the root of the project to the YAML manifests directory.
--package-pipeline-name Package pipeline name.
--k8s-image-pull-secret-name Name for the generated secret containing registry credentials. Required when using a private registry to host images.
-b --target-branch Name of the branch to which the Pull Request will target. PR is not created if the flag is not provided.
machineType[-m, --machine-type Machine type for pipeline runner. Accepted values: E2_HIGHCPU_8, E2_HIGHCPU_32, N1_HIGHCPU_8, N1_HIGHCPU_32.]
./pipeline_generator.sh -c ./templates/deploy/deploy-pipeline.cfg -n quarkus-project-deploy -d C:/Users/$USERNAME/Desktop/quarkus-project --package-pipeline-name quarkus-project-package --env-provision-pipeline-name eks-provisioning --k8s-provider EKS --k8s-namespace hangar --k8s-deploy-files-path k8s -b develop