mirror of
https://github.com/kyverno/kyverno.git
synced 2024-12-14 11:57:48 +00:00
Improve github action (#1385)
* Improve github action Improve the github action fix issue Trigger Krew on relese and skip prerelease Updated create infrastructure script * More changes * More changes * Added check for prerelease * Added check for prerelease * Revert change
This commit is contained in:
parent
6e25ef8af3
commit
5ecdfda4e0
8 changed files with 115 additions and 125 deletions
42
.github/workflows/build.yaml
vendored
42
.github/workflows/build.yaml
vendored
|
@ -8,38 +8,38 @@ on:
|
|||
- 'main'
|
||||
|
||||
jobs:
|
||||
releaser:
|
||||
build-kyverno:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
-
|
||||
name: Checkout
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
-
|
||||
name: Unshallow
|
||||
|
||||
- name: Unshallow
|
||||
run: git fetch --prune --unshallow
|
||||
-
|
||||
name: Set up Go
|
||||
|
||||
- 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: golangci-lint
|
||||
uses: reviewdog/action-golangci-lint@v1
|
||||
|
||||
- name: docker images build
|
||||
run: |
|
||||
make docker-build-all
|
||||
|
||||
- name : Create Kind Cluster and setup kustomize
|
||||
- name: Kyverno unit test
|
||||
run: |
|
||||
make ci
|
||||
export PROJECT_PATH=$(pwd)
|
||||
make test-all
|
||||
|
||||
|
||||
- name: e2e testing
|
||||
run: |
|
||||
echo ">>> Install Kyverno"
|
||||
sed 's/imagePullPolicy:.*$/imagePullPolicy: IfNotPresent/g' ${GITHUB_WORKSPACE}/definitions/install.yaml | kubectl apply -f -
|
||||
kubectl apply -f ${GITHUB_WORKSPACE}/definitions/github/rbac.yaml
|
||||
chmod a+x ${GITHUB_WORKSPACE}/scripts/verify-deployment.sh
|
||||
sleep 50
|
||||
echo ">>> Check kyverno"
|
||||
kubectl get pods -n kyverno
|
||||
${GITHUB_WORKSPACE}/scripts/verify-deployment.sh -n kyverno kyverno
|
||||
echo ">>> Run Kyverno e2e test"
|
||||
make test-e2e
|
||||
|
|
66
.github/workflows/e2e.yaml
vendored
Normal file
66
.github/workflows/e2e.yaml
vendored
Normal file
|
@ -0,0 +1,66 @@
|
|||
name: build
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- 'main'
|
||||
paths-ignore:
|
||||
- 'README.md'
|
||||
- 'samples/**'
|
||||
- 'charts/**'
|
||||
- 'documentation/**'
|
||||
pull_request:
|
||||
branches:
|
||||
- 'main'
|
||||
paths-ignore:
|
||||
- 'README.md'
|
||||
- 'samples/**'
|
||||
- 'charts/**'
|
||||
- 'documentation/**'
|
||||
|
||||
jobs:
|
||||
e2e-test:
|
||||
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: 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: golangci-lint
|
||||
uses: reviewdog/action-golangci-lint@v1
|
||||
|
||||
- name: docker images build
|
||||
run: |
|
||||
make docker-build-all
|
||||
|
||||
- name : Create Kind Cluster and setup kustomize
|
||||
run: |
|
||||
make create-e2e-infrastruture
|
||||
|
||||
- name: e2e testing
|
||||
run: |
|
||||
echo ">>> Install Kyverno"
|
||||
sed 's/imagePullPolicy:.*$/imagePullPolicy: IfNotPresent/g' ${GITHUB_WORKSPACE}/definitions/install.yaml | kubectl apply -f -
|
||||
kubectl apply -f ${GITHUB_WORKSPACE}/definitions/github/rbac.yaml
|
||||
chmod a+x ${GITHUB_WORKSPACE}/scripts/verify-deployment.sh
|
||||
sleep 50
|
||||
echo ">>> Check kyverno"
|
||||
kubectl get pods -n kyverno
|
||||
${GITHUB_WORKSPACE}/scripts/verify-deployment.sh -n kyverno kyverno
|
||||
echo ">>> Run Kyverno e2e test"
|
||||
make test-e2e
|
||||
|
2
.github/workflows/image.yaml
vendored
2
.github/workflows/image.yaml
vendored
|
@ -4,7 +4,7 @@ on:
|
|||
branches:
|
||||
- 'main'
|
||||
jobs:
|
||||
push-images:
|
||||
push-docker-images:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
|
|
10
.github/workflows/krew.yaml
vendored
10
.github/workflows/krew.yaml
vendored
|
@ -1,9 +1,8 @@
|
|||
name: prereleaser
|
||||
name: release kyverno-cli plugin
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
- 'v*'
|
||||
- '!v*-rc*'
|
||||
release:
|
||||
types:
|
||||
- published
|
||||
jobs:
|
||||
release-cli-via-krew:
|
||||
runs-on: ubuntu-latest
|
||||
|
@ -15,4 +14,5 @@ jobs:
|
|||
run: git fetch --prune --unshallow
|
||||
|
||||
- name: Update new version in krew-index
|
||||
if: "!github.event.release.prerelease"
|
||||
uses: rajatjindal/krew-release-bot@v0.0.38
|
||||
|
|
51
.github/workflows/release.yaml
vendored
51
.github/workflows/release.yaml
vendored
|
@ -1,18 +1,30 @@
|
|||
name: prereleaser
|
||||
name: releaser
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
- 'v*'
|
||||
|
||||
jobs:
|
||||
docker-and-e2e:
|
||||
create-release:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- 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 Go
|
||||
uses: actions/setup-go@v2
|
||||
|
@ -27,36 +39,6 @@ jobs:
|
|||
run: |
|
||||
make docker-publish-all
|
||||
|
||||
- name : Create Kind Cluster and setup kustomize
|
||||
run: |
|
||||
make ci
|
||||
|
||||
- name: e2e testing
|
||||
run: |
|
||||
echo ">>> Install Kyverno"
|
||||
sed 's/imagePullPolicy:.*$/imagePullPolicy: IfNotPresent/g' ${GITHUB_WORKSPACE}/definitions/install.yaml | kubectl apply -f -
|
||||
kubectl apply -f ${GITHUB_WORKSPACE}/definitions/github/rbac.yaml
|
||||
chmod a+x ${GITHUB_WORKSPACE}/scripts/verify-deployment.sh
|
||||
sleep 50
|
||||
echo ">>> Check kyverno"
|
||||
kubectl get pods -n kyverno
|
||||
${GITHUB_WORKSPACE}/scripts/verify-deployment.sh -n kyverno kyverno
|
||||
echo ">>> Run Kyverno e2e test"
|
||||
make test-e2e
|
||||
|
||||
create-release:
|
||||
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: Run GoReleaser
|
||||
uses: goreleaser/goreleaser-action@v2
|
||||
with:
|
||||
|
@ -79,3 +61,4 @@ jobs:
|
|||
uses: helm/chart-releaser-action@v1.1.0
|
||||
env:
|
||||
CR_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
|
||||
|
||||
|
|
58
.github/workflows/test.yaml
vendored
58
.github/workflows/test.yaml
vendored
|
@ -1,58 +0,0 @@
|
|||
name: test
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
pull_request:
|
||||
branches:
|
||||
- main
|
||||
|
||||
|
||||
jobs:
|
||||
releaser:
|
||||
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: 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: golangci-lint
|
||||
uses: reviewdog/action-golangci-lint@v1
|
||||
-
|
||||
name: Go Get
|
||||
run: |
|
||||
go get ./...
|
||||
-
|
||||
name: Build
|
||||
run: |
|
||||
make initContainer
|
||||
make kyverno
|
||||
-
|
||||
name: Run GoReleaser
|
||||
uses: goreleaser/goreleaser-action@v2
|
||||
with:
|
||||
version: latest
|
||||
args: --rm-dist --skip-publish --snapshot
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
-
|
||||
name: Kyverno Test
|
||||
run: |
|
||||
export PROJECT_PATH=$(pwd)
|
||||
make test-all
|
9
Makefile
9
Makefile
|
@ -116,13 +116,12 @@ docker-build-all: docker-build-initContainer docker-build-kyverno docker-build-c
|
|||
docker-tag-all: docker-tag-repo-initContainer docker-tag-repo-kyverno docker-tag-repo-cli
|
||||
|
||||
##################################
|
||||
# CI Testing
|
||||
# Create e2e Infrastruture
|
||||
##################################
|
||||
|
||||
ci:
|
||||
echo "kustomize input"
|
||||
chmod a+x $(PWD)/scripts/ci.sh
|
||||
$(PWD)/scripts/ci.sh
|
||||
create-e2e-infrastruture:
|
||||
chmod a+x $(PWD)/scripts/create-e2e-infrastruture.sh
|
||||
$(PWD)/scripts/create-e2e-infrastruture.sh
|
||||
|
||||
|
||||
##################################
|
||||
|
|
|
@ -20,4 +20,4 @@ echo "Installing kustomize"
|
|||
curl -s "https://raw.githubusercontent.com/kubernetes-sigs/kustomize/master/hack/install_kustomize.sh" | bash
|
||||
kustomize edit set image ghcr.io/kyverno/kyverno:$hash
|
||||
kustomize edit set image ghcr.io/kyverno/kyvernopre:$hash
|
||||
kustomize build $pwd/definitions/ > $pwd/definitions/install.yaml
|
||||
kustomize build $pwd/definitions/ -o $pwd/definitions/install.yaml
|
Loading…
Reference in a new issue