From fa6ba27746cac9c22c00da47948b7e5663ef9a3c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Garc=C3=ADa?= Date: Wed, 28 Apr 2021 19:40:51 +0200 Subject: [PATCH 01/13] Support PR deployments --- delivery-k8s/action.yaml | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/delivery-k8s/action.yaml b/delivery-k8s/action.yaml index 70ccd38..1cdeac6 100644 --- a/delivery-k8s/action.yaml +++ b/delivery-k8s/action.yaml @@ -71,6 +71,10 @@ inputs: description: 'Name of the environment variable to be used as tag' required: false default: 'DOCKER_IMAGE_TAG' + deployFromPR: + description: 'Flag that indicates the deployment will be from a Pull Request' + required: false + default: '' outputs: namespace: # id of the output description: 'The kubernetes namespace where the application is deployed to' @@ -132,9 +136,14 @@ runs: shell: bash id: deploy run: |- - BRANCH_LOWER="$(echo "$GITHUB_REF" | tr '[:upper:]' '[:lower:]' | sed 's/_/-/g')" + if [ "${{ inputs.deployFromPR }}" != ""]; then + BRANCH_LOWER="$(echo "$GITHUB_HEAD_REF" | tr '[:upper:]' '[:lower:]' | sed 's/_/-/g')" + BRANCH_TYPE=$BRANCH_LOWER + elif + BRANCH_LOWER="$(echo "$GITHUB_REF" | tr '[:upper:]' '[:lower:]' | sed 's/_/-/g')" + BRANCH_TYPE=$(echo $BRANCH_LOWER | cut -d'/' -f 3) + fi - BRANCH_TYPE=$(echo $BRANCH_LOWER | cut -d'/' -f 3) FEAT_FULL_NAME="$(printf "%s" "${BRANCH_LOWER##*/}" )" FEAT_NAME="${FEAT_FULL_NAME:0:30}" NAMESPACE="" From 297797f6c7b9c2fe3b2bf528e5e8ebcb9269eccd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Garc=C3=ADa?= Date: Wed, 28 Apr 2021 19:50:16 +0200 Subject: [PATCH 02/13] Fix conditional else in delivery-k8s --- delivery-k8s/action.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/delivery-k8s/action.yaml b/delivery-k8s/action.yaml index 1cdeac6..c25e769 100644 --- a/delivery-k8s/action.yaml +++ b/delivery-k8s/action.yaml @@ -139,7 +139,7 @@ runs: if [ "${{ inputs.deployFromPR }}" != ""]; then BRANCH_LOWER="$(echo "$GITHUB_HEAD_REF" | tr '[:upper:]' '[:lower:]' | sed 's/_/-/g')" BRANCH_TYPE=$BRANCH_LOWER - elif + else BRANCH_LOWER="$(echo "$GITHUB_REF" | tr '[:upper:]' '[:lower:]' | sed 's/_/-/g')" BRANCH_TYPE=$(echo $BRANCH_LOWER | cut -d'/' -f 3) fi From efeaf3aca5391d886f26ae01470df48df0783bd3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Francisco=20S=C3=A1nchez=20Molina?= Date: Fri, 25 Jun 2021 11:29:59 +0200 Subject: [PATCH 03/13] add pass-credentials --- helm-push/action.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/helm-push/action.yaml b/helm-push/action.yaml index 4fe99ec..aba9684 100644 --- a/helm-push/action.yaml +++ b/helm-push/action.yaml @@ -74,7 +74,7 @@ runs: HELM_LOCAL_PASS="$(jq -r ".repositories[$counter].password | select (.!=null)" "$REPO_FILE")" HELM_LOCAL_URL="$(jq -r ".repositories[$counter].url | select (.!=null)" "$REPO_FILE")" if [ -n "$HELM_LOCAL_USER" ] ; then - helm repo add $repo $HELM_LOCAL_URL --username $HELM_LOCAL_USER --password $HELM_LOCAL_PASS + helm repo add $repo $HELM_LOCAL_URL --username $HELM_LOCAL_USER --password $HELM_LOCAL_PASS --pass-credentials else helm repo add $repo $HELM_LOCAL_URL fi From 1283001a5d49ba34e085c0fd5794ce2a5c514e5e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Francisco=20S=C3=A1nchez=20Molina?= Date: Fri, 25 Jun 2021 11:54:31 +0200 Subject: [PATCH 04/13] add pass-credentials --- helm-push/action.yaml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/helm-push/action.yaml b/helm-push/action.yaml index aba9684..613bf2f 100644 --- a/helm-push/action.yaml +++ b/helm-push/action.yaml @@ -76,7 +76,7 @@ runs: if [ -n "$HELM_LOCAL_USER" ] ; then helm repo add $repo $HELM_LOCAL_URL --username $HELM_LOCAL_USER --password $HELM_LOCAL_PASS --pass-credentials else - helm repo add $repo $HELM_LOCAL_URL + helm repo add $repo $HELM_LOCAL_URL --pass-credentials fi ((counter=counter+1)) done @@ -91,9 +91,9 @@ runs: run: ./yq w -i ${{ inputs.helmChartPath }}/values.yaml ${{ inputs.dockerImageDigestKeyPath}} "${{ inputs.dockerImageDigest }}" - name: Package helm chart shell: bash - run: helm package ${{ inputs.helmChartPath }} --version=${{ inputs.helmChartPackageVersion }} --dependency-update + run: helm package ${{ inputs.helmChartPath }} --version=${{ inputs.helmChartPackageVersion }} --dependency-update --pass-credentials - name: Publish helm chart to chartmuseum shell: bash run: |- CHART_NAME=$(./yq r ${{ inputs.helmChartPath }}/Chart.yaml 'name') - helm push $CHART_NAME-${{ inputs.helmChartPackageVersion }}.tgz ${{ inputs.chartMuseumRepoName }} --version=${{ inputs.helmChartPackageVersion }} \ No newline at end of file + helm push $CHART_NAME-${{ inputs.helmChartPackageVersion }}.tgz ${{ inputs.chartMuseumRepoName }} --version=${{ inputs.helmChartPackageVersion }} --pass-credentials \ No newline at end of file From ed2bc5e3458dbd6843993bd3c3b2fef57dec8fd0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Francisco=20S=C3=A1nchez=20Molina?= Date: Fri, 25 Jun 2021 12:11:45 +0200 Subject: [PATCH 05/13] add repo update --- helm-push/action.yaml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/helm-push/action.yaml b/helm-push/action.yaml index 613bf2f..66346a7 100644 --- a/helm-push/action.yaml +++ b/helm-push/action.yaml @@ -80,6 +80,9 @@ runs: fi ((counter=counter+1)) done + - name: Helm repo update + shell: bash + run: helm repo update - name: Install helm-push helm plugin shell: bash run: helm plugin install https://github.com/chartmuseum/helm-push.git From be423aa7dec09ade065928de5dbe68dca5218520 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Francisco=20S=C3=A1nchez=20Molina?= Date: Fri, 25 Jun 2021 12:22:36 +0200 Subject: [PATCH 06/13] add pass-credentials --- delivery-k8s/action.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/delivery-k8s/action.yaml b/delivery-k8s/action.yaml index 70ccd38..8356e45 100644 --- a/delivery-k8s/action.yaml +++ b/delivery-k8s/action.yaml @@ -113,7 +113,7 @@ runs: HELM_LOCAL_PASS="$(jq -r ".repositories[$counter].password | select (.!=null)" "$REPO_FILE")" HELM_LOCAL_URL="$(jq -r ".repositories[$counter].url | select (.!=null)" "$REPO_FILE")" if [ -n "$HELM_LOCAL_USER" ] ; then - helm repo add $repo $HELM_LOCAL_URL --username $HELM_LOCAL_USER --password $HELM_LOCAL_PASS + helm repo add $repo $HELM_LOCAL_URL --username $HELM_LOCAL_USER --password $HELM_LOCAL_PASS --pass-credentials else helm repo add $repo $HELM_LOCAL_URL fi @@ -128,7 +128,7 @@ runs: - name: Install helm-secrets helm plugin shell: bash run: helm plugin install https://github.com/zendesk/helm-secrets - - name: Syncronize helm releases using helmfile and replacing docker image digest + - name: Syncronize helm releases using helmfile and replacing docker image digest --pass-credentials shell: bash id: deploy run: |- From d69477ca9c7e20abc787159530d395d9ebbe0053 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Francisco=20S=C3=A1nchez=20Molina?= Date: Fri, 25 Jun 2021 12:37:23 +0200 Subject: [PATCH 07/13] add pass-credentials --- delivery-k8s/action.yaml | 2 +- helm-push/action.yaml | 9 +++------ 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/delivery-k8s/action.yaml b/delivery-k8s/action.yaml index 8356e45..b6749c4 100644 --- a/delivery-k8s/action.yaml +++ b/delivery-k8s/action.yaml @@ -128,7 +128,7 @@ runs: - name: Install helm-secrets helm plugin shell: bash run: helm plugin install https://github.com/zendesk/helm-secrets - - name: Syncronize helm releases using helmfile and replacing docker image digest --pass-credentials + - name: Syncronize helm releases using helmfile and replacing docker image digest shell: bash id: deploy run: |- diff --git a/helm-push/action.yaml b/helm-push/action.yaml index 66346a7..aba9684 100644 --- a/helm-push/action.yaml +++ b/helm-push/action.yaml @@ -76,13 +76,10 @@ runs: if [ -n "$HELM_LOCAL_USER" ] ; then helm repo add $repo $HELM_LOCAL_URL --username $HELM_LOCAL_USER --password $HELM_LOCAL_PASS --pass-credentials else - helm repo add $repo $HELM_LOCAL_URL --pass-credentials + helm repo add $repo $HELM_LOCAL_URL fi ((counter=counter+1)) done - - name: Helm repo update - shell: bash - run: helm repo update - name: Install helm-push helm plugin shell: bash run: helm plugin install https://github.com/chartmuseum/helm-push.git @@ -94,9 +91,9 @@ runs: run: ./yq w -i ${{ inputs.helmChartPath }}/values.yaml ${{ inputs.dockerImageDigestKeyPath}} "${{ inputs.dockerImageDigest }}" - name: Package helm chart shell: bash - run: helm package ${{ inputs.helmChartPath }} --version=${{ inputs.helmChartPackageVersion }} --dependency-update --pass-credentials + run: helm package ${{ inputs.helmChartPath }} --version=${{ inputs.helmChartPackageVersion }} --dependency-update - name: Publish helm chart to chartmuseum shell: bash run: |- CHART_NAME=$(./yq r ${{ inputs.helmChartPath }}/Chart.yaml 'name') - helm push $CHART_NAME-${{ inputs.helmChartPackageVersion }}.tgz ${{ inputs.chartMuseumRepoName }} --version=${{ inputs.helmChartPackageVersion }} --pass-credentials \ No newline at end of file + helm push $CHART_NAME-${{ inputs.helmChartPackageVersion }}.tgz ${{ inputs.chartMuseumRepoName }} --version=${{ inputs.helmChartPackageVersion }} \ No newline at end of file From d3c88466269e9ecd3adc56361a906001a7b49f66 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Francisco=20S=C3=A1nchez=20Molina?= Date: Mon, 28 Jun 2021 13:15:23 +0200 Subject: [PATCH 08/13] revert to helm 3.6.0 in ubuntu actions --- delivery-k8s/action.yaml | 4 ++-- helm-push/action.yaml | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/delivery-k8s/action.yaml b/delivery-k8s/action.yaml index b6749c4..1eb2090 100644 --- a/delivery-k8s/action.yaml +++ b/delivery-k8s/action.yaml @@ -103,7 +103,7 @@ runs: gcloud container clusters get-credentials ${{ inputs.gkeClusterName }} --zone ${{ inputs.gcpClusterZone }} - name: Add helm repositories shell: bash - run: |- + run: |- # helm 3.6.1 require helm repo add $repo $HELM_LOCAL_URL --username $HELM_LOCAL_USER --password $HELM_LOCAL_PASS --pass-credentials echo "Adding helm repositories.." counter=0 REPO_FILE="$(mktemp --suffix .json)" @@ -113,7 +113,7 @@ runs: HELM_LOCAL_PASS="$(jq -r ".repositories[$counter].password | select (.!=null)" "$REPO_FILE")" HELM_LOCAL_URL="$(jq -r ".repositories[$counter].url | select (.!=null)" "$REPO_FILE")" if [ -n "$HELM_LOCAL_USER" ] ; then - helm repo add $repo $HELM_LOCAL_URL --username $HELM_LOCAL_USER --password $HELM_LOCAL_PASS --pass-credentials + helm repo add $repo $HELM_LOCAL_URL --username $HELM_LOCAL_USER --password $HELM_LOCAL_PASS else helm repo add $repo $HELM_LOCAL_URL fi diff --git a/helm-push/action.yaml b/helm-push/action.yaml index aba9684..e6bc2e4 100644 --- a/helm-push/action.yaml +++ b/helm-push/action.yaml @@ -64,7 +64,7 @@ runs: run: ./sops -d ${{ inputs.helmRepoFilePath }} > ./helm.repositories.dec.yaml - name: Add helm repositories shell: bash - run: |- + run: |- # helm 3.6.1 require helm repo add $repo $HELM_LOCAL_URL --username $HELM_LOCAL_USER --password $HELM_LOCAL_PASS --pass-credentials echo "Adding helm repositories.." counter=0 REPO_FILE="$(mktemp --suffix .json)" @@ -74,7 +74,7 @@ runs: HELM_LOCAL_PASS="$(jq -r ".repositories[$counter].password | select (.!=null)" "$REPO_FILE")" HELM_LOCAL_URL="$(jq -r ".repositories[$counter].url | select (.!=null)" "$REPO_FILE")" if [ -n "$HELM_LOCAL_USER" ] ; then - helm repo add $repo $HELM_LOCAL_URL --username $HELM_LOCAL_USER --password $HELM_LOCAL_PASS --pass-credentials + helm repo add $repo $HELM_LOCAL_URL --username $HELM_LOCAL_USER --password $HELM_LOCAL_PASS else helm repo add $repo $HELM_LOCAL_URL fi From 525659b7ebc80126da3f0240df7f4a5405a724dd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Francisco=20S=C3=A1nchez=20Molina?= Date: Wed, 30 Jun 2021 11:31:49 +0200 Subject: [PATCH 09/13] move to helm 3.6.1 --- delivery-k8s/action.yaml | 76 ++++++++++++++++++++-------------------- helm-push/action.yaml | 4 +-- 2 files changed, 40 insertions(+), 40 deletions(-) diff --git a/delivery-k8s/action.yaml b/delivery-k8s/action.yaml index 1eb2090..7cd965a 100644 --- a/delivery-k8s/action.yaml +++ b/delivery-k8s/action.yaml @@ -4,79 +4,79 @@ description: |- Deploy your applications to kubernetes using helm inputs: helmRepoFilePath: - description: 'Path to the encrypted helm repos file' + description: "Path to the encrypted helm repos file" required: false - default: 'helm.repositories.yaml' + default: "helm.repositories.yaml" helmfileName: - description: 'Name of the helmfile config' + description: "Name of the helmfile config" required: false - default: 'helmfile.yaml' + default: "helmfile.yaml" baseDeployDir: - description: 'Directory where different deployment enviroment folders are placed' + description: "Directory where different deployment enviroment folders are placed" required: false - default: 'deploy' + default: "deploy" environment: description: 'Environment where to deploy the application. Must match with a the folder name inside "baseDeployDir". Inside the folder path a helmfile inside have to be placed' required: false - default: '' + default: "" appPrefix: - description: 'Prefix of application namespace deployed in to the cluster' + description: "Prefix of application namespace deployed in to the cluster" required: true - default: '' + default: "" projectPrefix: - description: 'Prefix of project namespace deployed in to the cluster' + description: "Prefix of project namespace deployed in to the cluster" required: true - default: '' + default: "" gcpProjectId: - description: 'Project id where the kubernetes cluster is located' + description: "Project id where the kubernetes cluster is located" required: true - default: '' + default: "" gcpServiceAccountKey: - description: 'Gcp service account key to use for authentication agains gcp' + description: "Gcp service account key to use for authentication agains gcp" required: true - default: '' + default: "" gkeClusterName: - description: 'GKE k8s cluster name' + description: "GKE k8s cluster name" required: true - default: '' + default: "" gcpClusterZone: - description: 'Gcp zone where the cluster is located' + description: "Gcp zone where the cluster is located" required: true - default: '' + default: "" helmfileVersion: - description: 'Version of helmfile' + description: "Version of helmfile" required: false - default: 'v0.132.0' + default: "v0.132.0" dockerImageDigest: - description: 'Docker image digest to be placed in the helm chart values. Require replaceDockerImage attr set to true' + description: "Docker image digest to be placed in the helm chart values. Require replaceDockerImage attr set to true" required: false - default: '' + default: "" dockerImageDigestKeyPath: - description: 'Yaml path in dot notation to Docker image digest value that needs to be replaced' + description: "Yaml path in dot notation to Docker image digest value that needs to be replaced" required: false - default: 'base.deployment.image.digest' + default: "base.deployment.image.digest" dockerImageTag: - description: 'Docker image tag to be placed in the helm chart values. Require replaceDockerImage attr set to true' + description: "Docker image tag to be placed in the helm chart values. Require replaceDockerImage attr set to true" required: false - default: '' + default: "" dockerImageTagKeyPath: - description: 'Yaml path in dot notation to Docker image tag value that needs to be replaced' + description: "Yaml path in dot notation to Docker image tag value that needs to be replaced" required: false - default: 'base.deployment.image.tag' + default: "base.deployment.image.tag" dockerImageTagEnv: - description: 'Exported docker image tag as environment variable to be used in helmfile values instead of set' + description: "Exported docker image tag as environment variable to be used in helmfile values instead of set" required: false - default: '' + default: "" dockerImageTagEnvName: - description: 'Name of the environment variable to be used as tag' + description: "Name of the environment variable to be used as tag" required: false - default: 'DOCKER_IMAGE_TAG' + default: "DOCKER_IMAGE_TAG" outputs: namespace: # id of the output - description: 'The kubernetes namespace where the application is deployed to' + description: "The kubernetes namespace where the application is deployed to" value: "${{ steps.deploy.outputs.namespace }}" branch_short: # id of the output - description: 'The name of the kubernetes branch (eg: ft-some-name)' + description: "The name of the kubernetes branch (eg: ft-some-name)" value: "${{ steps.deploy.outputs.branch_short }}" runs: using: "composite" @@ -103,7 +103,7 @@ runs: gcloud container clusters get-credentials ${{ inputs.gkeClusterName }} --zone ${{ inputs.gcpClusterZone }} - name: Add helm repositories shell: bash - run: |- # helm 3.6.1 require helm repo add $repo $HELM_LOCAL_URL --username $HELM_LOCAL_USER --password $HELM_LOCAL_PASS --pass-credentials + run: |- echo "Adding helm repositories.." counter=0 REPO_FILE="$(mktemp --suffix .json)" @@ -113,7 +113,7 @@ runs: HELM_LOCAL_PASS="$(jq -r ".repositories[$counter].password | select (.!=null)" "$REPO_FILE")" HELM_LOCAL_URL="$(jq -r ".repositories[$counter].url | select (.!=null)" "$REPO_FILE")" if [ -n "$HELM_LOCAL_USER" ] ; then - helm repo add $repo $HELM_LOCAL_URL --username $HELM_LOCAL_USER --password $HELM_LOCAL_PASS + helm repo add $repo $HELM_LOCAL_URL --username $HELM_LOCAL_USER --password $HELM_LOCAL_PASS --pass-credentials else helm repo add $repo $HELM_LOCAL_URL fi @@ -181,4 +181,4 @@ runs: export ${{inputs.dockerImageTagEnvName}}=${{inputs.dockerImageTagEnv}} fi - ./helmfile --file ${{ inputs.baseDeployDir }}/$ENVIRONMENT/${{ inputs.helmfileName }} sync $HELM_EXTRA_ARGS \ No newline at end of file + ./helmfile --file ${{ inputs.baseDeployDir }}/$ENVIRONMENT/${{ inputs.helmfileName }} sync $HELM_EXTRA_ARGS diff --git a/helm-push/action.yaml b/helm-push/action.yaml index e6bc2e4..aba9684 100644 --- a/helm-push/action.yaml +++ b/helm-push/action.yaml @@ -64,7 +64,7 @@ runs: run: ./sops -d ${{ inputs.helmRepoFilePath }} > ./helm.repositories.dec.yaml - name: Add helm repositories shell: bash - run: |- # helm 3.6.1 require helm repo add $repo $HELM_LOCAL_URL --username $HELM_LOCAL_USER --password $HELM_LOCAL_PASS --pass-credentials + run: |- echo "Adding helm repositories.." counter=0 REPO_FILE="$(mktemp --suffix .json)" @@ -74,7 +74,7 @@ runs: HELM_LOCAL_PASS="$(jq -r ".repositories[$counter].password | select (.!=null)" "$REPO_FILE")" HELM_LOCAL_URL="$(jq -r ".repositories[$counter].url | select (.!=null)" "$REPO_FILE")" if [ -n "$HELM_LOCAL_USER" ] ; then - helm repo add $repo $HELM_LOCAL_URL --username $HELM_LOCAL_USER --password $HELM_LOCAL_PASS + helm repo add $repo $HELM_LOCAL_URL --username $HELM_LOCAL_USER --password $HELM_LOCAL_PASS --pass-credentials else helm repo add $repo $HELM_LOCAL_URL fi From 1227cdfd564e6016e1ccff30198744d418ddf69e Mon Sep 17 00:00:00 2001 From: francisco-sanchez-molina Date: Tue, 5 Oct 2021 12:21:55 +0200 Subject: [PATCH 10/13] helm-push 0.9.0 --- helm-push/action.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/helm-push/action.yaml b/helm-push/action.yaml index aba9684..32e7ee8 100644 --- a/helm-push/action.yaml +++ b/helm-push/action.yaml @@ -82,7 +82,7 @@ runs: done - name: Install helm-push helm plugin shell: bash - run: helm plugin install https://github.com/chartmuseum/helm-push.git + run: helm plugin install https://github.com/chartmuseum/helm-push.git --version=v0.9.0 - name: Override docker image tag to be used shell: bash run: ./yq w -i ${{ inputs.helmChartPath }}/values.yaml ${{ inputs.dockerImageTagKeyPath}} "${{ inputs.dockerImageTag }}" @@ -96,4 +96,4 @@ runs: shell: bash run: |- CHART_NAME=$(./yq r ${{ inputs.helmChartPath }}/Chart.yaml 'name') - helm push $CHART_NAME-${{ inputs.helmChartPackageVersion }}.tgz ${{ inputs.chartMuseumRepoName }} --version=${{ inputs.helmChartPackageVersion }} \ No newline at end of file + helm push $CHART_NAME-${{ inputs.helmChartPackageVersion }}.tgz ${{ inputs.chartMuseumRepoName }} --version=${{ inputs.helmChartPackageVersion }} From c4413f9d7a3de7b81eb75c80e73bb18275e79935 Mon Sep 17 00:00:00 2001 From: Carlos Barreiro Mata Date: Mon, 23 May 2022 16:10:58 +0200 Subject: [PATCH 11/13] Chore/fix delivery 2 (#1) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * add pass-credentials * add pass-credentials * add repo update * add pass-credentials * add pass-credentials * revert to helm 3.6.0 in ubuntu actions * move to helm 3.6.1 * helm-push 0.9.0 Co-authored-by: Francisco Sánchez Molina --- delivery-k8s/action.yaml | 72 ++++++++++++++++++++-------------------- helm-push/action.yaml | 6 ++-- 2 files changed, 39 insertions(+), 39 deletions(-) diff --git a/delivery-k8s/action.yaml b/delivery-k8s/action.yaml index c25e769..943afc0 100644 --- a/delivery-k8s/action.yaml +++ b/delivery-k8s/action.yaml @@ -4,71 +4,71 @@ description: |- Deploy your applications to kubernetes using helm inputs: helmRepoFilePath: - description: 'Path to the encrypted helm repos file' + description: "Path to the encrypted helm repos file" required: false - default: 'helm.repositories.yaml' + default: "helm.repositories.yaml" helmfileName: - description: 'Name of the helmfile config' + description: "Name of the helmfile config" required: false - default: 'helmfile.yaml' + default: "helmfile.yaml" baseDeployDir: - description: 'Directory where different deployment enviroment folders are placed' + description: "Directory where different deployment enviroment folders are placed" required: false - default: 'deploy' + default: "deploy" environment: description: 'Environment where to deploy the application. Must match with a the folder name inside "baseDeployDir". Inside the folder path a helmfile inside have to be placed' required: false - default: '' + default: "" appPrefix: - description: 'Prefix of application namespace deployed in to the cluster' + description: "Prefix of application namespace deployed in to the cluster" required: true - default: '' + default: "" projectPrefix: - description: 'Prefix of project namespace deployed in to the cluster' + description: "Prefix of project namespace deployed in to the cluster" required: true - default: '' + default: "" gcpProjectId: - description: 'Project id where the kubernetes cluster is located' + description: "Project id where the kubernetes cluster is located" required: true - default: '' + default: "" gcpServiceAccountKey: - description: 'Gcp service account key to use for authentication agains gcp' + description: "Gcp service account key to use for authentication agains gcp" required: true - default: '' + default: "" gkeClusterName: - description: 'GKE k8s cluster name' + description: "GKE k8s cluster name" required: true - default: '' + default: "" gcpClusterZone: - description: 'Gcp zone where the cluster is located' + description: "Gcp zone where the cluster is located" required: true - default: '' + default: "" helmfileVersion: - description: 'Version of helmfile' + description: "Version of helmfile" required: false - default: 'v0.132.0' + default: "v0.132.0" dockerImageDigest: - description: 'Docker image digest to be placed in the helm chart values. Require replaceDockerImage attr set to true' + description: "Docker image digest to be placed in the helm chart values. Require replaceDockerImage attr set to true" required: false - default: '' + default: "" dockerImageDigestKeyPath: - description: 'Yaml path in dot notation to Docker image digest value that needs to be replaced' + description: "Yaml path in dot notation to Docker image digest value that needs to be replaced" required: false - default: 'base.deployment.image.digest' + default: "base.deployment.image.digest" dockerImageTag: - description: 'Docker image tag to be placed in the helm chart values. Require replaceDockerImage attr set to true' + description: "Docker image tag to be placed in the helm chart values. Require replaceDockerImage attr set to true" required: false - default: '' + default: "" dockerImageTagKeyPath: - description: 'Yaml path in dot notation to Docker image tag value that needs to be replaced' + description: "Yaml path in dot notation to Docker image tag value that needs to be replaced" required: false - default: 'base.deployment.image.tag' + default: "base.deployment.image.tag" dockerImageTagEnv: - description: 'Exported docker image tag as environment variable to be used in helmfile values instead of set' + description: "Exported docker image tag as environment variable to be used in helmfile values instead of set" required: false - default: '' + default: "" dockerImageTagEnvName: - description: 'Name of the environment variable to be used as tag' + description: "Name of the environment variable to be used as tag" required: false default: 'DOCKER_IMAGE_TAG' deployFromPR: @@ -77,10 +77,10 @@ inputs: default: '' outputs: namespace: # id of the output - description: 'The kubernetes namespace where the application is deployed to' + description: "The kubernetes namespace where the application is deployed to" value: "${{ steps.deploy.outputs.namespace }}" branch_short: # id of the output - description: 'The name of the kubernetes branch (eg: ft-some-name)' + description: "The name of the kubernetes branch (eg: ft-some-name)" value: "${{ steps.deploy.outputs.branch_short }}" runs: using: "composite" @@ -117,7 +117,7 @@ runs: HELM_LOCAL_PASS="$(jq -r ".repositories[$counter].password | select (.!=null)" "$REPO_FILE")" HELM_LOCAL_URL="$(jq -r ".repositories[$counter].url | select (.!=null)" "$REPO_FILE")" if [ -n "$HELM_LOCAL_USER" ] ; then - helm repo add $repo $HELM_LOCAL_URL --username $HELM_LOCAL_USER --password $HELM_LOCAL_PASS + helm repo add $repo $HELM_LOCAL_URL --username $HELM_LOCAL_USER --password $HELM_LOCAL_PASS --pass-credentials else helm repo add $repo $HELM_LOCAL_URL fi @@ -190,4 +190,4 @@ runs: export ${{inputs.dockerImageTagEnvName}}=${{inputs.dockerImageTagEnv}} fi - ./helmfile --file ${{ inputs.baseDeployDir }}/$ENVIRONMENT/${{ inputs.helmfileName }} sync $HELM_EXTRA_ARGS \ No newline at end of file + ./helmfile --file ${{ inputs.baseDeployDir }}/$ENVIRONMENT/${{ inputs.helmfileName }} sync $HELM_EXTRA_ARGS diff --git a/helm-push/action.yaml b/helm-push/action.yaml index 4fe99ec..32e7ee8 100644 --- a/helm-push/action.yaml +++ b/helm-push/action.yaml @@ -74,7 +74,7 @@ runs: HELM_LOCAL_PASS="$(jq -r ".repositories[$counter].password | select (.!=null)" "$REPO_FILE")" HELM_LOCAL_URL="$(jq -r ".repositories[$counter].url | select (.!=null)" "$REPO_FILE")" if [ -n "$HELM_LOCAL_USER" ] ; then - helm repo add $repo $HELM_LOCAL_URL --username $HELM_LOCAL_USER --password $HELM_LOCAL_PASS + helm repo add $repo $HELM_LOCAL_URL --username $HELM_LOCAL_USER --password $HELM_LOCAL_PASS --pass-credentials else helm repo add $repo $HELM_LOCAL_URL fi @@ -82,7 +82,7 @@ runs: done - name: Install helm-push helm plugin shell: bash - run: helm plugin install https://github.com/chartmuseum/helm-push.git + run: helm plugin install https://github.com/chartmuseum/helm-push.git --version=v0.9.0 - name: Override docker image tag to be used shell: bash run: ./yq w -i ${{ inputs.helmChartPath }}/values.yaml ${{ inputs.dockerImageTagKeyPath}} "${{ inputs.dockerImageTag }}" @@ -96,4 +96,4 @@ runs: shell: bash run: |- CHART_NAME=$(./yq r ${{ inputs.helmChartPath }}/Chart.yaml 'name') - helm push $CHART_NAME-${{ inputs.helmChartPackageVersion }}.tgz ${{ inputs.chartMuseumRepoName }} --version=${{ inputs.helmChartPackageVersion }} \ No newline at end of file + helm push $CHART_NAME-${{ inputs.helmChartPackageVersion }}.tgz ${{ inputs.chartMuseumRepoName }} --version=${{ inputs.helmChartPackageVersion }} From a99f30f56739ad08fb52486dae2c9dd6e90057b2 Mon Sep 17 00:00:00 2001 From: Carlos Barreiro Mata Date: Tue, 24 May 2022 16:41:32 +0200 Subject: [PATCH 12/13] Feat/GitHub workflow refactor (#2) * added setup node composite action * added shell * fix shell * delete shell --- setup-node/action.yaml | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 setup-node/action.yaml diff --git a/setup-node/action.yaml b/setup-node/action.yaml new file mode 100644 index 0000000..4b366c4 --- /dev/null +++ b/setup-node/action.yaml @@ -0,0 +1,34 @@ +name: Set up node environment +author: mrBillin +description: Set up a job with code, node and cache node_modules + +inputs: + node-version: + description: 'Node version' + required: false + default: '14.x' + +outputs: + dependencies-cache-hit: + description: 'is the node_modules cached' + value: "${{ steps.dependencies-cache.outputs.cache-hit }}" + +runs: + using: "composite" + steps: + - name: Git Checkout + uses: actions/checkout@v3 + - name: Use Node + uses: actions/setup-node@v3 + with: + node-version: '14.x' + - name: Cache node_modules + uses: actions/cache@v3 + id: dependencies-cache + with: + path: | + ~/.npm + **/node_modules + key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} + restore-keys: | + ${{ runner.os }}-node- From 623b0269817bc92b1dda43bee5776dcd15542998 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9s=20Nieto?= Date: Wed, 26 Apr 2023 15:15:10 +0200 Subject: [PATCH 13/13] Fix destroy branch message --- destroy-environment/action.yaml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/destroy-environment/action.yaml b/destroy-environment/action.yaml index 2fe030d..a9992e3 100644 --- a/destroy-environment/action.yaml +++ b/destroy-environment/action.yaml @@ -49,8 +49,7 @@ runs: export NAMESPACE+="-hot-"$FEAT_NAME export BRANCH_SHORT="hot-"$FEAT_NAME echo "Deleting namespace $NAMESPACE for hotfix branch $BRANCH_LOWER" - kubectl delete namespace $NAMESPACE + kubectl delete namespace $NAMESPACE else - echo "Error branch type do not match" - exit 1; + echo "Branch doesn't matches, all fine!" fi