mirror of
https://github.com/kyverno/kyverno.git
synced 2025-03-31 03:45:17 +00:00
Adding parallel GitHub pipeline to reduce the build time (#1635)
* refactoring github workflow Signed-off-by: rajdas98 <mail.rajdas@gmail.com> * refactoring github workflow Signed-off-by: rajdas98 <mail.rajdas@gmail.com> * stage-pipeline Signed-off-by: rajdas98 <mail.rajdas@gmail.com> * Refactoring release and push github workflow Signed-off-by: rajdas98 <mail.rajdas@gmail.com> * refactoring github workflow Signed-off-by: rajdas98 <mail.rajdas@gmail.com> * adding release-cli-via-krew Signed-off-by: rajdas98 <mail.rajdas@gmail.com>
This commit is contained in:
parent
e3a8c5091c
commit
7a1629aa9d
4 changed files with 313 additions and 35 deletions
132
.github/workflows/build.yaml
vendored
132
.github/workflows/build.yaml
vendored
|
@ -8,7 +8,7 @@ on:
|
|||
- 'main'
|
||||
|
||||
jobs:
|
||||
build-kyverno:
|
||||
pre-checks:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
|
@ -32,17 +32,40 @@ jobs:
|
|||
|
||||
- name: gofmt check
|
||||
run: |
|
||||
if [ "$(gofmt -s -l . | wc -l)" -ne 0 ]
|
||||
then
|
||||
echo "The following files were found to be not go formatted:"
|
||||
gofmt -s -l .
|
||||
echo "Please run 'make fmt' to go format the above files."
|
||||
exit 1
|
||||
fi
|
||||
if [ "$(gofmt -s -l . | wc -l)" -ne 0 ]
|
||||
then
|
||||
echo "The following files were found to be not go formatted:"
|
||||
gofmt -s -l .
|
||||
echo "Please run 'make fmt' to go format the above files."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
- name: golangci-lint
|
||||
uses: reviewdog/action-golangci-lint@v1
|
||||
|
||||
build-init-kyverno:
|
||||
runs-on: ubuntu-latest
|
||||
needs: pre-checks
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Unshallow
|
||||
run: git fetch --prune --unshallow
|
||||
|
||||
- name: Set up Go
|
||||
uses: actions/setup-go@v2
|
||||
with:
|
||||
go-version: 1.14
|
||||
|
||||
- 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 Docker Buildx
|
||||
uses: docker/setup-buildx-action@v1
|
||||
id: buildx
|
||||
|
@ -51,11 +74,98 @@ jobs:
|
|||
|
||||
- name: docker images build
|
||||
run: |
|
||||
make docker-build-all
|
||||
make docker-build-initContainer
|
||||
|
||||
build-kyverno:
|
||||
runs-on: ubuntu-latest
|
||||
needs: pre-checks
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Unshallow
|
||||
run: git fetch --prune --unshallow
|
||||
|
||||
- name: Set up Go
|
||||
uses: actions/setup-go@v2
|
||||
with:
|
||||
go-version: 1.14
|
||||
|
||||
- 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 Docker Buildx
|
||||
uses: docker/setup-buildx-action@v1
|
||||
id: buildx
|
||||
with:
|
||||
install: true
|
||||
|
||||
- name: docker images build
|
||||
run: |
|
||||
make docker-build-kyverno
|
||||
|
||||
build-kyverno-cli:
|
||||
runs-on: ubuntu-latest
|
||||
needs: pre-checks
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Unshallow
|
||||
run: git fetch --prune --unshallow
|
||||
|
||||
- name: Set up Go
|
||||
uses: actions/setup-go@v2
|
||||
with:
|
||||
go-version: 1.14
|
||||
|
||||
- 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 Docker Buildx
|
||||
uses: docker/setup-buildx-action@v1
|
||||
id: buildx
|
||||
with:
|
||||
install: true
|
||||
|
||||
- name: docker images build
|
||||
run: |
|
||||
make docker-build-cli
|
||||
|
||||
tests:
|
||||
runs-on: ubuntu-latest
|
||||
needs: pre-checks
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Unshallow
|
||||
run: git fetch --prune --unshallow
|
||||
|
||||
- name: Set up Go
|
||||
uses: actions/setup-go@v2
|
||||
with:
|
||||
go-version: 1.14
|
||||
|
||||
- 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: Kyverno unit test
|
||||
run: |
|
||||
export PROJECT_PATH=$(pwd)
|
||||
make test-all
|
||||
|
||||
|
||||
|
|
58
.github/workflows/image.yaml
vendored
58
.github/workflows/image.yaml
vendored
|
@ -4,7 +4,7 @@ on:
|
|||
branches:
|
||||
- 'main'
|
||||
jobs:
|
||||
push-docker-images:
|
||||
push-init-kyverno:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
|
@ -29,4 +29,58 @@ jobs:
|
|||
|
||||
- name: docker images publish
|
||||
run: |
|
||||
make docker-publish-all
|
||||
make docker-publish-initContainer
|
||||
|
||||
push-kyverno:
|
||||
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@v2
|
||||
with:
|
||||
go-version: 1.14
|
||||
|
||||
- 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
|
||||
|
||||
- name: docker images publish
|
||||
run: |
|
||||
make docker-publish-kyverno
|
||||
|
||||
push-kyverno-cli:
|
||||
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@v2
|
||||
with:
|
||||
go-version: 1.14
|
||||
|
||||
- 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
|
||||
|
||||
- name: docker images publish
|
||||
run: |
|
||||
make docker-publish-cli
|
19
.github/workflows/krew.yaml
vendored
19
.github/workflows/krew.yaml
vendored
|
@ -1,19 +0,0 @@
|
|||
name: release kyverno-cli plugin
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
- 'v*'
|
||||
- '!v*-rc*'
|
||||
|
||||
jobs:
|
||||
release-cli-via-krew:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Unshallow
|
||||
run: git fetch --prune --unshallow
|
||||
|
||||
- name: Update new version in krew-index
|
||||
uses: rajatjindal/krew-release-bot@v0.0.38
|
139
.github/workflows/release.yaml
vendored
139
.github/workflows/release.yaml
vendored
|
@ -3,9 +3,8 @@ on:
|
|||
push:
|
||||
tags:
|
||||
- 'v*'
|
||||
|
||||
jobs:
|
||||
create-release:
|
||||
release-init-kyverno:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
|
@ -43,7 +42,121 @@ jobs:
|
|||
|
||||
- name : docker images publish
|
||||
run: |
|
||||
make docker-publish-all
|
||||
make docker-publish-initContainer
|
||||
|
||||
release-kyverno:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Set up Go
|
||||
uses: actions/setup-go@v2
|
||||
with:
|
||||
go-version: 1.14
|
||||
|
||||
- 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.14
|
||||
- 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
|
||||
|
||||
- name : docker images publish
|
||||
run: |
|
||||
make docker-publish-kyverno
|
||||
|
||||
release-kyverno-cli:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Set up Go
|
||||
uses: actions/setup-go@v2
|
||||
with:
|
||||
go-version: 1.14
|
||||
|
||||
- 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.14
|
||||
- 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
|
||||
|
||||
- name : docker images publish
|
||||
run: |
|
||||
make docker-publish-cli
|
||||
|
||||
create-release:
|
||||
runs-on: ubuntu-latest
|
||||
needs:
|
||||
- release-init-kyverno
|
||||
- release-kyverno
|
||||
- release-kyverno-cli
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Set up Go
|
||||
uses: actions/setup-go@v2
|
||||
with:
|
||||
go-version: 1.14
|
||||
|
||||
- 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.14
|
||||
- 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: Run GoReleaser
|
||||
uses: goreleaser/goreleaser-action@v2
|
||||
|
@ -68,3 +181,23 @@ jobs:
|
|||
env:
|
||||
CR_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
|
||||
|
||||
release-cli-via-krew:
|
||||
runs-on: ubuntu-latest
|
||||
needs: create-release
|
||||
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
|
||||
|
|
Loading…
Add table
Reference in a new issue