2020-12-16 01:16:53 +05:30
|
|
|
name: releaser
|
2020-08-11 05:46:13 +05:30
|
|
|
on:
|
|
|
|
push:
|
|
|
|
tags:
|
2020-11-25 15:50:56 -08:00
|
|
|
- 'v*'
|
2020-08-11 05:46:13 +05:30
|
|
|
jobs:
|
2021-02-23 04:18:11 +05:30
|
|
|
release-init-kyverno:
|
|
|
|
runs-on: ubuntu-latest
|
2022-01-10 19:40:44 +05:30
|
|
|
permissions:
|
|
|
|
contents: read
|
|
|
|
packages: write
|
|
|
|
id-token: write
|
2021-02-23 04:18:11 +05:30
|
|
|
steps:
|
|
|
|
- name: Checkout
|
|
|
|
uses: actions/checkout@v2
|
|
|
|
with:
|
|
|
|
fetch-depth: 0
|
|
|
|
|
|
|
|
- name: Set up Go
|
|
|
|
uses: actions/setup-go@v2
|
|
|
|
with:
|
2021-07-09 18:01:46 -07:00
|
|
|
go-version: 1.16
|
2021-02-23 04:18:11 +05:30
|
|
|
|
2021-09-27 01:14:24 +05:30
|
|
|
- name: Install Cosign
|
|
|
|
uses: sigstore/cosign-installer@main
|
|
|
|
with:
|
2022-01-10 19:40:44 +05:30
|
|
|
cosign-release: 'v1.4.1'
|
2021-09-27 01:14:24 +05:30
|
|
|
|
2021-02-23 04:18:11 +05:30
|
|
|
- name: Cache Go modules
|
|
|
|
uses: actions/cache@v1
|
|
|
|
with:
|
|
|
|
path: ~/go/pkg/mod
|
|
|
|
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
|
|
|
|
restore-keys: |
|
|
|
|
${{ runner.os }}-go-
|
|
|
|
|
|
|
|
- name: Set up Go
|
|
|
|
uses: actions/setup-go@v2
|
|
|
|
with:
|
2021-07-09 18:01:46 -07:00
|
|
|
go-version: 1.16
|
2021-02-23 04:18:11 +05:30
|
|
|
- uses: creekorful/goreportcard-action@v1.0
|
|
|
|
|
|
|
|
- name: login to GitHub Container Registry
|
|
|
|
run: echo ${{ secrets.CR_PAT }} | docker login ghcr.io -u ${{ github.repository_owner }} --password-stdin
|
|
|
|
|
|
|
|
- name: Set up Docker Buildx
|
|
|
|
uses: docker/setup-buildx-action@v1
|
|
|
|
id: buildx
|
|
|
|
with:
|
|
|
|
install: true
|
|
|
|
|
2021-09-27 01:14:24 +05:30
|
|
|
- name: Set version
|
|
|
|
run: |
|
|
|
|
echo "KYVERNO_VERSION=$(git describe --match "v[0-9]*")"
|
|
|
|
|
2021-02-23 04:18:11 +05:30
|
|
|
- name : docker images publish
|
|
|
|
run: |
|
2021-10-13 11:05:40 +05:30
|
|
|
make docker-publish-sigs
|
2021-02-23 04:18:11 +05:30
|
|
|
make docker-publish-initContainer
|
|
|
|
|
2022-01-10 19:40:44 +05:30
|
|
|
- name: get digest
|
|
|
|
id: get-step
|
|
|
|
run: |
|
|
|
|
echo "::set-output name=digest::$(make docker-get-initContainer-digest)"
|
|
|
|
|
2021-09-27 01:14:24 +05:30
|
|
|
- name: Sign image
|
2022-01-04 21:38:28 +05:30
|
|
|
env:
|
|
|
|
COSIGN_EXPERIMENTAL: "true"
|
2022-01-06 02:32:17 +05:30
|
|
|
run: |
|
2022-01-10 19:40:44 +05:30
|
|
|
cosign sign \
|
2022-01-04 21:38:28 +05:30
|
|
|
-a "repo=${{ github.repository }}" \
|
|
|
|
-a "workflow=${{ github.workflow }}" \
|
|
|
|
-a "ref=${{ github.sha }}" \
|
2022-01-10 19:40:44 +05:30
|
|
|
ghcr.io/kyverno/kyvernopre@sha256:${{ steps.get-step.outputs.digest }}
|
2021-09-27 01:14:24 +05:30
|
|
|
|
2021-02-23 04:18:11 +05:30
|
|
|
release-kyverno:
|
|
|
|
runs-on: ubuntu-latest
|
2022-01-10 19:40:44 +05:30
|
|
|
permissions:
|
|
|
|
contents: read
|
|
|
|
packages: write
|
|
|
|
id-token: write
|
2021-02-23 04:18:11 +05:30
|
|
|
steps:
|
|
|
|
- name: Checkout
|
|
|
|
uses: actions/checkout@v2
|
|
|
|
with:
|
|
|
|
fetch-depth: 0
|
|
|
|
|
|
|
|
- name: Set up Go
|
|
|
|
uses: actions/setup-go@v2
|
|
|
|
with:
|
2021-07-09 18:01:46 -07:00
|
|
|
go-version: 1.16
|
2021-02-23 04:18:11 +05:30
|
|
|
|
2021-09-27 01:14:24 +05:30
|
|
|
- name: Install Cosign
|
|
|
|
uses: sigstore/cosign-installer@main
|
|
|
|
with:
|
2022-01-10 19:40:44 +05:30
|
|
|
cosign-release: 'v1.4.1'
|
2021-09-27 01:14:24 +05:30
|
|
|
|
2021-02-23 04:18:11 +05:30
|
|
|
- name: Cache Go modules
|
|
|
|
uses: actions/cache@v1
|
|
|
|
with:
|
|
|
|
path: ~/go/pkg/mod
|
|
|
|
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
|
|
|
|
restore-keys: |
|
|
|
|
${{ runner.os }}-go-
|
|
|
|
|
|
|
|
- name: Set up Go
|
|
|
|
uses: actions/setup-go@v2
|
|
|
|
with:
|
2021-07-09 18:01:46 -07:00
|
|
|
go-version: 1.16
|
2021-02-23 04:18:11 +05:30
|
|
|
- uses: creekorful/goreportcard-action@v1.0
|
|
|
|
|
|
|
|
- name: login to GitHub Container Registry
|
|
|
|
run: echo ${{ secrets.CR_PAT }} | docker login ghcr.io -u ${{ github.repository_owner }} --password-stdin
|
|
|
|
|
|
|
|
- name: Set up Docker Buildx
|
|
|
|
uses: docker/setup-buildx-action@v1
|
|
|
|
id: buildx
|
|
|
|
with:
|
|
|
|
install: true
|
|
|
|
|
2021-09-27 01:14:24 +05:30
|
|
|
- name: Set version
|
|
|
|
run: |
|
|
|
|
echo "KYVERNO_VERSION=$(git describe --match "v[0-9]*")"
|
2021-11-22 18:27:51 +05:30
|
|
|
echo "KYVERNO_VERSION=$(git describe --match "v[0-9]*")" >> $GITHUB_ENV
|
2021-09-27 01:14:24 +05:30
|
|
|
|
2021-09-27 01:22:46 +05:30
|
|
|
- name: Generate SBOM JSON
|
2021-10-23 14:26:44 +01:00
|
|
|
uses: CycloneDX/gh-gomod-generate-sbom@v1
|
2021-09-27 01:22:46 +05:30
|
|
|
with:
|
2021-10-23 14:26:44 +01:00
|
|
|
version: v1
|
|
|
|
args: mod -licenses -json -output kyverno-v${{ env.KYVERNO_VERSION }}-bom.cdx.json
|
|
|
|
|
2021-09-27 01:22:46 +05:30
|
|
|
- uses: actions/upload-artifact@v2
|
|
|
|
with:
|
|
|
|
name: kyverno-bom-cdx
|
|
|
|
path: kyverno-v*-bom.cdx.json
|
|
|
|
|
2021-02-23 04:18:11 +05:30
|
|
|
- name : docker images publish
|
|
|
|
run: |
|
2021-10-13 11:05:40 +05:30
|
|
|
make docker-publish-sbom
|
2021-02-23 04:18:11 +05:30
|
|
|
make docker-publish-kyverno
|
|
|
|
|
2022-01-10 19:40:44 +05:30
|
|
|
- name: get digest
|
|
|
|
id: get-step
|
|
|
|
run: |
|
|
|
|
echo "::set-output name=digest::$(make docker-get-kyverno-digest)"
|
|
|
|
|
2021-09-27 01:22:46 +05:30
|
|
|
- name: Sign image and SBOM
|
2022-01-04 21:38:28 +05:30
|
|
|
env:
|
|
|
|
COSIGN_EXPERIMENTAL: "true"
|
2022-01-06 02:32:17 +05:30
|
|
|
run: |
|
2022-01-10 19:40:44 +05:30
|
|
|
cosign sign \
|
2022-01-04 21:38:28 +05:30
|
|
|
-a "repo=${{ github.repository }}" \
|
|
|
|
-a "workflow=${{ github.workflow }}" \
|
|
|
|
-a "ref=${{ github.sha }}" \
|
2022-01-10 19:40:44 +05:30
|
|
|
ghcr.io/kyverno/kyverno@sha256:${{ steps.get-step.outputs.digest }}
|
2021-10-13 11:05:40 +05:30
|
|
|
cosign attach sbom -sbom ./*-bom.cdx.json -type cyclonedx ghcr.io/kyverno/sbom:latest
|
|
|
|
|
2021-10-05 11:52:06 +05:30
|
|
|
- name: Trivy Scan Image
|
|
|
|
uses: aquasecurity/trivy-action@master
|
|
|
|
with:
|
2021-11-22 18:27:51 +05:30
|
|
|
image-ref: 'ghcr.io/kyverno/kyverno:${{env.KYVERNO_VERSION}}'
|
2021-10-05 11:52:06 +05:30
|
|
|
format: 'table'
|
|
|
|
exit-code: '1'
|
|
|
|
ignore-unfixed: true
|
|
|
|
vuln-type: 'os,library'
|
|
|
|
severity: 'CRITICAL,HIGH'
|
2021-09-27 01:14:24 +05:30
|
|
|
|
2021-02-23 04:18:11 +05:30
|
|
|
release-kyverno-cli:
|
2020-08-11 05:46:13 +05:30
|
|
|
runs-on: ubuntu-latest
|
2022-01-10 19:40:44 +05:30
|
|
|
permissions:
|
|
|
|
contents: read
|
|
|
|
packages: write
|
|
|
|
id-token: write
|
2020-08-11 05:46:13 +05:30
|
|
|
steps:
|
2020-11-25 15:50:56 -08:00
|
|
|
- name: Checkout
|
2020-08-11 05:46:13 +05:30
|
|
|
uses: actions/checkout@v2
|
2020-12-16 01:16:53 +05:30
|
|
|
with:
|
|
|
|
fetch-depth: 0
|
|
|
|
|
|
|
|
- name: Set up Go
|
|
|
|
uses: actions/setup-go@v2
|
|
|
|
with:
|
2021-07-09 18:01:46 -07:00
|
|
|
go-version: 1.16
|
2020-11-25 15:50:56 -08:00
|
|
|
|
2021-09-27 01:14:24 +05:30
|
|
|
- name: Install Cosign
|
|
|
|
uses: sigstore/cosign-installer@main
|
|
|
|
with:
|
2022-01-10 19:40:44 +05:30
|
|
|
cosign-release: 'v1.4.1'
|
2021-09-27 01:14:24 +05:30
|
|
|
|
2020-12-16 01:16:53 +05:30
|
|
|
- name: Cache Go modules
|
|
|
|
uses: actions/cache@v1
|
|
|
|
with:
|
|
|
|
path: ~/go/pkg/mod
|
|
|
|
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
|
|
|
|
restore-keys: |
|
|
|
|
${{ runner.os }}-go-
|
2020-11-25 15:50:56 -08:00
|
|
|
|
|
|
|
- name: Set up Go
|
2020-08-11 05:46:13 +05:30
|
|
|
uses: actions/setup-go@v2
|
|
|
|
with:
|
2021-07-09 18:01:46 -07:00
|
|
|
go-version: 1.16
|
2020-08-11 05:46:13 +05:30
|
|
|
- uses: creekorful/goreportcard-action@v1.0
|
2020-08-11 22:02:51 +05:30
|
|
|
|
2020-11-24 12:56:35 -08:00
|
|
|
- name: login to GitHub Container Registry
|
|
|
|
run: echo ${{ secrets.CR_PAT }} | docker login ghcr.io -u ${{ github.repository_owner }} --password-stdin
|
2020-08-11 22:02:51 +05:30
|
|
|
|
2021-02-19 07:39:01 +05:30
|
|
|
- name: Set up Docker Buildx
|
|
|
|
uses: docker/setup-buildx-action@v1
|
|
|
|
id: buildx
|
|
|
|
with:
|
|
|
|
install: true
|
|
|
|
|
2021-09-27 01:14:24 +05:30
|
|
|
- name: Set version
|
|
|
|
run: |
|
|
|
|
echo "KYVERNO_VERSION=$(git describe --match "v[0-9]*")"
|
|
|
|
|
2020-08-11 22:02:51 +05:30
|
|
|
- name : docker images publish
|
|
|
|
run: |
|
2021-02-23 04:18:11 +05:30
|
|
|
make docker-publish-cli
|
2021-09-27 01:14:24 +05:30
|
|
|
|
2022-01-10 19:40:44 +05:30
|
|
|
- name: get digest
|
|
|
|
id: get-step
|
|
|
|
run: |
|
|
|
|
echo "::set-output name=digest::$(make docker-get-cli-digest)"
|
|
|
|
|
2021-09-27 01:14:24 +05:30
|
|
|
- name: Sign image
|
2022-01-04 21:38:28 +05:30
|
|
|
env:
|
|
|
|
COSIGN_EXPERIMENTAL: "true"
|
2022-01-06 02:32:17 +05:30
|
|
|
run: |
|
2022-01-10 19:40:44 +05:30
|
|
|
cosign sign \
|
2022-01-04 21:38:28 +05:30
|
|
|
-a "repo=${{ github.repository }}" \
|
|
|
|
-a "workflow=${{ github.workflow }}" \
|
|
|
|
-a "ref=${{ github.sha }}" \
|
2022-01-10 19:40:44 +05:30
|
|
|
ghcr.io/kyverno/kyverno-cli@sha256:${{ steps.get-step.outputs.digest }}
|
2021-08-10 21:37:46 +05:30
|
|
|
|
|
|
|
create-release:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
needs:
|
|
|
|
- release-init-kyverno
|
|
|
|
- release-kyverno
|
|
|
|
- release-kyverno-cli
|
|
|
|
steps:
|
|
|
|
- name: Set version
|
|
|
|
id: version
|
|
|
|
run: echo ::set-output name=version::${GITHUB_REF#refs/*/}
|
|
|
|
|
|
|
|
- name: Checkout
|
|
|
|
uses: actions/checkout@v2
|
|
|
|
with:
|
|
|
|
fetch-depth: 0
|
|
|
|
|
|
|
|
- name: Set up Go
|
|
|
|
uses: actions/setup-go@v2
|
|
|
|
with:
|
|
|
|
go-version: 1.16
|
|
|
|
|
|
|
|
- name: Cache Go modules
|
|
|
|
uses: actions/cache@v1
|
|
|
|
with:
|
|
|
|
path: ~/go/pkg/mod
|
|
|
|
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
|
|
|
|
restore-keys: |
|
|
|
|
${{ runner.os }}-go-
|
|
|
|
- name: Set up Go
|
|
|
|
uses: actions/setup-go@v2
|
|
|
|
with:
|
|
|
|
go-version: 1.16
|
|
|
|
- uses: creekorful/goreportcard-action@v1.0
|
|
|
|
|
|
|
|
- name: Make Release
|
|
|
|
env:
|
|
|
|
VERSION: ${{ steps.version.outputs.version }}
|
|
|
|
run: |
|
|
|
|
rm -rf release
|
|
|
|
mkdir release
|
|
|
|
make release-notes > release/release-notes.out
|
|
|
|
cat release/release-notes.out
|
|
|
|
|
|
|
|
- name: Run GoReleaser
|
|
|
|
uses: goreleaser/goreleaser-action@v2
|
|
|
|
with:
|
|
|
|
version: latest
|
|
|
|
args: release --rm-dist --debug --release-notes=release/release-notes.out
|
|
|
|
env:
|
|
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
2021-02-23 04:18:11 +05:30
|
|
|
|
|
|
|
release-cli-via-krew:
|
|
|
|
runs-on: ubuntu-latest
|
2021-08-12 09:58:25 -07:00
|
|
|
needs:
|
|
|
|
- create-release
|
2021-02-23 04:18:11 +05:30
|
|
|
steps:
|
|
|
|
- name: Checkout
|
|
|
|
uses: actions/checkout@v2
|
|
|
|
|
|
|
|
- name: Unshallow
|
|
|
|
run: git fetch --prune --unshallow
|
|
|
|
|
|
|
|
- name: Check Tag
|
|
|
|
id: check-tag
|
|
|
|
run: |
|
|
|
|
if [[ ${{ github.event.ref }} =~ ^refs/tags/v[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
|
|
|
|
echo ::set-output name=match::true
|
|
|
|
fi
|
|
|
|
|
|
|
|
- name: Update new version in krew-index
|
|
|
|
if: steps.check-tag.outputs.match == 'true'
|
|
|
|
uses: rajatjindal/krew-release-bot@v0.0.38
|