chore: enable image scan through anchore (#74)
* chore: enable image scan through anchore * chore: build entire image before doing image scan * chore: fix goreleaser config * chore: enable anchore to fail * chore: remove pull_request event from ci
This commit is contained in:
parent
2403de8c2b
commit
d110606e22
2 changed files with 40 additions and 7 deletions
43
.github/workflows/go.yml
vendored
43
.github/workflows/go.yml
vendored
|
@ -1,5 +1,5 @@
|
||||||
name: Go
|
name: Go
|
||||||
on: [push, pull_request]
|
on: [push]
|
||||||
jobs:
|
jobs:
|
||||||
|
|
||||||
lint:
|
lint:
|
||||||
|
@ -39,6 +39,39 @@ jobs:
|
||||||
- name: Test
|
- name: Test
|
||||||
run: go test ./...
|
run: go test ./...
|
||||||
|
|
||||||
|
image-scan:
|
||||||
|
name: Image Scan
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
|
||||||
|
- name: Unshallow
|
||||||
|
run: git fetch --prune --unshallow
|
||||||
|
|
||||||
|
- name: Set up Go
|
||||||
|
uses: actions/setup-go@v1
|
||||||
|
with:
|
||||||
|
go-version: 1.14
|
||||||
|
id: go
|
||||||
|
|
||||||
|
- name: Run GoReleaser
|
||||||
|
uses: goreleaser/goreleaser-action@v1
|
||||||
|
with:
|
||||||
|
version: latest
|
||||||
|
args: release --rm-dist --skip-validate --skip-publish
|
||||||
|
key: ${{ secrets.YOUR_PRIVATE_KEY }}
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|
||||||
|
- name: Scan image
|
||||||
|
uses: anchore/scan-action@master
|
||||||
|
with:
|
||||||
|
image-reference: "hipages/php-fpm_exporter:latest"
|
||||||
|
dockerfile-path: "./Dockerfile"
|
||||||
|
fail-build: true
|
||||||
|
include-app-packages: true
|
||||||
|
|
||||||
tag:
|
tag:
|
||||||
name: Tag
|
name: Tag
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
@ -54,7 +87,7 @@ jobs:
|
||||||
|
|
||||||
- name: Unshallow
|
- name: Unshallow
|
||||||
run: git fetch --prune --unshallow
|
run: git fetch --prune --unshallow
|
||||||
|
|
||||||
- name: Install semantic-release
|
- name: Install semantic-release
|
||||||
run: yarn global add --no-progress --non-interactive "semantic-release" "@semantic-release/exec"
|
run: yarn global add --no-progress --non-interactive "semantic-release" "@semantic-release/exec"
|
||||||
|
|
||||||
|
@ -70,16 +103,16 @@ jobs:
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v2
|
||||||
|
|
||||||
- name: Unshallow
|
- name: Unshallow
|
||||||
run: git fetch --prune --unshallow
|
run: git fetch --prune --unshallow
|
||||||
|
|
||||||
- name: Set up Go
|
- name: Set up Go
|
||||||
uses: actions/setup-go@v1
|
uses: actions/setup-go@v1
|
||||||
with:
|
with:
|
||||||
go-version: 1.14
|
go-version: 1.14
|
||||||
id: go
|
id: go
|
||||||
|
|
||||||
- name: Run GoReleaser
|
- name: Run GoReleaser
|
||||||
uses: goreleaser/goreleaser-action@v1
|
uses: goreleaser/goreleaser-action@v1
|
||||||
with:
|
with:
|
||||||
|
|
|
@ -20,5 +20,5 @@ dockers:
|
||||||
- "--build-arg=BUILD_DATE={{.Date}}"
|
- "--build-arg=BUILD_DATE={{.Date}}"
|
||||||
- "--build-arg=VCS_REF={{.FullCommit}}"
|
- "--build-arg=VCS_REF={{.FullCommit}}"
|
||||||
|
|
||||||
archive:
|
archives:
|
||||||
format: binary
|
- format: binary
|
||||||
|
|
Loading…
Reference in a new issue