In this section we will create a deploy workflow on Github to deploy the project application on an already provisioned Kubernetes cluster. This pipeline will be configured in order to be triggered every time package workflow is executed successfully on a commit for release/*
and develop
branches, requiring manual launch for other branches but still enforcing that package workflow has passed. By default, it depends on the environment provisioning workflow 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 workflow.
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, a Pull Request (PR) will be created in order to merge the new branch into the appropriate branch (provided in -b
flag). The PR will be automatically merged if the repository policies are met. If the merge is not possible, either the PR URL will be shown as output, or it will be opened in your web browser if using -w
flag.
The script located at /scripts/pipelines/github/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> \
--package-pipeline-name <pipeline name> \
--env-provision-pipeline-name <pipeline name> \
--k8s-provider <provider name> \
--k8s-namespace <namespace> \
--k8s-deploy-files-path <manifests path> \
[--k8s-image-pull-secret-name <secret name>] \
[-b <branch>] \
[-w]
Note
|
The config file for the deploy pipeline is located at /scripts/pipelines/github/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.
--package-pipeline-name [Required] Package pipeline name.
--env-provision-pipeline-name [Required] Environment provisioning pipeline name.
--k8s-provider [Required] Kubernetes cluster provider name. Accepted values: EKS, AKS.
--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.
--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.
-w Open the Pull Request on the web browser if it cannot be automatically merged. Requires -b flag.
./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 -w