From 720a1a8ba5436f62f349e596e7941720a2fa7804 Mon Sep 17 00:00:00 2001 From: Mikhail Shilkov Date: Fri, 20 Dec 2024 16:10:51 +0100 Subject: [PATCH] AWS Native: Add AWS credentials before Test Provider Library step (#1239) In https://github.com/pulumi/pulumi-aws-native/pull/1919 I want to run an actual end-2-end test with `pulumitest` in AWS Native, which requires AWS credentials. In understand that a larger consolidation may be coming with https://github.com/pulumi/ci-mgmt/issues/1101, but this change would allow me to land my test ahead of that. Please let me know if there is a better way of achieving the same outcome. --- .../aws-native/repo/.github/workflows/build.yml | 9 +++++++++ .../aws-native/repo/.github/workflows/prerelease.yml | 9 +++++++++ .../aws-native/repo/.github/workflows/release.yml | 9 +++++++++ .../repo/.github/workflows/run-acceptance-tests.yml | 9 +++++++++ native-provider-ci/src/workflows.ts | 1 + 5 files changed, 37 insertions(+) diff --git a/native-provider-ci/providers/aws-native/repo/.github/workflows/build.yml b/native-provider-ci/providers/aws-native/repo/.github/workflows/build.yml index 1e0790e21..140939bc5 100644 --- a/native-provider-ci/providers/aws-native/repo/.github/workflows/build.yml +++ b/native-provider-ci/providers/aws-native/repo/.github/workflows/build.yml @@ -126,6 +126,15 @@ jobs: with: name: pulumi-${{ env.PROVIDER }}-provider.tar.gz path: ${{ github.workspace }}/bin/provider.tar.gz + - name: Configure AWS Credentials + uses: aws-actions/configure-aws-credentials@e3dd6a429d7300a6a4c196c26e071d42e0343502 # v4.0.2 + with: + aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} + aws-region: ${{ env.AWS_REGION }} + aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} + role-duration-seconds: 3600 + role-session-name: ${{ env.PROVIDER }}@githubActions + role-to-assume: ${{ secrets.AWS_CI_ROLE_ARN }} - name: Test Provider Library run: make test_provider - name: Upload coverage reports to Codecov diff --git a/native-provider-ci/providers/aws-native/repo/.github/workflows/prerelease.yml b/native-provider-ci/providers/aws-native/repo/.github/workflows/prerelease.yml index 865c71c18..f36f56d8a 100644 --- a/native-provider-ci/providers/aws-native/repo/.github/workflows/prerelease.yml +++ b/native-provider-ci/providers/aws-native/repo/.github/workflows/prerelease.yml @@ -118,6 +118,15 @@ jobs: with: name: pulumi-${{ env.PROVIDER }}-provider.tar.gz path: ${{ github.workspace }}/bin/provider.tar.gz + - name: Configure AWS Credentials + uses: aws-actions/configure-aws-credentials@e3dd6a429d7300a6a4c196c26e071d42e0343502 # v4.0.2 + with: + aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} + aws-region: ${{ env.AWS_REGION }} + aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} + role-duration-seconds: 3600 + role-session-name: ${{ env.PROVIDER }}@githubActions + role-to-assume: ${{ secrets.AWS_CI_ROLE_ARN }} - name: Test Provider Library run: make test_provider - name: Upload coverage reports to Codecov diff --git a/native-provider-ci/providers/aws-native/repo/.github/workflows/release.yml b/native-provider-ci/providers/aws-native/repo/.github/workflows/release.yml index 4b020768d..cf5b99804 100644 --- a/native-provider-ci/providers/aws-native/repo/.github/workflows/release.yml +++ b/native-provider-ci/providers/aws-native/repo/.github/workflows/release.yml @@ -118,6 +118,15 @@ jobs: with: name: pulumi-${{ env.PROVIDER }}-provider.tar.gz path: ${{ github.workspace }}/bin/provider.tar.gz + - name: Configure AWS Credentials + uses: aws-actions/configure-aws-credentials@e3dd6a429d7300a6a4c196c26e071d42e0343502 # v4.0.2 + with: + aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} + aws-region: ${{ env.AWS_REGION }} + aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} + role-duration-seconds: 3600 + role-session-name: ${{ env.PROVIDER }}@githubActions + role-to-assume: ${{ secrets.AWS_CI_ROLE_ARN }} - name: Test Provider Library run: make test_provider - name: Upload coverage reports to Codecov diff --git a/native-provider-ci/providers/aws-native/repo/.github/workflows/run-acceptance-tests.yml b/native-provider-ci/providers/aws-native/repo/.github/workflows/run-acceptance-tests.yml index dcc075f82..d132ed82b 100644 --- a/native-provider-ci/providers/aws-native/repo/.github/workflows/run-acceptance-tests.yml +++ b/native-provider-ci/providers/aws-native/repo/.github/workflows/run-acceptance-tests.yml @@ -140,6 +140,15 @@ jobs: with: name: pulumi-${{ env.PROVIDER }}-provider.tar.gz path: ${{ github.workspace }}/bin/provider.tar.gz + - name: Configure AWS Credentials + uses: aws-actions/configure-aws-credentials@e3dd6a429d7300a6a4c196c26e071d42e0343502 # v4.0.2 + with: + aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} + aws-region: ${{ env.AWS_REGION }} + aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} + role-duration-seconds: 3600 + role-session-name: ${{ env.PROVIDER }}@githubActions + role-to-assume: ${{ secrets.AWS_CI_ROLE_ARN }} - name: Test Provider Library run: make test_provider - name: Upload coverage reports to Codecov diff --git a/native-provider-ci/src/workflows.ts b/native-provider-ci/src/workflows.ts index 493932238..624399a95 100644 --- a/native-provider-ci/src/workflows.ts +++ b/native-provider-ci/src/workflows.ts @@ -520,6 +520,7 @@ export class PrerequisitesJob implements NormalJob { steps.Porcelain(), steps.TarProviderBinaries(opts.hasGenBinary), steps.UploadProviderBinaries(), + steps.ConfigureAwsCredentialsForTests(opts.provider == "aws-native"), steps.TestProviderLibrary(), steps.Codecov(), steps.NotifySlack("Failure in building provider prerequisites"),