Skip to content

Commit

Permalink
Adding parallel GitHub pipeline to reduce the build time (#1635)
Browse files Browse the repository at this point in the history
* 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>
  • Loading branch information
imrajdas committed Feb 22, 2021
1 parent e3a8c50 commit 7a1629a
Show file tree
Hide file tree
Showing 4 changed files with 313 additions and 35 deletions.
132 changes: 121 additions & 11 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ on:
- 'main'

jobs:
build-kyverno:
pre-checks:
runs-on: ubuntu-latest
steps:
- name: Checkout
Expand All @@ -32,17 +32,73 @@ 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
with:
install: true

- name: docker images build
run: |
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
Expand All @@ -51,11 +107,65 @@ jobs:

- name: docker images build
run: |
make docker-build-all
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 changes: 56 additions & 2 deletions .github/workflows/image.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ on:
branches:
- 'main'
jobs:
push-docker-images:
push-init-kyverno:
runs-on: ubuntu-latest
steps:
- name: Checkout
Expand All @@ -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 changes: 0 additions & 19 deletions .github/workflows/krew.yaml

This file was deleted.

0 comments on commit 7a1629a

Please sign in to comment.