Skip to content

Commit eb6cebc

Browse files
committed
Onboard GitHub workflows
Signed-off-by: Mike Ng <ming@redhat.com>
1 parent a72d308 commit eb6cebc

File tree

7 files changed

+268
-0
lines changed

7 files changed

+268
-0
lines changed
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
---
2+
name: Bug report
3+
about: Create a bug report
4+
title: ''
5+
labels: bug
6+
assignees: ''
7+
8+
---
9+
10+
**Describe the bug**
11+
A clear and concise description of what the bug is.
12+
13+
**To Reproduce**
14+
Steps to reproduce the behavior:
15+
16+
**Expected behavior**
17+
A clear and concise description of what you expected to happen.
18+
19+
**Environment ie: Kubernetes version:**
20+
21+
**Additional context**
22+
Add any other context about the problem here.
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
---
2+
name: Other report
3+
about: Non bug related issue
4+
title: ''
5+
labels: ''
6+
assignees: ''
7+
8+
---

.github/workflows/dco.yml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
name: DCO
2+
on:
3+
workflow_dispatch: {}
4+
pull_request:
5+
branches:
6+
- main
7+
8+
jobs:
9+
dco_check:
10+
runs-on: ubuntu-latest
11+
name: DCO Check
12+
steps:
13+
- name: Get PR Commits
14+
id: 'get-pr-commits'
15+
uses: tim-actions/get-pr-commits@master
16+
with:
17+
token: ${{ secrets.GITHUB_TOKEN }}
18+
- name: DCO Check
19+
uses: tim-actions/dco@master
20+
with:
21+
commits: ${{ steps.get-pr-commits.outputs.commits }}

.github/workflows/fossa.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
name: FOSSA License Scan
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
workflow_dispatch: {}
8+
9+
jobs:
10+
fossa-scan:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- name: Checkout Repo
14+
uses: actions/checkout@v3
15+
- name: Run FOSSA Scan
16+
uses: fossas/fossa-action@v1
17+
with:
18+
api-key: ${{ secrets.FOSSA_API_KEY }}
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
name: GoPostSubmit
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
workflow_dispatch: {}
8+
9+
env:
10+
# Common versions
11+
GO_VERSION: '1.20'
12+
GO_REQUIRED_MIN_VERSION: ''
13+
GOPATH: '/home/runner/work/cluster-permission/cluster-permission/go'
14+
defaults:
15+
run:
16+
working-directory: go/src/github.com/open-cluster-management/cluster-permission
17+
18+
jobs:
19+
images:
20+
name: images
21+
runs-on: ubuntu-latest
22+
steps:
23+
- name: checkout code
24+
uses: actions/checkout@v3
25+
with:
26+
fetch-depth: 1
27+
path: go/src/github.com/open-cluster-management/cluster-permission
28+
- name: install Go
29+
uses: actions/setup-go@v3
30+
with:
31+
go-version: ${{ env.GO_VERSION }}
32+
- name: install imagebuilder
33+
run: go install github.com/openshift/imagebuilder/cmd/imagebuilder@v1.2.3
34+
- name: images
35+
run: make docker-build
36+
- name: push
37+
run: |
38+
echo ${{ secrets.DOCKER_PASSWORD }} | docker login quay.io --username ${{ secrets.DOCKER_USER }} --password-stdin
39+
docker push quay.io/open-cluster-management/cluster-permission:latest

.github/workflows/go-presubmit.yml

Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
name: Go
2+
3+
on:
4+
workflow_dispatch: {}
5+
pull_request:
6+
branches:
7+
- main
8+
9+
env:
10+
# Common versions
11+
GO_VERSION: '1.20'
12+
GO_REQUIRED_MIN_VERSION: ''
13+
GOPATH: '/home/runner/work/cluster-permission/cluster-permission/go'
14+
defaults:
15+
run:
16+
working-directory: go/src/github.com/open-cluster-management/cluster-permission
17+
18+
jobs:
19+
build:
20+
name: build
21+
runs-on: ubuntu-latest
22+
steps:
23+
- name: checkout code
24+
uses: actions/checkout@v3
25+
with:
26+
fetch-depth: 1
27+
path: go/src/github.com/open-cluster-management/cluster-permission
28+
- name: install Go
29+
uses: actions/setup-go@v3
30+
with:
31+
go-version: ${{ env.GO_VERSION }}
32+
- name: build
33+
run: make build
34+
35+
images:
36+
name: images
37+
runs-on: ubuntu-latest
38+
steps:
39+
- name: checkout code
40+
uses: actions/checkout@v3
41+
with:
42+
fetch-depth: 1
43+
path: go/src/github.com/open-cluster-management/cluster-permission
44+
- name: install Go
45+
uses: actions/setup-go@v3
46+
with:
47+
go-version: ${{ env.GO_VERSION }}
48+
- name: install imagebuilder
49+
run: go install github.com/openshift/imagebuilder/cmd/imagebuilder@v1.2.3
50+
- name: images
51+
run: make docker-build
52+
53+
test:
54+
name: test
55+
runs-on: ubuntu-latest
56+
steps:
57+
- name: checkout code
58+
uses: actions/checkout@v3
59+
with:
60+
fetch-depth: 1
61+
path: go/src/github.com/open-cluster-management/cluster-permission
62+
- name: install Go
63+
uses: actions/setup-go@v3
64+
with:
65+
go-version: ${{ env.GO_VERSION }}
66+
- name: test
67+
run: make test
68+
69+
e2e:
70+
name: e2e
71+
runs-on: ubuntu-latest
72+
steps:
73+
- name: checkout code
74+
uses: actions/checkout@v3
75+
with:
76+
fetch-depth: 1
77+
path: go/src/github.com/open-cluster-management/cluster-permission
78+
- name: install Go
79+
uses: actions/setup-go@v3
80+
with:
81+
go-version: ${{ env.GO_VERSION }}
82+
- name: install imagebuilder
83+
run: go install github.com/openshift/imagebuilder/cmd/imagebuilder@v1.2.3
84+
- name: images
85+
run: make docker-build
86+
- name: setup kind
87+
uses: engineerd/setup-kind@v0.5.0
88+
with:
89+
version: v0.14.0
90+
name: cluster1
91+
- name: setup kind
92+
uses: engineerd/setup-kind@v0.5.0
93+
with:
94+
version: v0.14.0
95+
name: hub
96+
- name: Load image on the nodes of the cluster
97+
run: |
98+
kind load docker-image --name=hub quay.io/open-cluster-management/cluster-permission:latest
99+
- name: Run e2e test
100+
run: |
101+
make test-e2e
102+
env:
103+
KUBECONFIG: /home/runner/.kube/config

.github/workflows/go-release.yml

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
name: GoRelease
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*.*.*'
7+
env:
8+
# Common versions
9+
GO_VERSION: '1.20'
10+
GO_REQUIRED_MIN_VERSION: ''
11+
GOPATH: '/home/runner/work/cluster-permission/cluster-permission/go'
12+
GITHUB_REF: ${{ github.ref }}
13+
14+
defaults:
15+
run:
16+
working-directory: go/src/open-cluster-management.io/cluster-permission
17+
18+
jobs:
19+
release:
20+
name: release
21+
runs-on: ubuntu-latest
22+
steps:
23+
- name: checkout code
24+
uses: actions/checkout@v3
25+
with:
26+
fetch-depth: 1
27+
path: go/src/open-cluster-management.io/cluster-permission
28+
- name: install Go
29+
uses: actions/setup-go@v3
30+
with:
31+
go-version: ${{ env.GO_VERSION }}
32+
- name: install imagebuilder
33+
run: go install github.com/openshift/imagebuilder/cmd/imagebuilder@v1.2.3
34+
- name: images
35+
run: make docker-build
36+
- name: get release version
37+
run: |
38+
echo "RELEASE_VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV
39+
- name: get major release version
40+
run: |
41+
echo "MAJOR_RELEASE_VERSION=${RELEASE_VERSION%.*}" >> $GITHUB_ENV
42+
- name: push image
43+
run: |
44+
echo ${{ secrets.DOCKER_PASSWORD }} | docker login quay.io --username ${{ secrets.DOCKER_USER }} --password-stdin
45+
docker tag quay.io/open-cluster-management/cluster-permission:latest quay.io/open-cluster-management/cluster-permission:$RELEASE_VERSION
46+
docker push quay.io/open-cluster-management/cluster-permission:$RELEASE_VERSION
47+
- name: generate changelog
48+
run: |
49+
echo "# cluster-permission $RELEASE_VERSION" > /home/runner/work/changelog.txt
50+
echo "- See the [CHANGELOG](https://github.com/open-cluster-management-io/cluster-permission/blob/main/CHANGELOG/CHANGELOG-${MAJOR_RELEASE_VERSION}.md) for more details." >> /home/runner/work/changelog.txt
51+
echo "- The released image is quay.io/open-cluster-management/cluster-permission:$RELEASE_VERSION" >> /home/runner/work/changelog.txt
52+
- name: publish release
53+
uses: softprops/action-gh-release@v0.1.5
54+
env:
55+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
56+
with:
57+
body_path: /home/runner/work/changelog.txt

0 commit comments

Comments
 (0)