Skip to content

Commit

Permalink
Update manual canary workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
ysaito1001 committed Mar 28, 2024
1 parent cd211ad commit 1eafdef
Show file tree
Hide file tree
Showing 2 changed files with 59 additions and 10 deletions.
55 changes: 45 additions & 10 deletions .github/workflows/manual-canary.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,11 @@ on:
type: string
run-name: ${{ github.workflow }} for Pull Request ${{ inputs.pull_request_number }}

# Allow one instance of this workflow per pull request, and cancel older runs when new changes are pushed
concurrency:
group: manual-canary-${{ inputs.pull_request_number }}
cancel-in-progress: true

jobs:
get-pr-info:
name: Get PR info
Expand Down Expand Up @@ -42,7 +47,7 @@ jobs:
- uses: actions/checkout@v4
with:
path: smithy-rs
# The ref used needs to match the HEAD revision of the PR being diffed, or else
# The ref used needs to match the HEAD revision of the PR being diffed, or else
# the `docker-build` action won't find the built Docker image.
ref: ${{ fromJSON(needs.get-pr-info.outputs.pull_data).commit_sha }}
fetch-depth: 0
Expand All @@ -56,15 +61,45 @@ jobs:
path: smithy-rs-base-image
retention-days: 1

invoke-canary:
generate:
name: Generate
needs:
- acquire-base-image
- get-pr-info
runs-on: smithy_ubuntu-latest_8-core
steps:
- uses: actions/checkout@v4
with:
path: smithy-rs
ref: ${{ fromJSON(needs.get-pr-info.outputs.pull_data).commit_sha }}
- name: Generate a subset of SDKs for the canary
uses: ./smithy-rs/.github/actions/docker-build
with:
action: generate-aws-sdk-for-canary

canary:
name: Canary
needs:
- generate
- get-pr-info
- acquire-base-image
uses: ./.github/workflows/canary.yml
with:
pull_request_number: ${{ inputs.pull_request_number }}
commit_sha: ${{ fromJSON(needs.get-pr-info.outputs.pull_data).commit_sha }}
secrets:
CANARY_GITHUB_ACTIONS_ROLE_ARN: ${{ secrets.CANARY_GITHUB_ACTIONS_ROLE_ARN }}
CANARY_STACK_CDK_OUTPUTS_BUCKET_NAME: ${{ secrets.CANARY_STACK_CDK_OUTPUTS_BUCKET_NAME }}
runs-on: smithy_ubuntu-latest_8-core
permissions:
id-token: write
contents: read
steps:
- uses: actions/checkout@v4
with:
path: smithy-rs
ref: ${{ fromJSON(needs.get-pr-info.outputs.pull_data).commit_sha }}
- name: Configure credentials
id: creds
uses: aws-actions/configure-aws-credentials@v4
with:
aws-region: us-west-2
role-to-assume: ${{ secrets.CANARY_GITHUB_ACTIONS_ROLE_ARN }}
output-credentials: true
- name: Run canary
uses: ./smithy-rs/.github/actions/docker-build
with:
action: run-canary
action-arguments: ${{ secrets.CANARY_STACK_CDK_OUTPUTS_BUCKET_NAME }} ${{ steps.creds.outputs.aws-access-key-id }} ${{ steps.creds.outputs.aws-secret-access-key }} ${{ steps.creds.outputs.aws-session-token }}
14 changes: 14 additions & 0 deletions tools/ci-scripts/generate-aws-sdk-for-canary
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/bin/bash
#
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
# SPDX-License-Identifier: Apache-2.0
#

set -eux

cd smithy-rs

# Generate only SDKs used by canary (see BASE_MANIFEST in build_bundle.rs of canary-runner)
./gradlew -Paws.services=+ec2,+s3,+sso,+ssooidc,+sts,+transcribestreaming :aws:sdk:assemble

mv aws/sdk/build/aws-sdk ../artifacts/

0 comments on commit 1eafdef

Please sign in to comment.