2022-08-23 19:53:41 +00:00
|
|
|
---
|
2023-07-20 20:51:07 +00:00
|
|
|
name: lint-enos
|
2022-08-23 19:53:41 +00:00
|
|
|
|
|
|
|
on:
|
|
|
|
pull_request:
|
|
|
|
paths:
|
|
|
|
- enos/**
|
|
|
|
|
|
|
|
jobs:
|
2023-09-27 16:53:12 +00:00
|
|
|
metadata:
|
2022-08-23 19:53:41 +00:00
|
|
|
# Only run this workflow on pull requests from hashicorp/vault branches
|
|
|
|
# as we need secrets to install enos.
|
|
|
|
if: "! github.event.pull_request.head.repo.fork"
|
2023-09-27 16:53:12 +00:00
|
|
|
name: metadata
|
2022-08-23 19:53:41 +00:00
|
|
|
runs-on: ubuntu-latest
|
2023-09-27 16:53:12 +00:00
|
|
|
outputs:
|
|
|
|
runs-on: ${{ steps.metadata.outputs.runs-on }}
|
|
|
|
version: ${{ steps.metadata.outputs.version }}
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
|
|
|
|
- id: set-product-version
|
|
|
|
uses: hashicorp/actions-set-product-version@v1
|
|
|
|
- id: metadata
|
|
|
|
run: |
|
|
|
|
echo "version=${{ steps.set-product-version.outputs.product-version }}" >> "$GITHUB_OUTPUT"
|
|
|
|
github_repository="${{ github.repository }}"
|
|
|
|
if [ "${github_repository##*/}" == "vault-enterprise" ] ; then
|
|
|
|
echo 'runs-on=["self-hosted","ondemand","linux","type=c6a.4xlarge"]' >> "$GITHUB_OUTPUT"
|
|
|
|
else
|
|
|
|
echo 'runs-on="custom-linux-xl-vault-latest"' >> "$GITHUB_OUTPUT"
|
|
|
|
fi
|
|
|
|
|
|
|
|
lint:
|
|
|
|
needs: metadata
|
|
|
|
runs-on: ${{ fromJSON(needs.metadata.outputs.runs-on) }}
|
2022-08-23 19:53:41 +00:00
|
|
|
env:
|
|
|
|
GITHUB_TOKEN: ${{ secrets.ELEVATED_GITHUB_TOKEN }}
|
2023-07-20 20:51:07 +00:00
|
|
|
ENOS_VAR_tfc_api_token: ${{ secrets.TF_API_TOKEN }}
|
2022-08-23 19:53:41 +00:00
|
|
|
steps:
|
2023-07-05 21:19:49 +00:00
|
|
|
- uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
|
2022-08-23 19:53:41 +00:00
|
|
|
- uses: hashicorp/setup-terraform@v2
|
|
|
|
with:
|
|
|
|
terraform_wrapper: false
|
|
|
|
- uses: hashicorp/action-setup-enos@v1
|
|
|
|
with:
|
|
|
|
github-token: ${{ secrets.ELEVATED_GITHUB_TOKEN }}
|
2023-09-27 18:59:02 +00:00
|
|
|
- name: Ensure shellcheck is available for linting
|
|
|
|
run: which shellcheck || (sudo apt update && sudo apt install -y shellcheck)
|
2023-07-20 20:51:07 +00:00
|
|
|
- name: lint
|
2022-08-23 19:53:41 +00:00
|
|
|
working-directory: ./enos
|
2023-07-20 20:51:07 +00:00
|
|
|
env:
|
2023-09-27 16:53:12 +00:00
|
|
|
ENOS_VAR_vault_product_version: ${{ needs.metadata.outputs.version }}
|
2023-07-20 20:51:07 +00:00
|
|
|
run: make lint
|