Skip to content

Commit fbb3de2

Browse files
milldrgithub-actions[bot]
authored andcommitted
(github actions) generated latest snippets
1 parent b684b47 commit fbb3de2

27 files changed

+933
-627
lines changed
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
name: 👽 Atmos Pro Terraform Apply
2+
run-name: apply ${{ inputs.component }}/${{ inputs.stack }}/${{ inputs.atmos_pro_run_id}}
3+
4+
on:
5+
workflow_dispatch:
6+
inputs:
7+
atmos_pro_run_id:
8+
description: "Atmos Pro Run ID"
9+
type: string
10+
sha:
11+
description: "Commit SHA"
12+
type: string
13+
component:
14+
description: "Component"
15+
required: true
16+
type: string
17+
stack:
18+
description: "Stack"
19+
required: true
20+
type: string
21+
github_environment:
22+
description: "GitHub Environment"
23+
required: true
24+
type: string
25+
26+
# Avoid running the same stack in parallel mode (from different workflows)
27+
# This applied to across workflows to both plan and apply
28+
concurrency:
29+
group: "${{ inputs.stack }}-${{ inputs.component }}"
30+
cancel-in-progress: false
31+
32+
permissions:
33+
id-token: write # This is required for requesting the JWT
34+
contents: read # This is required for actions/checkout
35+
36+
jobs:
37+
atmos-apply:
38+
name: ${{ inputs.component }}-${{ inputs.stack }}
39+
40+
# The GitHub environment is defined in Atmos Pro settings.
41+
# Typically this is <tenant>-<stage>
42+
environment: ${{ inputs.github_environment }}
43+
44+
runs-on:
45+
- "runs-on=${{ github.run_id }}"
46+
- "runner=terraform"
47+
- "tag=${{ inputs.component }}-${{ inputs.stack }}"
48+
- "private=false"
49+
50+
steps:
51+
- uses: runs-on/action@v1
52+
- uses: unfor19/install-aws-cli-action@v1
53+
54+
- name: Apply Atmos Component
55+
uses: cloudposse/github-action-atmos-terraform-apply@v4
56+
with:
57+
# Atmos Pro args
58+
component: ${{ inputs.component }}
59+
stack: ${{ inputs.stack }}
60+
sha: ${{ inputs.sha }}
61+
# Atmos required configuration
62+
atmos-version: ${{ vars.ATMOS_VERSION }}
63+
atmos-config-path: ${{ vars.ATMOS_CONFIG_PATH }}
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
name: 👽 Atmos Pro Terraform Plan
2+
run-name: plan ${{ inputs.component }}/${{ inputs.stack }}/${{ inputs.atmos_pro_run_id}}
3+
4+
on:
5+
workflow_dispatch:
6+
inputs:
7+
atmos_pro_run_id:
8+
description: "Atmos Pro Run ID"
9+
type: string
10+
sha:
11+
description: "Commit SHA"
12+
type: string
13+
component:
14+
description: "Component"
15+
required: true
16+
type: string
17+
stack:
18+
description: "Stack"
19+
required: true
20+
type: string
21+
22+
# Avoid running the same stack in parallel mode (from different workflows)
23+
# This applied to across workflows to both plan and apply
24+
concurrency:
25+
group: "${{ inputs.stack }}-${{ inputs.component }}"
26+
cancel-in-progress: false
27+
28+
permissions:
29+
id-token: write # This is required for requesting the JWT (OIDC) token
30+
contents: read # This is required for actions/checkout
31+
32+
jobs:
33+
atmos-plan:
34+
name: ${{ inputs.component }}-${{ inputs.stack }}
35+
36+
runs-on:
37+
- "runs-on=${{ github.run_id }}"
38+
- "runner=terraform"
39+
- "tag=${{ inputs.component }}-${{ inputs.stack }}"
40+
- "private=false"
41+
42+
steps:
43+
- uses: runs-on/action@v1
44+
- uses: unfor19/install-aws-cli-action@v1
45+
46+
- name: Plan Atmos Component
47+
uses: cloudposse/github-action-atmos-terraform-plan@v5
48+
with:
49+
# Atmos Pro args
50+
component: ${{ inputs.component }}
51+
stack: ${{ inputs.stack }}
52+
sha: ${{ inputs.sha }}
53+
# Atmos required configuration
54+
atmos-version: ${{ vars.ATMOS_VERSION }}
55+
atmos-config-path: ${{ vars.ATMOS_CONFIG_PATH }}
Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
name: 👽 Atmos Pro Determine Affected Stacks
2+
run-name: 👽 Atmos Pro Determine Affected Stacks
3+
4+
# Atmos Pro reacts to events defined in the Atmos stack settings
5+
# and will trigger the appropriate workflows for the given event.
6+
#
7+
# For example, pull requests opened, synchronize, and reopened will trigger plan workflows.
8+
# Whereas pull requests merged will trigger apply workflows
9+
on:
10+
pull_request:
11+
types:
12+
- opened
13+
- synchronize
14+
- reopened
15+
- closed
16+
branches:
17+
- main
18+
19+
# Avoid conflicting workflow triggers.
20+
# For example, wait to trigger apply until plan has been triggered
21+
concurrency:
22+
group: "${{ github.ref }}"
23+
cancel-in-progress: false
24+
25+
permissions:
26+
id-token: write # This is required for requesting the JWT (OIDC) token
27+
contents: read # This is required for actions/checkout
28+
29+
jobs:
30+
affected:
31+
name: Trigger Affected Stacks
32+
33+
runs-on:
34+
- "runs-on=${{ github.run_id }}"
35+
- "runner=small"
36+
- "tag=affected-stacks"
37+
- "private=false"
38+
39+
# Trigger Atmos Pro for Pull Request plan events and specifically closed PRs that have been merged (not just closed)
40+
if: github.event.action != 'closed' || (github.event.action == 'closed' && github.event.pull_request.merged == true)
41+
42+
steps:
43+
- uses: runs-on/action@v1
44+
- name: Checkout
45+
# For merged PRs, we will need to checkout the base branch to get the correct base branch SHA.
46+
# This isn't necessary for other events.
47+
if: github.event.action == 'closed'
48+
uses: actions/checkout@v4
49+
with:
50+
fetch-depth: 0 # Fetch all history for all branches and tags
51+
52+
# For merged PRs, we want to use 1 previous commit from the base branch SHA
53+
# This is because by the time this workflow runs, the PR branch has already been merged.
54+
# It's critical to use the base branch SHA to get the correct changes, not the previous commit from the PR branch.
55+
- name: Determine previous commit on base branch
56+
id: get_parent
57+
if: github.event.action == 'closed'
58+
shell: bash
59+
run: |
60+
# For squash merges, github.event.pull_request.base.sha represents the state of the base branch
61+
# when the PR was created (or last updated). This may be stale compared to the actual commit
62+
# on the main branch at the time of the merge. Using 'HEAD~1' after the merge ensures we get
63+
# the commit that was the tip of main immediately before the squash merge commit was added.
64+
echo "Merge commit: $(git rev-parse HEAD)"
65+
PARENT=$(git rev-parse HEAD~1)
66+
echo "Parent (base) commit: $PARENT"
67+
echo "merge_commit=$MERGE_COMMIT" >> "$GITHUB_OUTPUT"
68+
echo "parent_commit=$PARENT" >> "$GITHUB_OUTPUT"
69+
70+
- name: Determine Affected Stacks
71+
id: affected
72+
uses: cloudposse/github-action-atmos-affected-stacks@v6
73+
env:
74+
ATMOS_PRO_WORKSPACE_ID: ${{ vars.ATMOS_PRO_WORKSPACE_ID }}
75+
with:
76+
atmos-version: ${{ vars.ATMOS_VERSION }}
77+
atmos-config-path: ${{ vars.ATMOS_CONFIG_PATH }}
78+
atmos-pro-upload: true
79+
# Compare the head of the PR to the base of the PR if the PR is not merged.
80+
# If the PR is merged, compare the head of the PR to 1 previous commit on the base branch.
81+
head-ref: ${{ github.event.pull_request.head.sha }}
82+
base-ref: ${{ github.event.action == 'closed' && steps.get_parent.outputs.parent_commit || github.event.pull_request.base.sha }}

examples/snippets/.github/workflows/atmos-terraform-apply-matrix.yaml

Lines changed: 0 additions & 57 deletions
This file was deleted.

examples/snippets/.github/workflows/atmos-terraform-apply.yaml

Lines changed: 0 additions & 104 deletions
This file was deleted.

0 commit comments

Comments
 (0)