chore(release): pull hotfix-release/v1.82.2 into main (#3816) #149
This file contains 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
name: Prepare for DT Production Environment Deployment | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
types: | |
- closed | |
branches: | |
- main | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.head_ref || github.sha }} | |
cancel-in-progress: true | |
jobs: | |
report-coverage: | |
name: Report Code Coverage | |
if: github.event_name == 'push' | |
uses: ./.github/workflows/dt-test-and-report-code-coverage.yml | |
secrets: | |
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} | |
generate-tag-names: | |
runs-on: ubuntu-latest | |
name: Generate Tag Names | |
# Only merged 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/')) && github.event.pull_request.merged == true) | |
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=$(jq -r .version package.json) | |
echo "Tag Name: $tag_name" | |
echo "tag_name=$tag_name" >> $GITHUB_OUTPUT | |
build-transformer-image: | |
name: Build Transformer Docker Image - Prod | |
# Only merged 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/')) && github.event.pull_request.merged == true) | |
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 | |
build_type: dt | |
use_merge_sha: true | |
skip_tests: ${{startsWith(github.event.pull_request.head.ref, 'hotfix-release/')}} | |
secrets: | |
DOCKERHUB_PROD_TOKEN: ${{ secrets.DOCKERHUB_PROD_TOKEN }} | |
create-pull-request: | |
name: Update Helm Charts For Production and Create Pull Request | |
runs-on: ubuntu-latest | |
needs: [generate-tag-names, build-transformer-image] | |
env: | |
TAG_NAME: ${{ needs.generate-tag-names.outputs.tag_name }} | |
TF_IMAGE_REPOSITORY: rudderstack/rudder-transformer | |
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" | |
- name: Clone Devops Repo | |
run: | | |
git clone https://${{secrets.PAT}}@github.com/rudderlabs/rudder-devops.git | |
- name: Extract branch name | |
id: extract_branch_name | |
run: | | |
cd rudder-devops | |
branch_name=$(git rev-parse --abbrev-ref HEAD) | |
echo "branch_name=$branch_name" | |
echo "branch_name=$branch_name" >> $GITHUB_OUTPUT | |
- name: Update Helm Charts and Raise Pull Request | |
env: | |
GITHUB_TOKEN: ${{ secrets.PAT }} | |
run: | | |
cd rudder-devops | |
git checkout -b shared-transformer-$TAG_NAME | |
cd helm-charts/shared-services/per-az/environment/production | |
yq eval -i ".rudder-transformer.image.tag=\"$TAG_NAME\"" production.yaml | |
yq eval -i ".user-transformer.image.tag=\"$TAG_NAME\"" production.yaml | |
yq eval -i ".rudder-transformer.image.repository=\"$TF_IMAGE_REPOSITORY\"" production.yaml | |
yq eval -i ".user-transformer.image.repository=\"$TF_IMAGE_REPOSITORY\"" production.yaml | |
git add production.yaml | |
yq eval -i ".rudder-transformer.image.tag=\"$TAG_NAME\"" enterprise/enterprise.yaml | |
yq eval -i ".user-transformer.image.tag=\"$TAG_NAME\"" enterprise/enterprise.yaml | |
yq eval -i ".rudder-transformer.image.repository=\"$TF_IMAGE_REPOSITORY\"" enterprise/enterprise.yaml | |
yq eval -i ".user-transformer.image.repository=\"$TF_IMAGE_REPOSITORY\"" enterprise/enterprise.yaml | |
git add enterprise/enterprise.yaml | |
yq eval -i ".rudder-transformer.image.tag=\"$TAG_NAME\"" multi-tenant/multi-tenant.yaml | |
yq eval -i ".user-transformer.image.tag=\"$TAG_NAME\"" multi-tenant/multi-tenant.yaml | |
yq eval -i ".rudder-transformer.image.repository=\"$TF_IMAGE_REPOSITORY\"" multi-tenant/multi-tenant.yaml | |
yq eval -i ".user-transformer.image.repository=\"$TF_IMAGE_REPOSITORY\"" multi-tenant/multi-tenant.yaml | |
git add multi-tenant/multi-tenant.yaml | |
cd ../../../../config-be-rudder-transformer/environment/prod | |
yq eval -i ".config-be-rudder-transformer.image.tag=\"$TAG_NAME\"" base.yaml | |
git add base.yaml | |
git commit -m "chore: upgrade shared transformers to $TAG_NAME" | |
git push -u origin shared-transformer-$TAG_NAME | |
gh pr create --fill | |
- name: Update Helm Chart and Raise Pull Request For Hosted Transformer | |
env: | |
GITHUB_TOKEN: ${{ secrets.PAT }} | |
run: | | |
cd rudder-devops | |
git checkout -b hosted-transformer-$TAG_NAME ${{steps.extract_branch_name.outputs.branch_name}} | |
cd customer-objects/multi-tenant-us | |
yq eval -i ".spec.transformer.image.version=\"$TAG_NAME\"" hostedmtedmt.yaml | |
yq eval -i ".spec.transformer.image.repository=\"$TF_IMAGE_REPOSITORY\"" hostedmtedmt.yaml | |
git add hostedmtedmt.yaml | |
git commit -m "chore: upgrade hosted transformer to $TAG_NAME" | |
git push -u origin hosted-transformer-$TAG_NAME | |
gh pr create --fill | |
- name: Update helm charts and raise pull request for enterprise customers on dedicated transformers | |
env: | |
GITHUB_TOKEN: ${{ secrets.PAT }} | |
run: | | |
cd rudder-devops | |
git checkout -b dedicated-transformer-$TAG_NAME | |
cd customer-objects | |
declare -a enabled_ut_customers=() | |
declare -a sub_directories=('enterprise-us' 'enterprise-eu') | |
# identify the customers enabled in sub-directories | |
for directory in "${sub_directories[@]}"; do | |
for f in "./$directory"/*; do | |
[[ -f $f ]] || continue | |
enabled="$(yq e '.spec.user_transformer.enabled' $f)" | |
if [ $enabled == "true" ]; then | |
enabled_ut_customers+=( $f ) | |
fi | |
done | |
done | |
# bump up the customers version and repository information | |
for customer in "${enabled_ut_customers[@]}"; do | |
yq eval -i ".spec.user_transformer.image.version=\"$TAG_NAME\"" $customer | |
yq eval -i ".spec.user_transformer.image.repository=\"$TF_IMAGE_REPOSITORY\"" $customer | |
git add $customer | |
done | |
git commit -m "chore: upgrade dedicated transformers to $TAG_NAME" | |
git push -u origin dedicated-transformer-$TAG_NAME | |
gh pr create --fill |