Skip to content

chore(release): pull hotfix-release/v1.62.1 into main #302

chore(release): pull hotfix-release/v1.62.1 into main

chore(release): pull hotfix-release/v1.62.1 into main #302

name: Prepare for Staging Environment Deployment
on:
pull_request:
types:
- opened
- reopened
- synchronize
branches:
- main
jobs:
generate-tag-names:
runs-on: ubuntu-latest
name: Generate Tag Names
# Only pull requests from release candidate branches must trigger
if: (startsWith(github.event.pull_request.head.ref, 'release/') || startsWith(github.event.pull_request.head.ref, 'hotfix-release/'))
outputs:
tag_name: ${{ steps.gen_tag_names.outputs.tag_name }}
tag_name_ut: ${{ steps.gen_tag_names.outputs.tag_name_ut }}
steps:
- name: Checkout
uses: actions/[email protected]
with:
fetch-depth: 1
- name: Generate Tag Names
id: gen_tag_names
run: |
tag_name="staging-$(jq -r .version package.json)"
echo "Tag Name: $tag_name"
echo "tag_name=$tag_name" >> $GITHUB_OUTPUT
tag_name_ut="ut-$tag_name"
echo "UT Tag Name: $tag_name_ut"
echo "tag_name_ut=$tag_name_ut" >> $GITHUB_OUTPUT
build-transformer-image:
name: Build Transformer Docker Image - Staging
# Only pull requests from release candidate branches must trigger
if: (startsWith(github.event.pull_request.head.ref, 'release/') || startsWith(github.event.pull_request.head.ref, 'hotfix-release/'))
needs: [generate-tag-names]
uses: ./.github/workflows/build-push-docker-image.yml
with:
build_tag: rudderstack/rudder-transformer:${{ needs.generate-tag-names.outputs.tag_name }}
push_tags: rudderstack/rudder-transformer:${{ needs.generate-tag-names.outputs.tag_name }}
img_tag: ${{ needs.generate-tag-names.outputs.tag_name }}
dockerfile: Dockerfile
load_target: development
push_target: production
secrets:
DOCKERHUB_PROD_TOKEN: ${{ secrets.DOCKERHUB_PROD_TOKEN }}
build-user-transformer-image:
name: Build User Transformer Docker Image - Staging
# Only pull requests from release candidate branches must trigger
if: (startsWith(github.event.pull_request.head.ref, 'release/') || startsWith(github.event.pull_request.head.ref, 'hotfix-release/'))
needs: [generate-tag-names]
uses: ./.github/workflows/build-push-docker-image.yml
with:
build_tag: rudderstack/rudder-transformer:${{ needs.generate-tag-names.outputs.tag_name_ut }}
push_tags: rudderstack/rudder-transformer:${{ needs.generate-tag-names.outputs.tag_name_ut }}
img_tag: ${{ needs.generate-tag-names.outputs.tag_name_ut }}
dockerfile: Dockerfile-ut-func
load_target: development
push_target: production
secrets:
DOCKERHUB_PROD_TOKEN: ${{ secrets.DOCKERHUB_PROD_TOKEN }}
create-pull-request:
name: Update Helm Charts For Staging and Create Pull Request
runs-on: ubuntu-latest
needs: [generate-tag-names, build-transformer-image, build-user-transformer-image]
env:
TAG_NAME: ${{ needs.generate-tag-names.outputs.tag_name }}
UT_TAG_NAME: ${{ needs.generate-tag-names.outputs.tag_name_ut }}
steps:
- name: Checkout
uses: actions/[email protected]
with:
fetch-depth: 1
# In order to make a commit, we need to initialize a user.
# You may choose to write something less generic here if you want, it doesn't matter functionality wise.
- name: Initialize Mandatory Git Config
run: |
git config --global user.name "GitHub Actions"
git config --global user.email "[email protected]"
- name: Print Docker Image Tags
run: |
echo "Transformer: $TAG_NAME"
echo "User Transformer: $UT_TAG_NAME"
- name: Update Helm Charts and Raise Pull Request
env:
GITHUB_TOKEN: ${{ secrets.PAT }}
run: |
git clone https://${{secrets.PAT}}@github.com/rudderlabs/rudder-devops.git
cd rudder-devops
BRANCH_NAME="shared-transformer-$TAG_NAME"
echo $BRANCH_NAME
if [ -n "$(git ls-remote --heads origin $BRANCH_NAME 2>/dev/null)" ]
then
echo "Staging deployment branch already exists!"
else
git checkout -b $BRANCH_NAME
cd helm-charts/shared-services/per-az/environment/staging
yq eval -i ".rudder-transformer.image.tag=\"$TAG_NAME\"" staging.yaml
yq eval -i ".user-transformer.image.tag=\"$TAG_NAME\"" staging.yaml
git add staging.yaml
cd ../../../../config-be-rudder-transformer/environment/staging
yq eval -i ".config-be-rudder-transformer.image.tag=\"$TAG_NAME\"" base.yaml
yq eval -i ".config-be-user-transformer.image.tag=\"$TAG_NAME\"" base.yaml
git add base.yaml
git commit -m "chore: upgrade staging env transformers to \"$TAG_NAME\""
git push -u origin $BRANCH_NAME
gh pr create --fill
fi