From 1e0ac8913c2fba275f7cf10c08b4e81c64f04595 Mon Sep 17 00:00:00 2001 From: Zach Goldberg Date: Tue, 9 Jul 2024 07:39:17 -0700 Subject: [PATCH 1/4] feat: new test workflow --- .../pipelines-provision-account-test.yml | 92 +++++++++++++++++++ 1 file changed, 92 insertions(+) create mode 100644 .github/workflows/pipelines-provision-account-test.yml diff --git a/.github/workflows/pipelines-provision-account-test.yml b/.github/workflows/pipelines-provision-account-test.yml new file mode 100644 index 00000000..b380dfa9 --- /dev/null +++ b/.github/workflows/pipelines-provision-account-test.yml @@ -0,0 +1,92 @@ +name: Pipelines Execute +run-name: Run Gruntwork Pipelines +on: + workflow_call: + inputs: + runner: + type: string + default: "\"ubuntu-latest\"" + secrets: + PIPELINES_READ_TOKEN: + required: true + INFRA_ROOT_WRITE_TOKEN: + required: true + OPSGENIE_API_KEY: + required: true + +env: + PIPELINES_CLI_VERSION: v0.15.1 + PIPELINES_ACTIONS_VERSION: main + BOILERPLATE_VERSION: v0.5.16 + GRUNTWORK_INSTALLER_VERSION: v0.0.40 + +jobs: + pipelines_determine: + name: Test Provision Account + runs-on: ${{ fromJSON(inputs.runner) }} + steps: + - name: Checkout Pipelines Actions + uses: actions/checkout@v4 + with: + path: pipelines-actions + repository: Informa-Unity/pipelines-actions + ref: ${{ env.PIPELINES_ACTIONS_VERSION }} + token: ${{ secrets.PIPELINES_READ_TOKEN }} + + - name: Checkout Customized Pipelines Actions + uses: actions/checkout@v4 + with: + path: pipelines-actions-customizations + repository: Informa-Unity/pipelines-actions-customizations + ref: main + token: ${{ secrets.PIPELINES_READ_TOKEN }} + + - name: Check out repo code + uses: actions/checkout@v4 + with: + path: infra-live-repo + fetch-depth: 0 + + - name: Bootstrap Workflow + id: gruntwork_context + uses: ./pipelines-actions/.github/actions/pipelines-bootstrap + with: + token: ${{ secrets.PIPELINES_READ_TOKEN }} + change_type: AccountRequested + branch: "main" + working_directory: "." + account_id: "123456" + terragrunt_command: apply + additional_data: "" + child_account_id: "" + account_names: "" + new_account_name: "test-account" + + # To learn more about customizing Pipelines see our documentation at https://docs.gruntwork.io/pipelines/maintain/extending/ + - name: "[Baseline]: Pre Provision New Account Custom Action" + uses: ./pipelines-actions/.github/custom-actions/pre-provision-new-account + if: ${{ steps.gruntwork_context.outputs.action == 'PROVISION_ACCOUNT' }} + with: + PIPELINES_READ_TOKEN: ${{ secrets.PIPELINES_READ_TOKEN }} + INFRA_ROOT_WRITE_TOKEN: ${{ secrets.INFRA_ROOT_WRITE_TOKEN }} + gruntwork_context: ${{ toJson(steps.gruntwork_context.outputs) }} + + - name: "[ProvisionAccount]: Provision New Account" + id: provision_new_account + if: ${{ steps.gruntwork_context.outputs.action == 'PROVISION_ACCOUNT' }} + uses: ./pipelines-actions/.github/actions/pipelines-provision-account-action + with: + PIPELINES_READ_TOKEN: ${{ secrets.PIPELINES_READ_TOKEN }} + INFRA_ROOT_WRITE_TOKEN: ${{ secrets.INFRA_ROOT_WRITE_TOKEN }} + gruntwork_context: ${{ toJson(steps.gruntwork_context.outputs) }} + disable_provision: true + + - name: "[Baseline]: Post Provision New Account Custom Action" + uses: ./pipelines-actions-customizations/.github/custom-actions/post-provision-new-account + if: ${{ steps.gruntwork_context.outputs.action == 'PROVISION_ACCOUNT' }} + with: + PIPELINES_READ_TOKEN: ${{ secrets.PIPELINES_READ_TOKEN }} + INFRA_ROOT_WRITE_TOKEN: ${{ secrets.INFRA_ROOT_WRITE_TOKEN }} + OPSGENIE_API_KEY: ${{ secrets.OPSGENIE_API_KEY }} + gruntwork_context: ${{ toJson(steps.gruntwork_context.outputs) }} + baseline_pull_request_url: ${{ steps.provision_new_account.outputs.pull_request_url }} From 075a2aeca8968828162df4a94bc9859e042cb893 Mon Sep 17 00:00:00 2001 From: Zach Goldberg Date: Tue, 9 Jul 2024 07:41:17 -0700 Subject: [PATCH 2/4] chore: better name --- ...-provision-account-test.yml => pipelines-baseline-pr-test.yml} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename .github/workflows/{pipelines-provision-account-test.yml => pipelines-baseline-pr-test.yml} (100%) diff --git a/.github/workflows/pipelines-provision-account-test.yml b/.github/workflows/pipelines-baseline-pr-test.yml similarity index 100% rename from .github/workflows/pipelines-provision-account-test.yml rename to .github/workflows/pipelines-baseline-pr-test.yml From 4e2302c984e13030fb37e40715637f733add05d2 Mon Sep 17 00:00:00 2001 From: Zach Goldberg Date: Tue, 9 Jul 2024 07:48:22 -0700 Subject: [PATCH 3/4] tweaks for new test --- .github/workflows/pipelines-baseline-pr-test.yml | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/.github/workflows/pipelines-baseline-pr-test.yml b/.github/workflows/pipelines-baseline-pr-test.yml index b380dfa9..6bedb347 100644 --- a/.github/workflows/pipelines-baseline-pr-test.yml +++ b/.github/workflows/pipelines-baseline-pr-test.yml @@ -6,6 +6,9 @@ on: runner: type: string default: "\"ubuntu-latest\"" + account_name: + type: string + required: true secrets: PIPELINES_READ_TOKEN: required: true @@ -52,7 +55,7 @@ jobs: uses: ./pipelines-actions/.github/actions/pipelines-bootstrap with: token: ${{ secrets.PIPELINES_READ_TOKEN }} - change_type: AccountRequested + change_type: AccountsRequested branch: "main" working_directory: "." account_id: "123456" @@ -60,7 +63,7 @@ jobs: additional_data: "" child_account_id: "" account_names: "" - new_account_name: "test-account" + new_account_name: ${{ inputs.account_name }} # To learn more about customizing Pipelines see our documentation at https://docs.gruntwork.io/pipelines/maintain/extending/ - name: "[Baseline]: Pre Provision New Account Custom Action" From 11ebdfd407fecc5017bb9ea5ab524d1fe89313df Mon Sep 17 00:00:00 2001 From: Zach Goldberg Date: Tue, 9 Jul 2024 07:51:46 -0700 Subject: [PATCH 4/4] another account name --- .github/workflows/pipelines-baseline-pr-test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pipelines-baseline-pr-test.yml b/.github/workflows/pipelines-baseline-pr-test.yml index 6bedb347..67034e71 100644 --- a/.github/workflows/pipelines-baseline-pr-test.yml +++ b/.github/workflows/pipelines-baseline-pr-test.yml @@ -62,7 +62,7 @@ jobs: terragrunt_command: apply additional_data: "" child_account_id: "" - account_names: "" + account_names: ${{ inputs.account_name }} new_account_name: ${{ inputs.account_name }} # To learn more about customizing Pipelines see our documentation at https://docs.gruntwork.io/pipelines/maintain/extending/