fix: Pin Karpenter dashboard to a commit #1016
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: pre-commit | |
on: | |
pull_request: | |
branches: | |
- main | |
paths: | |
- '**.tf' | |
- '**.yml' | |
- '**.yaml' | |
env: | |
TERRAFORM_DOCS_VERSION: v0.20.0 | |
TFSEC_VERSION: v1.28.14 | |
TF_PLUGIN_CACHE_DIR: ${{ github.workspace }}/.terraform.d/plugin-cache | |
TFLINT_VERSION: v0.56.0 | |
concurrency: | |
group: '${{ github.workflow }} @ ${{ github.event.pull_request.head.label || github.head_ref || github.ref }}' | |
cancel-in-progress: true | |
jobs: | |
collectInputs: | |
name: Collect workflow inputs | |
runs-on: ubuntu-latest | |
outputs: | |
directories: ${{ steps.dirs.outputs.directories }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Get root directories | |
id: dirs | |
uses: clowdhaus/terraform-composite-actions/[email protected] | |
preCommitMinVersions: | |
name: Min TF pre-commit | |
needs: collectInputs | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
directory: ${{ fromJson(needs.collectInputs.outputs.directories) }} | |
steps: | |
- name: Remove default Terraform | |
run: rm -rf $(which terraform) | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- uses: dorny/paths-filter@v3 | |
id: changes | |
with: | |
# We only need to check Terraform files for the current directory | |
# because the `preCommitMaxVersion` job will run the full, | |
# exhaustive checks (always) | |
filters: | | |
src: | |
- '${{ matrix.directory }}/*.tf' | |
- name: Config Terraform plugin cache | |
if: steps.changes.outputs.src== 'true' | |
run: mkdir --parents ${{ env.TF_PLUGIN_CACHE_DIR }} | |
- name: Restore Terraform Cache | |
id: restore-cache | |
uses: actions/cache/restore@v4 | |
if: steps.changes.outputs.src== 'true' | |
with: | |
# restore latest matching cache to the tf cache dir | |
# matches exact branch and versions hash, then any cache from the same branch, then any cache from any branch | |
path: ${{ env.TF_PLUGIN_CACHE_DIR }} | |
key: ${{ runner.os }}-terraform-${{ github.head_ref }}-${{ hashFiles('**/versions.tf') }} | |
restore-keys: | | |
${{ runner.os }}-terraform-${{ github.head_ref }} | |
${{ runner.os }}-terraform- | |
- name: Terraform min/max versions | |
uses: clowdhaus/[email protected] | |
if: steps.changes.outputs.src== 'true' | |
id: minMax | |
with: | |
directory: ${{ matrix.directory }} | |
- name: Pre-commit Terraform ${{ steps.minMax.outputs.minVersion }} | |
uses: clowdhaus/terraform-composite-actions/[email protected] | |
# Run only validate pre-commit check on min version supported | |
if: ${{ matrix.directory != '.' && steps.changes.outputs.src== 'true' }} | |
with: | |
terraform-version: ${{ steps.minMax.outputs.minVersion }} | |
args: 'terraform_validate --color=always --show-diff-on-failure --files ${{ matrix.directory }}/*' | |
- name: Pre-commit Terraform ${{ steps.minMax.outputs.minVersion }} | |
uses: clowdhaus/terraform-composite-actions/[email protected] | |
# Run only validate pre-commit check on min version supported | |
if: ${{ matrix.directory == '.' && steps.changes.outputs.src== 'true' }} | |
with: | |
terraform-version: ${{ steps.minMax.outputs.minVersion }} | |
args: 'terraform_validate --color=always --show-diff-on-failure --files $(ls *.tf)' | |
preCommitMaxVersion: | |
name: Max TF pre-commit | |
runs-on: ubuntu-latest | |
needs: collectInputs | |
steps: | |
- name: Remove default Terraform | |
run: rm -rf $(which terraform) | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- uses: dorny/paths-filter@v3 | |
id: changes | |
with: | |
filters: | | |
src: | |
- '**/*.tf' | |
- name: Config Terraform plugin cache | |
if: steps.changes.outputs.src== 'true' | |
run: mkdir --parents ${{ env.TF_PLUGIN_CACHE_DIR }} | |
- name: Restore Terraform Cache | |
id: restore-cache | |
uses: actions/cache/restore@v4 | |
if: steps.changes.outputs.src== 'true' | |
with: | |
# restore latest matching cache to the tf cache dir | |
# matches exact branch and versions hash, then any cache from the same branch, then any cache from any branch | |
path: ${{ env.TF_PLUGIN_CACHE_DIR }} | |
key: ${{ runner.os }}-terraform-${{ github.head_ref }}-${{ hashFiles('**/versions.tf') }} | |
restore-keys: | | |
${{ runner.os }}-terraform-${{ github.head_ref }} | |
${{ runner.os }}-terraform- | |
- name: Install tfsec | |
if: steps.changes.outputs.src== 'true' | |
run: curl -sSLo ./tfsec https://github.com/aquasecurity/tfsec/releases/download/${{ env.TFSEC_VERSION }}/tfsec-$(uname)-amd64 && chmod +x tfsec && sudo mv tfsec /usr/bin/ | |
- name: Terraform min/max versions | |
id: minMax | |
uses: clowdhaus/[email protected] | |
if: steps.changes.outputs.src== 'true' | |
- name: Pre-commit Terraform ${{ steps.minMax.outputs.maxVersion }} | |
uses: clowdhaus/terraform-composite-actions/[email protected] | |
if: steps.changes.outputs.src== 'true' | |
with: | |
terraform-version: ${{ steps.minMax.outputs.maxVersion }} | |
terraform-docs-version: ${{ env.TERRAFORM_DOCS_VERSION }} | |
tflint-version: ${{ env.TFLINT_VERSION }} | |
- name: Save Terraform Cache | |
uses: actions/cache/save@v4 | |
if: steps.changes.outputs.src== 'true' | |
with: | |
# caches cannot be updated, we can only save this hash once, | |
# after validating all blueprints we should have all plugins in cache. | |
path: ${{ env.TF_PLUGIN_CACHE_DIR }} | |
key: ${{ runner.os }}-terraform-${{ github.head_ref }}-${{ hashFiles('**/versions.tf') }} |