Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions documentation/azure-devops/setup-deploy-pipeline.asciidoc
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
:provider: Azure Devops
:pipeline_type: Pipeline
:trigger_sentence_azure:
:pipeline_type2: pipeline
:path_provider: azure-devops
= Setting up a Deploy Pipeline on Azure DevOps

In this section we will create a deploy pipeline on Azure DevOps 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 but still enforcing that package pipeline has passed. 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 pipelines.
Expand All @@ -23,10 +28,10 @@ pipeline_generator.sh \
-n <pipeline name> \
-d <project local path> \
--package-pipeline-name <pipeline name> \
--env-provision-pipeline-name <pipeline name>] \
--env-provision-pipeline-name <pipeline name> \
--k8s-provider <provider name> \
--k8s-namespace <namespace> \
--k8s-deploy-files-path <manifests path> \
--k8s-deploy-files-path <manifests path> \
[--k8s-image-pull-secret-name <secret name>] \
[-b <branch>] \
[-w]
Expand All @@ -51,7 +56,8 @@ NOTE: The config file for the deploy pipeline is located at `/scripts/pipelines
=== Examples

```
./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
./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

```


Expand Down
64 changes: 64 additions & 0 deletions documentation/gitlab/setup-deploy-pipeline.asciidoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
:provider: Gitlab
:pipeline_type: pipeline
:trigger_sentence_gitlab:
:pipeline_type2: Gitlab pipeline
:path_provider: gitlab
= Setting up a Deploy Pipeline on Azure DevOps

In this section we will create a deploy pipeline on Azure DevOps 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 but still enforcing that package pipeline has passed. 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 pipelines.

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/azure-devops/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.

== Prerequisites

* 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 automated `imagePullSecret` injection.

== Creating the pipeline using provided script

=== Usage
```
pipeline_generator.sh \
-c <config file path> \
-d <project local path> \
--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/azure-devops/templates/deploy/deploy-pipeline.cfg`.

=== Flags
```
-c --config-file [Required] Configuration file containing pipeline definition.
-d --local-directory [Required] Local directory of your project.
--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.
```

=== Examples

```

./pipeline_generator.sh -c ./templates/deploy/deploy-pipeline.cfg -d C:/Users/$USERNAME/Desktop/quarkus-project --k8s-provider EKS --k8s-namespace hangar --k8s-deploy-files-path k8s -b develop -w
```


=== Appendix: accessing the application

Once the pipeline is executed and your application is deployed, you can list the hostname to access it with:

```
kubectl get ingress -n <namespace>
```
6 changes: 6 additions & 0 deletions documentation/src/azure-devops/setup-deploy-pipeline.asciidoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
:provider: Azure Devops
:pipeline_type: Pipeline
:trigger_sentence_azure:
:pipeline_type2: pipeline
:path_provider: azure-devops
include::../common_templates/setup-deploy-pipeline.asciidoc[]
66 changes: 66 additions & 0 deletions documentation/src/common_templates/setup-deploy-pipeline.asciidoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
= Setting up a Deploy Pipeline on Azure DevOps

In this section we will create a deploy pipeline on Azure DevOps 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 but still enforcing that package pipeline has passed. 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 pipelines.

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/azure-devops/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.

== Prerequisites

* 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 automated `imagePullSecret` injection.

== Creating the pipeline using provided script

=== Usage
```
pipeline_generator.sh \
-c <config file path> \
ifdef::trigger_sentence_azure,trigger_sentence_github[ -n <pipeline name> \]
-d <project local path> \
ifdef::trigger_sentence_azure,trigger_sentence_github[ --package-pipeline-name <pipeline name> \]
ifdef::trigger_sentence_azure,trigger_sentence_github[ --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/azure-devops/templates/deploy/deploy-pipeline.cfg`.

=== Flags
```
-c --config-file [Required] Configuration file containing pipeline definition.
ifdef::trigger_sentence_azure,trigger_sentence_github[-n --pipeline-name [Required] Name that will be set to the pipeline.]
-d --local-directory [Required] Local directory of your project.
ifdef::trigger_sentence_azure,trigger_sentence_github[ --package-pipeline-name [Required] Package pipeline name.]
ifdef::trigger_sentence_azure,trigger_sentence_github[ --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.
```

=== Examples

```
ifdef::trigger_sentence_azure,trigger_sentence_github[ ./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]

ifdef::trigger_sentence_gitlab[ ./pipeline_generator.sh -c ./templates/deploy/deploy-pipeline.cfg -d C:/Users/$USERNAME/Desktop/quarkus-project --k8s-provider EKS --k8s-namespace hangar --k8s-deploy-files-path k8s -b develop -w]
```


=== Appendix: accessing the application

Once the pipeline is executed and your application is deployed, you can list the hostname to access it with:

```
kubectl get ingress -n <namespace>
```
6 changes: 6 additions & 0 deletions documentation/src/gitlab/setup-deploy-pipeline.asciidoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
:provider: Gitlab
:pipeline_type: pipeline
:trigger_sentence_gitlab:
:pipeline_type2: Gitlab pipeline
:path_provider: gitlab
include::../common_templates/setup-deploy-pipeline.asciidoc[]
1 change: 0 additions & 1 deletion scripts/pipelines/common/pipeline_generator.lib
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,6 @@ function help {
echo " --k8s-deploy-files-path [Required] Path from the root of the project to the YAML manifests directory."
echo " --k8s-image-pull-secret-name Name for the generated secret containing registry credentials. Required when using a private registry to host images."
echo ""

exit
}

Expand Down
Loading