Skip to content

Commit c7b9836

Browse files
abhishekdwivedi3060prafull01Yandu Oppacher
authored
Merge cert-manager-feature-branch into master (#166)
Co-authored-by: Prafull Ladha <prafull.ladha@gmail.com> Co-authored-by: Yandu Oppacher <yandu@cockroachlabs.com>
1 parent 5db5bd2 commit c7b9836

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+7103
-204
lines changed

.github/workflows/build.yaml

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
name: Helm Chart Build
2+
on:
3+
push:
4+
branches:
5+
- 'master'
6+
- 'cert-manager-feature-branch'
7+
tags:
8+
- 'v*.*.*'
9+
10+
jobs:
11+
12+
needs-build:
13+
name: is-building-self-signer-utility-required
14+
runs-on: ubuntu-latest
15+
outputs:
16+
tagChange: ${{ steps.changetag.outputs.tagChange }}
17+
steps:
18+
- name: Checkout sources
19+
uses: actions/checkout@v2
20+
with:
21+
fetch-depth: 2
22+
23+
- name: Install yq
24+
run: make install-yq
25+
26+
- name: Check Tag Change
27+
id: changetag
28+
shell: bash
29+
run: |
30+
./build/self-signer-utility.sh
31+
if [[ $? -eq 0 ]]; then
32+
echo ::set-output name=tagChange::true
33+
fi
34+
35+
36+
# Post job to build and push the self signer utility whenever any PR gets merged
37+
post-build:
38+
name: build-self-signer-cert-utility
39+
runs-on: ubuntu-latest
40+
needs: needs-build
41+
if: (needs.needs-build.outputs.tagChange == 'true')
42+
steps:
43+
- name: Checkout sources
44+
uses: actions/checkout@v2
45+
46+
- name: Login to GCR
47+
uses: docker/login-action@v1
48+
with:
49+
registry: gcr.io
50+
username: _json_key
51+
password: ${{ secrets.GCR_HELM_CHART_SA_JSON }}
52+
53+
- name: Build Self-signer
54+
run: make build-self-signer
55+
56+
- name: Push Self-signer
57+
run: make push-self-signer

.github/workflows/ci.yaml

Lines changed: 178 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,178 @@
1+
name: Helm Chart Package CI
2+
on:
3+
pull_request:
4+
branches:
5+
- 'master'
6+
- 'cert-manager-feature-branch'
7+
8+
jobs:
9+
10+
11+
detect-self-signer-change:
12+
name: is-self-signer-changed
13+
runs-on: ubuntu-latest
14+
outputs:
15+
certUtility: ${{ steps.filter.outputs.certUtility }}
16+
steps:
17+
- name: Checkout sources
18+
uses: actions/checkout@v2
19+
with:
20+
fetch-depth: 2
21+
ref: ${{github.event.pull_request.head.ref}}
22+
repository: ${{github.event.pull_request.head.repo.full_name}}
23+
24+
- name: Verify Changed files
25+
uses: dorny/paths-filter@v2
26+
id: filter
27+
with:
28+
filters: |
29+
certUtility: &certUtility
30+
- 'pkg/**'
31+
- 'cmd/**'
32+
33+
# pre job run golangci-lint
34+
go-lint:
35+
name: 'Golint'
36+
runs-on: ubuntu-latest
37+
needs: detect-self-signer-change
38+
if: (needs.detect-self-signer-change.outputs.certUtility == 'true')
39+
steps:
40+
- name: Checkout sources
41+
uses: actions/checkout@v2
42+
with:
43+
ref: ${{github.event.pull_request.head.ref}}
44+
repository: ${{github.event.pull_request.head.repo.full_name}}
45+
46+
- name: Run golangci-lint
47+
uses: golangci/golangci-lint-action@v2
48+
with:
49+
version: v1.30
50+
working-directory: .
51+
args: --timeout=5m
52+
53+
# pre job to run helm lint
54+
helm:
55+
name: HelmLint
56+
runs-on: ubuntu-20.04
57+
steps:
58+
- name: Checkout sources
59+
uses: actions/checkout@v2
60+
with:
61+
ref: ${{github.event.pull_request.head.ref}}
62+
repository: ${{github.event.pull_request.head.repo.full_name}}
63+
64+
- name: Get repositories
65+
uses: hiberbee/github-action-helm@latest
66+
67+
- name: Lint chart
68+
run: helm lint cockroachdb
69+
working-directory: .
70+
71+
# pre job to run the unit tests
72+
unitTest:
73+
name: UnitTest
74+
runs-on: ubuntu-latest
75+
steps:
76+
- name: Checkout sources
77+
uses: actions/checkout@v2
78+
with:
79+
ref: ${{github.event.pull_request.head.ref}}
80+
repository: ${{github.event.pull_request.head.repo.full_name}}
81+
82+
- name: Setup Go
83+
uses: actions/setup-go@v2
84+
with:
85+
go-version: 1.15
86+
87+
- name: Install cockroach binary
88+
run: make install-cockroach
89+
90+
- name: HelmTemplate
91+
run: go test -v ./tests/template/...
92+
93+
- name: Unit
94+
run: go test -v ./pkg/...
95+
96+
self-signer-tag-change:
97+
name: Tag Change
98+
runs-on: ubuntu-latest
99+
needs: detect-self-signer-change
100+
if: (needs.detect-self-signer-change.outputs.certUtility == 'true')
101+
steps:
102+
- name: Checkout
103+
uses: actions/checkout@v2
104+
with:
105+
fetch-depth: 2
106+
ref: ${{github.event.pull_request.head.ref}}
107+
repository: ${{github.event.pull_request.head.repo.full_name}}
108+
109+
- name: Install yq
110+
run: make install-yq
111+
112+
- name: Verify tag change
113+
run: |
114+
./build/self-signer-utility.sh
115+
if [[ $? -ne 0 ]]; then
116+
exit 1
117+
fi
118+
119+
# pre job to run helm e2e tests
120+
helm-install-e2e:
121+
name: Helm-E2E-Test
122+
runs-on: ubuntu-latest
123+
steps:
124+
- name: Checkout sources
125+
uses: actions/checkout@v2
126+
with:
127+
ref: ${{github.event.pull_request.head.ref}}
128+
repository: ${{github.event.pull_request.head.repo.full_name}}
129+
130+
- name: Install Kind
131+
uses: helm/kind-action@v1.2.0
132+
133+
- name: Install cockroach binary
134+
run: make install-cockroach
135+
136+
- name: Build Self-signer
137+
run: make build-self-signer
138+
139+
- name: Load docker images to kind
140+
run: make load-docker-image-to-kind
141+
142+
- name: Setup Go
143+
uses: actions/setup-go@v2
144+
with:
145+
go-version: 1.15
146+
147+
- name: Run E2E Test
148+
run: go test -v ./tests/e2e/install/...
149+
150+
helm-rotate-cert-e2e:
151+
name: Helm-rotate-cert-Test
152+
runs-on: ubuntu-latest
153+
steps:
154+
- name: Checkout sources
155+
uses: actions/checkout@v2
156+
with:
157+
ref: ${{github.event.pull_request.head.ref}}
158+
repository: ${{github.event.pull_request.head.repo.full_name}}
159+
160+
- name: Install Kind
161+
uses: helm/kind-action@v1.2.0
162+
163+
- name: Install cockroach binary
164+
run: make install-cockroach
165+
166+
- name: Build Self-signer
167+
run: make build-self-signer
168+
169+
- name: Load docker images to kind
170+
run: make load-docker-image-to-kind
171+
172+
- name: Setup Go
173+
uses: actions/setup-go@v2
174+
with:
175+
go-version: 1.15
176+
177+
- name: Run E2E Test
178+
run: go test -v ./tests/e2e/rotate/...

Makefile

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
REPOSITORY ?= gcr.io/cockroachlabs-helm-charts/cockroach-self-signer-cert
2+
13
.DEFAULT_GOAL := all
24
all: build
35

@@ -16,3 +18,33 @@ release:
1618
.PHONY: clean
1719
clean:
1820
rm -r build/artifacts/
21+
22+
get-tag: install-yq
23+
yq r ./cockroachdb/values.yaml 'tls.selfSigner.image.tag'
24+
25+
build-self-signer: install-yq
26+
$(eval TAG=$(shell yq r ./cockroachdb/values.yaml 'tls.selfSigner.image.tag'))
27+
docker build -f build/docker-image/Dockerfile -t ${REPOSITORY}:${TAG} .
28+
29+
push-self-signer:
30+
$(eval TAG=$(shell yq r ./cockroachdb/values.yaml 'tls.selfSigner.image.tag'))
31+
docker push ${REPOSITORY}:${TAG}
32+
33+
install-yq:
34+
curl -Lo yq https://github.com/mikefarah/yq/releases/download/2.2.1/yq_linux_amd64 && \
35+
chmod +x yq && sudo mv yq /usr/bin/
36+
37+
install-cockroach:
38+
sudo apt-get install wget -y
39+
wget https://binaries.cockroachdb.com/cockroach-v20.2.5.linux-amd64.tgz
40+
tar zxf cockroach-v20.2.5.linux-amd64.tgz
41+
sudo cp cockroach-v20.2.5.linux-amd64/cockroach /usr/local/bin/
42+
43+
load-docker-image-to-kind:
44+
$(eval TAG=$(shell yq r ./cockroachdb/values.yaml 'tls.selfSigner.image.tag'))
45+
wget https://kind.sigs.k8s.io/dl/v0.11.1/kind-linux-amd64
46+
sudo mv kind-linux-amd64 /usr/local/bin/kind
47+
sudo chmod +x /usr/local/bin/kind
48+
docker pull cockroachdb/cockroach:v21.1.1
49+
kind load docker-image ${REPOSITORY}:${TAG} --name chart-testing
50+
kind load docker-image cockroachdb/cockroach:v21.1.1 --name chart-testing

0 commit comments

Comments
 (0)