Skip to content

Commit

Permalink
Merge branch 'feature/dev-2821-atmos-terraform-help-should-also-show-…
Browse files Browse the repository at this point in the history
…terraform-help' of https://github.com/cloudposse/atmos into feature/dev-2821-atmos-terraform-help-should-also-show-terraform-help
  • Loading branch information
samtholiya committed Dec 24, 2024
2 parents fba6986 + 891e5d2 commit 48fee23
Show file tree
Hide file tree
Showing 5 changed files with 550 additions and 17 deletions.
37 changes: 37 additions & 0 deletions .github/mergify.yml
Original file line number Diff line number Diff line change
@@ -1 +1,38 @@
extends: .github

shared:
# Automated pull requests from bot users
is_a_bot: &is_a_bot
- or:
- "author=github-actions[bot]"

# Default branches
is_default_branch: &is_default_branch
- or:
- "base=main"
- "base=master"

# It's not closed or merged
is_open: &is_open
- and:
- -merged
- -closed

pull_request_rules:
- name: Trigger workflow dispatch on PR synchronized by github-actions[bot]
conditions:
- and: *is_a_bot
- and: *is_open
- and: *is_default_branch

actions:
comment:
message: |
Triggering the workflow dispatch for preview build...
github_actions:
workflow:
dispatch:
- workflow: website-preview-build.yml
ref: "{{ pull_request.head.ref }}"
- workflow: test.yml
ref: "{{ pull_request.head.ref }}"
106 changes: 89 additions & 17 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,10 @@ jobs:
- name: Build
run: echo "Building on ${{ matrix.os }}"

- name: Add GNU tar to PATH (significantly faster than windows tar)
if: matrix.target == 'windows'
run: echo "C:\Program Files\Git\usr\bin" >> $Env:GITHUB_PATH

- name: Check out code into the Go module directory
uses: actions/checkout@v4

Expand Down Expand Up @@ -75,19 +79,57 @@ jobs:
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
target: linux
- os: windows-latest
target: windows
- os: macos-latest
target: macos
flavor:
- { os: ubuntu-latest, target: linux }
- { os: windows-latest, target: windows }
- { os: macos-latest, target: macos }
timeout-minutes: 15
runs-on: ${{ matrix.os }}
runs-on: ${{ matrix.flavor.os }}
steps:
- name: Check out code into the Go module directory
uses: actions/checkout@v4

- name: Add GNU tar to PATH (significantly faster than windows tar)
if: matrix.flavor.target == 'windows'
run: echo "C:\Program Files\Git\usr\bin" >> $Env:GITHUB_PATH

- name: Download build artifacts for ${{ matrix.flavor.target }}
uses: actions/download-artifact@v4
with:
name: build-artifacts-${{ matrix.flavor.target }}
path: ${{ github.workspace }}

- name: Add build artifacts directory to PATH for linux or macos
if: matrix.flavor.target == 'linux' || matrix.flavor.target == 'macos'
run: |
echo "${{ github.workspace }}" >> $GITHUB_PATH
chmod +x "${{ github.workspace }}/atmos"
- name: Add build artifacts directory to PATH for windows
if: matrix.flavor.target == 'windows'
shell: pwsh
run: |
$atmosPath = Join-Path ${{ github.workspace }} "atmos.exe"
if (-not (Test-Path $atmosPath)) {
throw "atmos.exe not found at: $atmosPath"
}
echo "${{ github.workspace }}" >> $Env:GITHUB_PATH
- uses: hashicorp/setup-terraform@v3
with:
terraform_version: ${{ env.TERRAFORM_VERSION }}
terraform_wrapper: false

- name: Check atmos.exe integrity
if: matrix.flavor.target == 'windows'
shell: pwsh
run: |
Write-Output "PATH=$Env:PATH"
Write-Output "PATHEXT=$Env:PATHEXT"
Get-ChildItem "${{ github.workspace }}"
Get-Command "${{ github.workspace }}\atmos.exe"
atmos version
- name: Set up Go
uses: actions/setup-go@v5
with:
Expand Down Expand Up @@ -279,26 +321,56 @@ jobs:

timeout-minutes: 20
steps:
- name: Download build artifacts
- name: Check out code into the Go module directory
uses: actions/checkout@v4

- name: Add GNU tar to PATH (significantly faster than windows tar)
if: matrix.flavor.target == 'windows'
run: echo "C:\Program Files\Git\usr\bin" >> $Env:GITHUB_PATH

- name: Download build artifacts for ${{ matrix.flavor.target }}
uses: actions/download-artifact@v4
with:
name: build-artifacts-${{ matrix.flavor.target }}
path: /usr/local/bin
path: ${{ github.workspace }}

- name: Set execute permissions on atmos
run: chmod +x /usr/local/bin/atmos
- name: Add build artifacts directory to PATH for linux or macos
if: matrix.flavor.target == 'linux' || matrix.flavor.target == 'macos'
run: |
echo "${{ github.workspace }}" >> $GITHUB_PATH
chmod +x "${{ github.workspace }}/atmos"
- name: Check out code into the Go module directory
uses: actions/checkout@v4
- name: Add build artifacts directory to PATH for windows
if: matrix.flavor.target == 'windows'
run: |
echo "${{ github.workspace }}" >> $Env:GITHUB_PATH
- uses: hashicorp/setup-terraform@v3
with:
terraform_version: ${{ env.TERRAFORM_VERSION }}
terraform_wrapper: false

- name: Run tests for ${{ matrix.demo-folder }}
- name: Run tests in ${{ matrix.demo-folder }} for ${{ matrix.flavor.target }}
working-directory: examples/${{ matrix.demo-folder }}
if: matrix.flavor.target == 'linux' || matrix.flavor.target == 'macos'
run: |
atmos test
- name: Check atmos.exe integrity
if: matrix.flavor.target == 'windows'
shell: pwsh
run: |
Write-Output "PATH=$Env:PATH"
Write-Output "PATHEXT=$Env:PATHEXT"
Get-ChildItem "${{ github.workspace }}"
Get-Command "${{ github.workspace }}\atmos.exe"
atmos version
- name: Run tests in ${{ matrix.demo-folder }} for ${{ matrix.flavor.target }}
working-directory: examples/${{ matrix.demo-folder }}
if: matrix.flavor.target == 'windows'
shell: pwsh
run: |
cd examples/${{ matrix.demo-folder }}
atmos test
# run other demo tests
Expand Down Expand Up @@ -352,7 +424,7 @@ jobs:
--minimum-failure-severity=warning
--recursive
--config=${{ github.workspace }}/examples/.tflint.hcl
fail_on_error: true
fail_level: error

# run other demo tests
validate:
Expand Down
4 changes: 4 additions & 0 deletions cmd/terraform_commands.go
Original file line number Diff line number Diff line change
Expand Up @@ -275,10 +275,14 @@ var commandMaps = map[string]func(cmd *cobra.Command){
"apply": func(cmd *cobra.Command) {
cmd.PersistentFlags().Bool("from-plan", false, "If set atmos will use the previously generated plan file")
cmd.PersistentFlags().String("planfile", "", "Set the plan file to use")
cmd.PersistentFlags().Bool("auto-approve", false, "Set to automatically approve and apply changes without confirmation")
},
"clean": func(cmd *cobra.Command) {
cmd.PersistentFlags().Bool("everything", false, "If set atmos will also delete the Terraform state files and directories for the component.")
cmd.PersistentFlags().Bool("force", false, "Forcefully delete Terraform state files and directories without interaction")
cmd.PersistentFlags().Bool("skip-lock-file", false, "Skip deleting the `.terraform.lock.hcl` file")
},
"destroy": func(cmd *cobra.Command) {
cmd.PersistentFlags().Bool("auto-approve", false, "Set to automatically approve and apply changes without confirmation")
},
}
Loading

0 comments on commit 48fee23

Please sign in to comment.