-
Notifications
You must be signed in to change notification settings - Fork 25
Feature/GitHub deploy workflow #179
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
prathibhapadma
wants to merge
22
commits into
devonfw:master
Choose a base branch
from
prathibhapadma:feature/github_deploy_workflow
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
22 commits
Select commit
Hold shift + click to select a range
ce7673c
updated with github deploy workflow
prathibhapadma 59cb072
updated
prathibhapadma 58f2221
Automatic generation of documentation
prathibhapadma ee16702
update with tag
prathibhapadma 919ecc5
Update deploy.sh
prathibhapadma cf4ed3a
Update deploy-pipeline.yml.template
prathibhapadma 1155ab3
Update deploy-pipeline.yml.template
prathibhapadma 0ec4aa6
Update pipeline_generator.sh
prathibhapadma c43b52a
Update deploy.sh
prathibhapadma 075cfb3
tag_completed was unused
ultymatom 2a706b5
Update deploy.sh
ultymatom ce4379d
commit intermediaire
ultymatom e5650f5
Merge branch 'devonfw:master' into feature/github_deploy_workflow
prathibhapadma e51397e
works well !
ultymatom c714dd4
Merge remote-tracking branch 'origin/feature/github_deploy_workflow' …
ultymatom 821d9bc
Update setup-deploy-pipeline.asciidoc
prathibhapadma 451a7c3
Automatic generation of documentation
prathibhapadma cf8fcfd
Update setup-deploy-pipeline.asciidoc
prathibhapadma 1998d19
Automatic generation of documentation
prathibhapadma 334d2fc
Merge branch 'devonfw:master' into feature/github_deploy_workflow
prathibhapadma ae88d59
Merge branch 'master' into feature/github_deploy_workflow
prathibhapadma 584b15c
fixed with line ending checks
prathibhapadma File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,69 @@ | ||
| :provider: Github | ||
| :pipeline_type: workflow | ||
| :trigger_sentence_github: | ||
| :pipeline_type2: Github action | ||
| :path_provider: github | ||
| = Setting up a Deploy Pipeline on {provider} | ||
|
|
||
| In this section we will create a deploy {pipeline_type} on {provider} 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_type} is executed successfully on a commit for `release/*` and `develop` branches, requiring manual launch for other branches but still enforcing that package {pipeline_type} has passed. By default, it depends on the environment provisioning {pipeline_type} 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_type}. | ||
|
|
||
| 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/{path_provider}/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_type} using provided script | ||
|
|
||
| === Usage | ||
| ``` | ||
| 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/{path_provider}/templates/deploy/deploy-pipeline.cfg`. | ||
|
|
||
| === Flags | ||
| ``` | ||
| -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. | ||
| ``` | ||
|
|
||
| === 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 | ||
| ``` | ||
|
|
||
|
|
||
| === Appendix: accessing the application | ||
|
|
||
| Once the {pipeline_type} 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
6
documentation/src/azure-devops/setup-deploy-pipeline.asciidoc
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| :provider: Azure Devops | ||
| :pipeline_type: Pipeline | ||
| :trigger_sentence: | ||
| :pipeline_type2: pipeline | ||
| :path_provider: azure-devops | ||
| include::../common_templates/setup-deploy-pipeline.asciidoc[] |
64 changes: 64 additions & 0 deletions
64
documentation/src/common_templates/setup-deploy-pipeline.asciidoc
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,64 @@ | ||
| = Setting up a Deploy Pipeline on {provider} | ||
|
|
||
| In this section we will create a deploy {pipeline_type} on {provider} 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_type} is executed successfully on a commit for `release/*` and `develop` branches, requiring manual launch for other branches but still enforcing that package {pipeline_type} has passed. By default, it depends on the environment provisioning {pipeline_type} 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_type}. | ||
|
|
||
| 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/{path_provider}/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_type} using provided script | ||
|
|
||
| === Usage | ||
| ``` | ||
| 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/{path_provider}/templates/deploy/deploy-pipeline.cfg`. | ||
|
|
||
| === Flags | ||
| ``` | ||
| -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. | ||
| ``` | ||
|
|
||
| === 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 | ||
| ``` | ||
|
|
||
|
|
||
| === Appendix: accessing the application | ||
|
|
||
| Once the {pipeline_type} is executed and your application is deployed, you can list the hostname to access it with: | ||
|
|
||
| ``` | ||
| kubectl get ingress -n <namespace> | ||
| ``` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| :provider: Github | ||
| :pipeline_type: workflow | ||
| :trigger_sentence_github: | ||
| :pipeline_type2: Github action | ||
| :path_provider: github | ||
| include::../common_templates/setup-deploy-pipeline.asciidoc[] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 30 additions & 0 deletions
30
scripts/pipelines/github/templates/deploy/deploy-pipeline.cfg
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,30 @@ | ||
| # List of the flages we used in different stages for deploy pipeline. | ||
| # Comma separated list of flags. Make sure to end with a comma, Eg: $name,$xyz, | ||
| mandatoryFlags="$pipelineName,$localDirectory,$packagePipelineName,$envProvisionPipelineName,$k8sProvider,$k8sNamespace,$k8sDeployFiles," | ||
| # Path to the templates. | ||
| templatesPath="scripts/pipelines/github/templates/deploy" | ||
| # YAML file name. | ||
| yamlFile="deploy-pipeline.yml" | ||
| # Source branch. | ||
| sourceBranch="feature/deploy-pipeline" | ||
|
|
||
| # Function that copies the extra yaml files into the directory. | ||
| function copyScript { | ||
| # Copy the deploy script. | ||
| cp "${hangarPath}/${templatesPath}/deploy.sh" "${localDirectory}/${scriptFilePath}" | ||
|
|
||
| # Copy the script for generating imagePullSecrets for private registries. | ||
| cp "${hangarPath}/${templatesPath}/secrets.sh" "${localDirectory}/${scriptFilePath}" | ||
| } | ||
|
|
||
| function addPipelineVariables { | ||
| # We cannot use a variable in the definition of resource in the pipeline so we have to use a placeholder to replace it with the value we need | ||
| export packagePipelineName | ||
| export envProvisionPipelineName | ||
| export k8sProvider | ||
| export k8sNamespace | ||
| export k8sDeployFiles | ||
| export k8sImagePullSecret | ||
| specificEnvSubstList='${packagePipelineName} ${envProvisionPipelineName} ${k8sProvider} ${k8sNamespace} ${k8sDeployFiles} ${k8sImagePullSecret}' | ||
| } | ||
|
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.