-
-
Notifications
You must be signed in to change notification settings - Fork 541
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
[Other pre-commit hooks in pre-commit-terraform Docker image] github action error during installation #359
Comments
Hi, try to force install sudo apt update
sudo apt install build-essential and if you got some additional errors like "have no package X" - try to install "X-dev" package. Also, check that you use exactly python 3. here are my common checks for infra, hope that will be helpfull name: Common issues check
on: [pull_request]
jobs:
pre-commit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- run: |
git fetch --no-tags --prune --depth=1 origin +refs/heads/*:refs/remotes/origin/*
- name: Get changed files
id: file_changes
run: |
export DIFF=$(git diff --name-only origin/${{ github.base_ref }} ${{ github.sha }})
echo "Diff between ${{ github.base_ref }} and ${{ github.sha }}"
echo "::set-output name=files::$( echo "$DIFF" | xargs echo )"
- name: TFLint cache plugin dir
uses: actions/cache@v2
with:
path: ~/.tflint.d/plugins
key: ubuntu-latest-tflint-${{ hashFiles('.tflint.hcl') }}
- name: Setup TFLint
uses: terraform-linters/[email protected]
- name: Init TFLint
run: tflint --init
- name: Setup Terraform docs
env:
# Can be 'latest' or valid version like '0.15.0'
TERRAFORM_DOCS_VERSION: latest
run: |
( \
TERRAFORM_DOCS_RELEASES="https://api.github.com/repos/terraform-docs/terraform-docs/releases" && \
[ "$TERRAFORM_DOCS_VERSION" = "latest" ] && curl -L "$(curl -s ${TERRAFORM_DOCS_RELEASES}/latest | grep -o -E -m 1 "https://.+?-linux-amd64.tar.gz")" > terraform-docs.tgz \
|| curl -L "$(curl -s ${TERRAFORM_DOCS_RELEASES} | grep -o -E "https://.+?v${TERRAFORM_DOCS_VERSION}-linux-amd64.tar.gz")" > terraform-docs.tgz \
) \
&& tar -xzf terraform-docs.tgz terraform-docs && rm terraform-docs.tgz \
&& chmod +x terraform-docs && sudo mv terraform-docs /usr/bin/
- name: Install shfmt
run: |
curl -L "$(curl -s https://api.github.com/repos/mvdan/sh/releases/latest | grep -o -E -m 1 "https://.+?linux_amd64")" > shfmt \
&& chmod +x shfmt && sudo mv shfmt /usr/bin/
- uses: hashicorp/setup-terraform@v1
with:
terraform_version: ~0.13.6
- uses: actions/setup-python@v2
with:
python-version: '3.9'
# Need to success pre-commit fix push
- uses: actions/checkout@v2
with:
fetch-depth: 0
ref: ${{ github.event.pull_request.head.sha }}
# Skip terraform_tflint which interferes to commit pre-commit auto-fixes
- name: Execute pre-commit
uses: pre-commit/[email protected]
env:
SKIP: no-commit-to-branch,terraform_tflint
with:
token: ${{ secrets.GITHUB_TOKEN }}
extra_args: --color=always --show-diff-on-failure --files ${{ steps.file_changes.outputs.files }}
# Run only skipped checks
- name: Execute pre-commit check that have no auto-fixes
if: always()
uses: pre-commit/[email protected]
with:
extra_args: >
--config .github/.pre-commit-hooks-without-autofixes.yaml
--color=always --show-diff-on-failure --files ${{ steps.file_changes.outputs.files }} |
Thx so much i will test it |
Hi, I had the same issue. Like you guessed it is linked to https://github.com/pre-commit/pre-commit-hooks. To solve this issue it is possible to just update alpine-sdk, this will add the dependencies that you need to run the container:
I am wondering more globally if we should include this in the Dockerfile of this project to be able to run those checks since they are pretty common, but that would also "create" a dependency with another repository / project which is complex and might not be what we want in this project. |
This issue has been resolved in version 1.70.0 🎉 |
Hi People,
Configurations
I have this configurations
Pipeline
Problem
Running this action, i find this error
see: pipeline log
This configuration works
see https://github.com/pagopa/devops-azure-governance/runs/5991612215?check_suite_focus=true
Help
Please can you help me to understand what is the problem, because in local works as expected.
ps: in the logs there are some info about the fact that gcc is not found, but i make some test and gcc is in place.
Have a nice day
The text was updated successfully, but these errors were encountered: