diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml new file mode 100644 index 00000000..43654256 --- /dev/null +++ b/.github/workflows/lint.yml @@ -0,0 +1,64 @@ +name: Lint +on: + pull_request: + paths: + - '**/Dockerfile' + +jobs: + prepare: + name: Generate matrix + runs-on: ubuntu-22.04 + outputs: + matrix: ${{ steps.set-matrix.outputs.matrix }} + steps: + - name: Checkout code + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Get changed files + id: changed-files + uses: tj-actions/changed-files@v38 + with: + json: true + escapepath: false + files: | + **/Dockerfile + + - id: set-matrix + run: echo "matrix={\"dockerfile\":${{ steps.changed-files.outputs.all_changed_files }}}" >> "$GITHUB_OUTPUT" + + hadolint: + name: Hadolint + needs: prepare + runs-on: ubuntu-latest + strategy: + matrix: ${{fromJson(needs.prepare.outputs.matrix)}} + + steps: + - uses: actions/checkout@v4 + - uses: hadolint/hadolint-action@v3.1.0 + id: hadolint + continue-on-error: true + with: + verbose: true + dockerfile: ${{matrix.dockerfile}} + + - name: Update Pull Request + uses: actions/github-script@v6 + if: github.event_name == 'pull_request' + with: + script: | + const output = ` + #### Hadolint: \`${{ steps.hadolint.outcome }}\` + \`\`\` + ${process.env.HADOLINT_RESULTS} + \`\`\` + `; + + github.rest.issues.createComment({ + issue_number: context.issue.number, + owner: context.repo.owner, + repo: context.repo.repo, + body: output + }) diff --git a/images/kube-proxy/v1.28.2/Dockerfile b/images/kube-proxy/v1.28.2/Dockerfile index 9247749f..acd4eb7b 100644 --- a/images/kube-proxy/v1.28.2/Dockerfile +++ b/images/kube-proxy/v1.28.2/Dockerfile @@ -1,3 +1,5 @@ +# dummy change to trigger workflow + FROM docker.io/library/golang:1.20.8-alpine3.18 as binary RUN apk add --no-cache cmd:make cmd:bash cmd:rsync