Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prepare v3 version of workflow #82

Open
wants to merge 9 commits into
base: v2
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 19 additions & 22 deletions .github/workflows/terraform.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,6 @@ on:
description: Enforce tflint warnings for changed files by default
type: boolean
default: false
default_runner_override_label:
description: Change this to "self-hosted" or "ubuntu-latest"
type: string
default: "ubuntu-latest"
runner_label:
description: Runner label to point to self hosted runners
type: string
Expand All @@ -81,9 +77,11 @@ jobs:
if: github.ref_name != 'main'
name: Format and Validate
runs-on:
- ${{ inputs.default_runner_override_label }}
- ${{ inputs.runner_label }}
steps:
- name: Install missing binaries zip jq curl
run: sudo apt-get update && sudo apt-get install zip jq curl git -y

- name: Checkout
uses: actions/checkout@v3
with:
Expand All @@ -94,6 +92,11 @@ jobs:
with:
python-version: '3.11'

- name: Setup Node only for self-hosted runners
uses: actions/setup-node@v3
with:
node-version: 19

- run: mkdir -p "${TF_PLUGIN_CACHE_DIR}"
- name: Cache Terraform
uses: actions/cache@v3
Expand All @@ -106,12 +109,6 @@ jobs:
path: ~/.tflint.d/plugins
key: ${{ runner.os }}-tflint-${{ hashFiles('**/.tflint.hcl') }}

- name: Setup Node only for self-hosted runners
uses: actions/setup-node@v3
if: ${{ inputs.default_runner_override_label == 'self-hosted' }}
with:
node-version: 18

- name: Setup Terraform
uses: hashicorp/setup-terraform@v2
with:
Expand Down Expand Up @@ -179,9 +176,11 @@ jobs:
name: Linting
if: github.ref_name != 'main'
runs-on:
- ${{ inputs.default_runner_override_label }}
- ${{ inputs.runner_label }}
steps:
- name: Install missing binaries zip jq curl
run: sudo apt-get update && sudo apt-get install zip jq curl git -y

- name: Checkout
uses: actions/checkout@v3
with:
Expand All @@ -192,6 +191,11 @@ jobs:
with:
python-version: '3.11'

- name: Setup Node only for self-hosted runners
uses: actions/setup-node@v3
with:
node-version: 19

- run: mkdir -p "${TF_PLUGIN_CACHE_DIR}"
- name: Cache Terraform
uses: actions/cache@v3
Expand Down Expand Up @@ -223,12 +227,6 @@ jobs:
tflint_version: "v0.47.0"
github_token: ${{ secrets.GITHUB_TOKEN }}

- name: Setup Node only for self-hosted runners
uses: actions/setup-node@v3
if: ${{ inputs.default_runner_override_label == 'self-hosted' }}
with:
node-version: 19

- name: Pre-init Hook
run: ${{ inputs.pre_init_hook }}

Expand Down Expand Up @@ -308,7 +306,6 @@ jobs:
name: Security Checks
if: github.ref_name != 'main'
runs-on:
- ${{ inputs.default_runner_override_label }}
- ${{ inputs.runner_label }}
steps:
- name: Checkout
Expand All @@ -318,9 +315,9 @@ jobs:
submodules: ${{ inputs.enable_submodules }}

- name: Run Trivy vulnerability scanner in IaC mode
uses: aquasecurity/trivy-action@0.12.0
uses: aquasecurity/trivy-action@0.20.0
with:
scan-type: 'config'
scan-type: 'fs'
hide-progress: false
format: 'sarif'
output: 'trivy-results.sarif'
Expand All @@ -331,7 +328,7 @@ jobs:
# https://github.com/aquasecurity/trivy/issues/5003
- name: Remove git from url for sarif uploading
shell: bash
run: |
run: |
sed -i 's#git::https:/##g' trivy-results.sarif

- name: Upload Trivy scan results to GitHub Security tab
Expand Down