-
Notifications
You must be signed in to change notification settings - Fork 1.1k
feat: Add spanner custom release via Github actions #3868
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
sm745052
wants to merge
14
commits into
main
Choose a base branch
from
targeted-release
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+186
−0
Open
Changes from 10 commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
2ab4bcc
initial
sm745052 8d10b80
add push trigger and fallbacks for testing
sm745052 22fa4b8
explicitly skip unit and integration tests in maven build
sm745052 d864cb2
re-add push trigger to allow direct testing on branch
sm745052 36bd318
change default project, bucket, and runner to staging values
sm745052 5a9265b
update fallback values in script to match staging defaults
sm745052 2ae7454
add temporary diagnostic step to list artifact registry repos
sm745052 6a1b938
revert
sm745052 a04e1c7
add its
sm745052 30e075b
minor
sm745052 acf16f6
required var
sm745052 189904b
disable temporarily
sm745052 cd848da
debug
sm745052 7353d9a
revert debug and default false
sm745052 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,186 @@ | ||
| # Copyright 2026 Google LLC | ||
| # | ||
| # Licensed under the Apache License, Version 2.0 (the "License"); | ||
| # you may not use this file except in compliance with the License. | ||
| # You may obtain a copy of the License at | ||
| # | ||
| # https://www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # Unless required by applicable law or agreed to in writing, software | ||
| # distributed under the License is distributed on an "AS IS" BASIS, | ||
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| # See the License for the specific language governing permissions and | ||
| # limitations under the License. | ||
|
|
||
| name: Spanner Targeted Release | ||
|
|
||
| on: | ||
| push: | ||
| branches: | ||
| - targeted-release | ||
| workflow_dispatch: | ||
| inputs: | ||
| projectId: | ||
| description: 'Target GCP Project ID' | ||
| type: string | ||
| required: true | ||
| default: 'span-cloud-migrations-staging' | ||
| bucketName: | ||
| description: 'Target GCS Bucket Name' | ||
| type: string | ||
| required: true | ||
| default: 'spanner-migrations-staging' | ||
| stagePrefix: | ||
| description: 'Prefix for staging the template (e.g., templates-2025-10-31). If blank, defaults to templates-YYYY-MM-DD using current date.' | ||
| type: string | ||
| required: false | ||
| default: '' | ||
| templateName: | ||
| description: 'Template Name to build and stage' | ||
| type: string | ||
| required: true | ||
| default: 'Spanner_to_SourceDb' | ||
| modulePath: | ||
| description: 'Maven module directory of the template to build' | ||
| type: string | ||
| required: true | ||
| default: 'v2/spanner-to-sourcedb' | ||
| runnerLabels: | ||
| description: 'Runner labels formatted as a JSON array' | ||
| type: string | ||
| required: true | ||
| default: '["self-hosted", "spanner-release"]' | ||
| runIntegrationTests: | ||
| description: 'Run Spanner integration tests before staging templates' | ||
| type: boolean | ||
| required: true | ||
| default: true | ||
| specific_test: | ||
| description: 'Specific Integration Test (passed to -Dtest=)' | ||
| type: string | ||
| required: false | ||
| default: '' | ||
|
|
||
| env: | ||
| MAVEN_OPTS: >- | ||
| -Dorg.slf4j.simpleLogger.log.org.apache.maven.plugins.shade=error | ||
| --add-opens java.base/java.nio=ALL-UNNAMED | ||
| --add-opens java.base/sun.nio.ch=ALL-UNNAMED | ||
| --add-opens java.base/java.lang=ALL-UNNAMED | ||
| --add-opens java.base/java.util=ALL-UNNAMED | ||
|
|
||
| permissions: | ||
| contents: read | ||
|
|
||
| jobs: | ||
| targeted_release: | ||
| name: Targeted Template Release | ||
| runs-on: ${{ fromJSON(github.event.inputs.runnerLabels || '["self-hosted", "spanner-release"]') }} | ||
| steps: | ||
| - name: Checkout Code | ||
| uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | ||
|
|
||
| - name: Setup Environment | ||
| id: setup-env | ||
| uses: ./.github/actions/setup-env | ||
|
|
||
| - name: Resolve Variables | ||
| id: resolve-vars | ||
| run: | | ||
| PROJECT_ID="${{ github.event.inputs.projectId }}" | ||
| PROJECT_ID="${PROJECT_ID:-span-cloud-migrations-staging}" | ||
|
|
||
| BUCKET_NAME="${{ github.event.inputs.bucketName }}" | ||
| BUCKET_NAME="${BUCKET_NAME:-spanner-migrations-staging}" | ||
|
|
||
| TEMPLATE_NAME="${{ github.event.inputs.templateName }}" | ||
| TEMPLATE_NAME="${TEMPLATE_NAME:-Spanner_to_SourceDb}" | ||
|
|
||
| MODULE_PATH="${{ github.event.inputs.modulePath }}" | ||
| MODULE_PATH="${MODULE_PATH:-v2/spanner-to-sourcedb}" | ||
|
|
||
| STAGE_PREFIX="${{ github.event.inputs.stagePrefix }}" | ||
| if [ -z "$STAGE_PREFIX" ]; then | ||
| STAGE_PREFIX="templates-$(date +'%Y-%m-%d')" | ||
| fi | ||
|
|
||
| RUN_INTEGRATION_TESTS="${{ github.event.inputs.runIntegrationTests }}" | ||
| RUN_INTEGRATION_TESTS="${RUN_INTEGRATION_TESTS:-true}" | ||
|
|
||
| SPECIFIC_TEST="${{ github.event.inputs.specific_test }}" | ||
| SPECIFIC_TEST="${SPECIFIC_TEST:-}" | ||
|
|
||
| echo "Resolved Variables:" | ||
| echo "-------------------" | ||
| echo "Project ID: $PROJECT_ID" | ||
| echo "Bucket Name: $BUCKET_NAME" | ||
| echo "Template Name: $TEMPLATE_NAME" | ||
| echo "Module Path: $MODULE_PATH" | ||
| echo "Stage Prefix: $STAGE_PREFIX" | ||
| echo "Run IT Tests: $RUN_INTEGRATION_TESTS" | ||
| echo "Specific Test: $SPECIFIC_TEST" | ||
| echo "-------------------" | ||
|
|
||
| echo "projectId=$PROJECT_ID" >> $GITHUB_OUTPUT | ||
| echo "bucketName=$BUCKET_NAME" >> $GITHUB_OUTPUT | ||
| echo "templateName=$TEMPLATE_NAME" >> $GITHUB_OUTPUT | ||
| echo "modulePath=$MODULE_PATH" >> $GITHUB_OUTPUT | ||
| echo "stagePrefix=$STAGE_PREFIX" >> $GITHUB_OUTPUT | ||
| echo "runIntegrationTests=$RUN_INTEGRATION_TESTS" >> $GITHUB_OUTPUT | ||
| echo "specificTest=$SPECIFIC_TEST" >> $GITHUB_OUTPUT | ||
| shell: bash | ||
|
|
||
| - name: Run Integration Tests | ||
| if: ${{ steps.resolve-vars.outputs.runIntegrationTests == 'true' }} | ||
| run: | | ||
| echo "Starting Spanner Integration Tests..." | ||
| ./cicd/run-it-tests \ | ||
| --modules-to-build="SPANNER" \ | ||
| --it-region="us-central1" \ | ||
| --it-project="span-cloud-teleport-testing" \ | ||
| --it-artifact-bucket="span-cloud-teleport-testing-it-gitactions" \ | ||
| --it-private-connectivity="datastream-connect-2" \ | ||
| --it-cloud-proxy-host="10.128.0.16" \ | ||
| --test="${{ steps.resolve-vars.outputs.specificTest }}" | ||
|
|
||
| - name: Upload Integration Tests Report | ||
| if: always() && (steps.resolve-vars.outputs.runIntegrationTests == 'true') | ||
| uses: actions/upload-artifact@v7 | ||
| with: | ||
| name: surefire-integration-test-results | ||
| path: | | ||
| **/surefire-reports/TEST-*.xml | ||
| **/surefire-reports/*.html | ||
| **/surefire-reports/html/** | ||
| retention-days: 10 | ||
|
|
||
| - name: Integration Test report on GitHub | ||
| if: always() && (steps.resolve-vars.outputs.runIntegrationTests == 'true') | ||
| uses: dorny/test-reporter@v3 | ||
| with: | ||
| name: Integration Test report on GitHub | ||
| path: '**/surefire-reports/TEST-*.xml' | ||
| reporter: java-junit | ||
| only-summary: 'true' | ||
| token: ${{ secrets.GITHUB_TOKEN }} | ||
| fail-on-error: 'false' | ||
| list-suites: 'failed' | ||
| list-tests: 'failed' | ||
|
|
||
| - name: Build & Stage Template | ||
| run: | | ||
| echo "Starting Spanner Targeted Release staging..." | ||
|
|
||
| mvn clean package -PtemplatesStage \ | ||
| -DprojectId="${{ steps.resolve-vars.outputs.projectId }}" \ | ||
| -DbucketName="${{ steps.resolve-vars.outputs.bucketName }}" \ | ||
| -DstagePrefix="${{ steps.resolve-vars.outputs.stagePrefix }}" \ | ||
| -DtemplateName="${{ steps.resolve-vars.outputs.templateName }}" \ | ||
| -Dmaven.test.skip \ | ||
| -DskipIntegrationTests \ | ||
| -pl ${{ steps.resolve-vars.outputs.modulePath }} -am | ||
| shell: bash | ||
|
|
||
| - name: Cleanup Java Environment | ||
| uses: ./.github/actions/cleanup-java-env | ||
| if: always() | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.