Skip to content

Release

Release #333

Workflow file for this run

name: Release
on:
workflow_dispatch:
inputs:
candidateName:
description: 'Name of the candidate'
type: string
required: true
branchCommit:
description: 'Commit to check out. If it is the most recent commit then leave blank.'
type: string
required: false
default: ''
cherrypickCommits:
description: 'Comma separated commits to cherry pick'
type: string
required: false
permissions:
contents: write
jobs:
release:
name: Create Release
runs-on: [self-hosted, release]
env:
IT_REGION: us-west2
steps:
- name: Get releaser identity
run: |
git config --global user.name '${{github.actor}}'
git config --global user.email '${{github.actor}}@users.noreply.github.com'
- name: Declare release branch name and tag name
id: variables
run: |
echo "releaseBranchName=release_${CANDIDATE_NAME}" >> $GITHUB_OUTPUT
echo "tagName=${CANDIDATE_NAME^^}" >> $GITHUB_OUTPUT
env:
CANDIDATE_NAME: ${{ inputs.candidateName }}
- name: Checkout code
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
with:
fetch-depth: 0
token: ${{ secrets.GITHUB_TOKEN }}
- name: Create release branch
run: git checkout -b $RELEASE_BRANCH_NAME $BRANCH_COMMIT
env:
RELEASE_BRANCH_NAME: ${{ steps.variables.outputs.releaseBranchName }}
BRANCH_COMMIT: ${{ inputs.branchCommit }}
- name: Cherry pick commits
run: |
commits=$(echo $CHERRYPICK_COMMITS | tr "," "\n")
for commit in $commits
do
echo "Cherry picking $commit."
git cherry-pick $commit
done
env:
CHERRYPICK_COMMITS: ${{ inputs.cherrypickCommits }}
- name: Add tag to most recent commit
run: |
DATE=$(date -d"next-monday - 1week" +'%Y-%m-%d')
T_COMMIT=$(git log -n 1 $RELEASE_BRANCH_NAME --pretty=format:'%H')
git tag -a $TAG_NAME -m "Release week of $DATE" $T_COMMIT
env:
RELEASE_BRANCH_NAME: ${{ steps.variables.outputs.releaseBranchName }}
TAG_NAME: ${{ steps.variables.outputs.tagName }}
- name: Push release branch
run: |
git push origin --delete $RELEASE_BRANCH_NAME || true
git push -u origin $RELEASE_BRANCH_NAME
env:
RELEASE_BRANCH_NAME: ${{ steps.variables.outputs.releaseBranchName }}
- name: Setup Environment
id: setup-env
uses: ./.github/actions/setup-env
- name: Run Build
run: ./cicd/run-build
- name: Run Unit Tests
run: ./cicd/run-unit-tests
- name: Cleanup Resources
run: ./test-infra/cleanup_resources.sh
# TODO(https://github.com/GoogleCloudPlatform/DataflowTemplates/issues/1807) - Remove once Staging Spanner tests
# are fixed
- name: Run Integration Smoke Tests
run: |
./cicd/run-it-smoke-tests \
--it-region="${{ env.IT_REGION }}" \
--it-project="cloud-teleport-testing" \
--it-artifact-bucket="cloud-teleport-testing-it-gitactions" \
--it-private-connectivity="datastream-connect-2" \
--it-spanner-host="https://batch-spanner.googleapis.com" \
--it-release=true \
--it-retry-failures=2
- name: Run Integration Tests With DEFAULT
run: |
./cicd/run-it-tests \
--it-region="${{ env.IT_REGION }}" \
--it-project="cloud-teleport-testing" \
--it-artifact-bucket="cloud-teleport-testing-it-gitactions" \
--it-private-connectivity="datastream-connect-2" \
--it-spanner-host="https://batch-spanner.googleapis.com" \
--it-release=true \
--it-retry-failures=2 \
--it-integration-test-parallelism=6 \
--it-thread-count=6 \
--modules-to-build="DEFAULT"
- name: Run Integration Tests With KAFKA
run: |
./cicd/run-it-tests \
--it-region="${{ env.IT_REGION }}" \
--it-project="cloud-teleport-testing" \
--it-artifact-bucket="cloud-teleport-testing-it-gitactions" \
--it-private-connectivity="datastream-connect-2" \
--it-spanner-host="https://batch-spanner.googleapis.com" \
--it-release=true \
--it-retry-failures=2 \
--it-integration-test-parallelism=6 \
--modules-to-build="KAFKA"
- name: Run Integration Tests With BIGTABLE
run: |
./cicd/run-it-tests \
--it-region="${{ env.IT_REGION }}" \
--it-project="cloud-teleport-testing" \
--it-artifact-bucket="cloud-teleport-testing-it-gitactions" \
--it-private-connectivity="datastream-connect-2" \
--it-spanner-host="https://batch-spanner.googleapis.com" \
--it-release=true \
--it-retry-failures=2 \
--it-integration-test-parallelism=6 \
--modules-to-build="BIGTABLE"
- name: Upload Site Report
uses: ./.github/actions/publish-site-report
with:
output-zip-file: test-report
if: always()
release-it-datastream:
name: Create Release - IT Datastream
needs: [release]
runs-on: [self-hosted, release]
steps:
- name: Get releaser identity
run: |
git config --global user.name '${{github.actor}}'
git config --global user.email '${{github.actor}}@users.noreply.github.com'
- name: Declare release branch name and tag name
id: variables
run: |
echo "releaseBranchName=release_${CANDIDATE_NAME}" >> $GITHUB_OUTPUT
echo "tagName=${CANDIDATE_NAME^^}" >> $GITHUB_OUTPUT
env:
CANDIDATE_NAME: ${{ inputs.candidateName }}
- name: Checkout code
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
with:
ref: ${{ steps.variables.outputs.releaseBranchName }}
fetch-depth: 0
token: ${{ secrets.GITHUB_TOKEN }}
- name: Setup Environment
id: setup-env
uses: ./.github/actions/setup-env
- name: Run Integration Tests
run: |
./cicd/run-it-tests \
--it-region="us-central1" \
--it-project="cloud-teleport-testing" \
--it-artifact-bucket="cloud-teleport-testing-it-gitactions" \
--it-private-connectivity="datastream-connect-2" \
--it-spanner-host="https://batch-spanner.googleapis.com" \
--it-release=true \
--it-retry-failures=3 \
--modules-to-build="DATASTREAM"
- name: Upload Site Report
uses: ./.github/actions/publish-site-report
with:
output-zip-file: test-report-datastream
if: always()
release-it-spanner:
name: Create Release - IT Spanner
needs: [release-it-datastream]
runs-on: [self-hosted, release]
steps:
- name: Get releaser identity
run: |
git config --global user.name '${{github.actor}}'
git config --global user.email '${{github.actor}}@users.noreply.github.com'
- name: Declare release branch name and tag name
id: variables
run: |
echo "releaseBranchName=release_${CANDIDATE_NAME}" >> $GITHUB_OUTPUT
echo "tagName=${CANDIDATE_NAME^^}" >> $GITHUB_OUTPUT
env:
CANDIDATE_NAME: ${{ inputs.candidateName }}
- name: Checkout code
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
with:
ref: ${{ steps.variables.outputs.releaseBranchName }}
fetch-depth: 0
token: ${{ secrets.GITHUB_TOKEN }}
- name: Setup Environment
id: setup-env
uses: ./.github/actions/setup-env
- name: Run Integration Tests
run: |
./cicd/run-it-tests \
--it-region="us-central1" \
--it-project="cloud-teleport-testing" \
--it-artifact-bucket="cloud-teleport-testing-it-gitactions" \
--it-private-connectivity="datastream-connect-2" \
--it-spanner-host="https://batch-spanner.googleapis.com" \
--it-release=true \
--it-retry-failures=3 \
--modules-to-build="SPANNER"
- name: Upload Site Report
uses: ./.github/actions/publish-site-report
with:
output-zip-file: test-report-spanner
if: always()
finalize-release:
name: Finalize Release
needs: [release-it-spanner]
runs-on: [self-hosted, release]
steps:
- name: Get releaser identity
run: |
git config --global user.name '${{github.actor}}'
git config --global user.email '${{github.actor}}@users.noreply.github.com'
- name: Declare release branch name and tag name
id: variables
run: |
echo "releaseBranchName=release_${CANDIDATE_NAME}" >> $GITHUB_OUTPUT
echo "tagName=${CANDIDATE_NAME^^}" >> $GITHUB_OUTPUT
env:
CANDIDATE_NAME: ${{ inputs.candidateName }}
- name: Checkout code
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
with:
ref: ${{ steps.variables.outputs.releaseBranchName }}
fetch-depth: 0
token: ${{ secrets.GITHUB_TOKEN }}
- name: Push tags
run: |
git push -u origin --tags
- name: Release
run: |
gh release delete $TAG_NAME -y || true
gh release create $TAG_NAME --title "Dataflow Templates $TAG_NAME" --notes ""
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
TAG_NAME: ${{ steps.variables.outputs.tagName }}