ci: add cosmetic changes to deploy-preview ci (#20131)

This commit is contained in:
Goutham Pratapa 2023-01-27 11:31:55 +05:30 committed by GitHub
parent 4532d0c962
commit 506b0230d5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 18 additions and 8 deletions

View File

@ -6,7 +6,7 @@ on:
types: [ build-deploy-preview-command ] types: [ build-deploy-preview-command ]
jobs: jobs:
notify: notify-job-details:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
# This step creates a comment on the PR with a link to this workflow run. # This step creates a comment on the PR with a link to this workflow run.
@ -18,7 +18,6 @@ jobs:
Deploying Your Preview: <${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}>. Deploying Your Preview: <${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}>.
Workflow: `${{ github.workflow }}`. Workflow: `${{ github.workflow }}`.
PR: ${{ github.event.client_payload.pull_request.number }}. PR: ${{ github.event.client_payload.pull_request.number }}.
URL: https://${{ github.event.client_payload.pull_request.number }}-ce.appsmith.com
server-build: server-build:
name: server-build name: server-build
@ -95,10 +94,10 @@ jobs:
with: with:
username: ${{ secrets.DOCKER_HUB_USERNAME }} username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }} password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
repository: ${{ secrets.DOCKER_HUB_ORGANIZATION }}/appsmith-ce repository: ${{ secrets.DOCKER_HUB_ORGANIZATION }}/appsmith-dp
tags: ${{ steps.git_hash.outputs.git_hash }} tags: ${{ github.event.client_payload.pull_request.number }}-ce
outputs: outputs:
imageHash: ${{ steps.git_hash.outputs.git_hash }} imageHash: ${{ github.event.client_payload.pull_request.number }}-ce
build-deploy-preview: build-deploy-preview:
needs: [push-image] needs: [push-image]
@ -139,3 +138,14 @@ jobs:
run: | run: |
echo "environment variables set to deploy the image" $IMAGE_HASH echo "environment variables set to deploy the image" $IMAGE_HASH
/bin/bash ./scripts/deploy_preview.sh /bin/bash ./scripts/deploy_preview.sh
notify-url:
runs-on: ubuntu-latest
steps:
# This step creates a comment on the PR with a link to this workflow run.
- name: Add a comment on the PR with link to workflow run
uses: peter-evans/create-or-update-comment@v2
with:
issue-number: ${{ github.event.client_payload.pull_request.number }}
body: |
Deploy-Preview-URL: https://${{ github.event.client_payload.pull_request.number }}-ce.dp.appsmith.com

View File

@ -23,14 +23,14 @@ echo "Region: $region"
echo "Cluster name: $cluster_name" echo "Cluster name: $cluster_name"
echo "Pull Request Number: $PULL_REQUEST_NUMBER" echo "Pull Request Number: $PULL_REQUEST_NUMBER"
sts_output=$(aws sts assume-role --role-arn env.AWS_ROLE_ARN --role-session-name ekscisession sts_output=$(aws sts assume-role --role-arn env.AWS_ROLE_ARN --role-session-name ekscisession)
export AWS_ACCESS_KEY_ID=$(echo $sts_output | jq -r '.Credentials''.AccessKeyId');\ export AWS_ACCESS_KEY_ID=$(echo $sts_output | jq -r '.Credentials''.AccessKeyId');\
export AWS_SECRET_ACCESS_KEY=$(echo $sts_output | jq -r '.Credentials''.SecretAccessKey');\ export AWS_SECRET_ACCESS_KEY=$(echo $sts_output | jq -r '.Credentials''.SecretAccessKey');\
export AWS_SESSION_TOKEN=$(echo $sts_output | jq -r '.Credentials''.SessionToken'); export AWS_SESSION_TOKEN=$(echo $sts_output | jq -r '.Credentials''.SessionToken');
export NAMESPACE="$PULL_REQUEST_NUMBER"ce export NAMESPACE="$PULL_REQUEST_NUMBER"ce
export SECRET="$PULL_REQUEST_NUMBER"ce export SECRET="$PULL_REQUEST_NUMBER"ce
export DOMAINNAME="$PULL_REQUEST_NUMBER"-ce.appsmith.com export DOMAINNAME="$PULL_REQUEST_NUMBER"-ce.dp.appsmith.com
export HELMCHART="appsmith" export HELMCHART="appsmith"
export HELMCHART_URL="http://helm.appsmith.com" export HELMCHART_URL="http://helm.appsmith.com"
export HELMCHART_VERSION="2.0.0" export HELMCHART_VERSION="2.0.0"
@ -58,7 +58,7 @@ AWS_REGION=ap-south-1 helm repo add $HELMCHART $HELMCHART_URL
echo "Deploy appsmith helm chart" echo "Deploy appsmith helm chart"
helm install appsmith/appsmith --generate-name -n $NAMESPACE \ helm install appsmith/appsmith --generate-name -n $NAMESPACE \
--create-namespace --set image.repository=$DOCKER_HUB_ORGANIZATION/appsmith-ce --set image.tag=$IMAGE_HASH \ --create-namespace --set image.repository=$DOCKER_HUB_ORGANIZATION/appsmith-dp --set image.tag=$IMAGE_HASH \
--set image.pullSecrets=$SECRET --set redis.enabled=false --set mongodb.enabled=false --set ingress.enabled=true \ --set image.pullSecrets=$SECRET --set redis.enabled=false --set mongodb.enabled=false --set ingress.enabled=true \
--set "ingress.annotations.service\.beta\.kubernetes\.io/aws-load-balancer-ssl-cert=$AWS_RELEASE_CERT" \ --set "ingress.annotations.service\.beta\.kubernetes\.io/aws-load-balancer-ssl-cert=$AWS_RELEASE_CERT" \
--set "ingress.hosts[0].host=$DOMAINNAME, ingress.hosts[0].paths[0].path=/, ingress.hosts[0].paths[0].pathType=Prefix" \ --set "ingress.hosts[0].host=$DOMAINNAME, ingress.hosts[0].paths[0].path=/, ingress.hosts[0].paths[0].pathType=Prefix" \