Skip to content

Commit ff34073

Browse files
[Maintenance] Add CircleCI workflow to verify manifests - GT-493 (#1431)
1 parent 73d56f0 commit ff34073

File tree

5 files changed

+207
-66
lines changed

5 files changed

+207
-66
lines changed

.circleci/config.yml

Lines changed: 11 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -1,71 +1,17 @@
11
version: 2.1
2-
orbs:
3-
slack: circleci/slack@4.1
42

5-
executors:
6-
golang-executor:
7-
docker:
8-
- image: gcr.io/gcr-for-testing/golang:1.20.8
3+
orbs:
4+
path-filtering: circleci/path-filtering@1.0.0
95

10-
jobs:
11-
check-code:
12-
executor: golang-executor
13-
steps:
14-
- setup_remote_docker:
15-
docker_layer_caching: true
16-
- checkout
17-
- run:
18-
name: Install deps
19-
command: |
20-
if [ -z "$CIRCLE_PULL_REQUEST" ]; then
21-
make vendor
22-
make tools-min
23-
exit 0
24-
fi
25-
apt-get update
26-
apt-get install -y unzip
27-
make init
28-
- run:
29-
name: License check
30-
command: |
31-
if [ -z "$CIRCLE_PULL_REQUEST" ]; then
32-
echo "This is not a pull request. Skipping..."
33-
exit 0
34-
fi
35-
make license-verify license-range-verify
36-
- run: make fmt-verify
37-
- run: make linter
38-
- run:
39-
name: Unit tests
40-
command: |
41-
if [ -z "$CIRCLE_PULL_REQUEST" ]; then
42-
echo "This is not a pull request. Skipping..."
43-
exit 0
44-
fi
45-
make run-unit-tests
46-
- run:
47-
name: make bin
48-
command: |
49-
if [ -z "$CIRCLE_PULL_REQUEST" ]; then
50-
echo "This is not a pull request. Skipping..."
51-
exit 0
52-
fi
53-
make bin
54-
- run:
55-
name: vulncheck
56-
command: |
57-
if [ -z "$CIRCLE_PULL_REQUEST" ]; then
58-
echo "This is not a pull request. Skipping..."
59-
exit 0
60-
fi
61-
make vulncheck
62-
environment:
63-
GO111MODULES: off
6+
setup: true
647

658
workflows:
66-
version: 2
67-
68-
# Default workflow
69-
run_tests:
9+
always-run:
7010
jobs:
71-
- check-code
11+
- path-filtering/filter:
12+
name: check-updated-files
13+
base-revision: master
14+
config-path: .circleci/continue_config.yml
15+
mapping: |
16+
manifests/.* manifests-verify true
17+
chart/.* manifests-verify true

.circleci/continue_config.yml

Lines changed: 118 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,118 @@
1+
version: 2.1
2+
orbs:
3+
slack: circleci/slack@4.1
4+
5+
parameters:
6+
manifests-verify:
7+
type: boolean
8+
default: false
9+
minikube-version:
10+
type: string
11+
default: v1.31.2
12+
helm-version:
13+
type: string
14+
default: v3.13.0
15+
16+
executors:
17+
golang-executor:
18+
docker:
19+
- image: gcr.io/gcr-for-testing/golang:1.20.8
20+
machine-executor:
21+
machine:
22+
image: ubuntu-2204:current
23+
docker_layer_caching: true
24+
25+
jobs:
26+
check-code:
27+
executor: golang-executor
28+
steps:
29+
- setup_remote_docker:
30+
docker_layer_caching: true
31+
- checkout
32+
- run:
33+
name: Install deps
34+
command: |
35+
if [ -z "$CIRCLE_PULL_REQUEST" ]; then
36+
make vendor
37+
make tools-min
38+
exit 0
39+
fi
40+
apt-get update
41+
apt-get install -y unzip
42+
make init
43+
- run:
44+
name: License check
45+
command: |
46+
if [ -z "$CIRCLE_PULL_REQUEST" ]; then
47+
echo "This is not a pull request. Skipping..."
48+
exit 0
49+
fi
50+
make license-verify license-range-verify
51+
- run: make fmt-verify
52+
- run: make linter
53+
- run:
54+
name: Unit tests
55+
command: |
56+
if [ -z "$CIRCLE_PULL_REQUEST" ]; then
57+
echo "This is not a pull request. Skipping..."
58+
exit 0
59+
fi
60+
make run-unit-tests
61+
- run:
62+
name: make bin
63+
command: |
64+
if [ -z "$CIRCLE_PULL_REQUEST" ]; then
65+
echo "This is not a pull request. Skipping..."
66+
exit 0
67+
fi
68+
make bin
69+
- run:
70+
name: vulncheck
71+
command: |
72+
if [ -z "$CIRCLE_PULL_REQUEST" ]; then
73+
echo "This is not a pull request. Skipping..."
74+
exit 0
75+
fi
76+
make vulncheck
77+
environment:
78+
GO111MODULES: off
79+
80+
manifests_verify:
81+
executor: machine-executor
82+
steps:
83+
- checkout
84+
- run:
85+
name: Install Kubectl Executable
86+
command: |-
87+
curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl" &&
88+
chmod +x kubectl &&
89+
sudo mv kubectl /usr/local/bin/
90+
mkdir -p ${HOME}/.kube && touch ${HOME}/.kube/config
91+
- run:
92+
name: Install Minikube Executable
93+
command: |-
94+
curl -Lo minikube https://github.com/kubernetes/minikube/releases/download/<< pipeline.parameters.minikube-version >>/minikube-linux-amd64 &&
95+
chmod +x minikube &&
96+
sudo mv minikube /usr/local/bin/
97+
- run:
98+
name: Install Helm Service
99+
command: |-
100+
export DESIRED_VERSION=<< pipeline.parameters.helm-version >>
101+
curl https://raw.githubusercontent.com/helm/helm/master/scripts/get | bash
102+
- run:
103+
command: make manifests
104+
- run:
105+
command: make manifests-verify
106+
107+
workflows:
108+
version: 2
109+
110+
run_tests:
111+
jobs:
112+
- check-code
113+
114+
manifests-verify:
115+
when:
116+
equal: [ true, << pipeline.parameters.manifests-verify >> ]
117+
jobs:
118+
- manifests_verify

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,5 @@ deps/
1212
enterprise.mk
1313
license-header.enterprise.txt
1414
local/
15+
kustomize_test/
1516
tools/codegen/boilerplate.go.txt

Makefile

Lines changed: 73 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ UPPER_ENV = $(shell echo '$1' | tr '[:lower:]' '[:upper:]' | tr -d '-')
7171
.PHONY: helm
7272
helm:
7373
ifeq ($(HELM),)
74-
$(error Before templating you need to install helm in PATH or export helm binary using "export HELM=<path to helm>")
74+
$(error "Before templating you need to install helm in PATH or export helm binary using 'export HELM=<path to helm>'")
7575
endif
7676

7777
HELM_OPTIONS = --set "operator.image=$(OPERATORIMAGE)" \
@@ -538,6 +538,78 @@ chart-operator: helm
538538

539539
manifests: chart-operator
540540

541+
.PHONY: manifests-verify
542+
manifests-verify:
543+
$(MAKE) manifest-verify-plain-ce
544+
$(MAKE) manifest-verify-plain-ee
545+
$(MAKE) manifest-verify-kustomize-ce
546+
$(MAKE) manifest-verify-kustomize-ee
547+
$(MAKE) manifest-verify-helm-ce
548+
$(MAKE) manifest-verify-helm-ee
549+
550+
manifests-verify-env-reset:
551+
@minikube delete && minikube start
552+
553+
manifest-verify-plain-ce: manifests-verify-env-reset
554+
@echo "Trying to install via plain manifests"
555+
kubectl apply -f ./manifests/arango-all.yaml
556+
kubectl apply -f ./manifests/arango-apps.yaml
557+
kubectl apply -f ./manifests/arango-backup.yaml
558+
kubectl apply -f ./manifests/arango-crd.yaml
559+
kubectl apply -f ./manifests/arango-deployment.yaml
560+
kubectl apply -f ./manifests/arango-deployment-replication.yaml
561+
kubectl apply -f ./manifests/arango-k2kclustersync.yaml
562+
kubectl apply -f ./manifests/arango-storage.yaml
563+
564+
manifest-verify-plain-ee: manifests-verify-env-reset
565+
kubectl apply -f ./manifests/enterprise-all.yaml
566+
kubectl apply -f ./manifests/enterprise-apps.yaml
567+
kubectl apply -f ./manifests/enterprise-backup.yaml
568+
kubectl apply -f ./manifests/enterprise-crd.yaml
569+
kubectl apply -f ./manifests/enterprise-deployment.yaml
570+
kubectl apply -f ./manifests/enterprise-deployment-replication.yaml
571+
kubectl apply -f ./manifests/enterprise-k2kclustersync.yaml
572+
kubectl apply -f ./manifests/enterprise-storage.yaml
573+
574+
define KUSTOMIZE_YAML =
575+
apiVersion: kustomize.config.k8s.io/v1beta1
576+
kind: Kustomization
577+
resources:
578+
- ./all
579+
- ./apps
580+
- ./backup
581+
- ./crd
582+
- ./deployment
583+
- ./deployment-replication
584+
- ./k2kclustersync
585+
endef
586+
export KUSTOMIZE_YAML
587+
588+
manifest-verify-kustomize-ce: manifests-verify-env-reset
589+
@echo "Trying to install via Kustomize"
590+
@-rm -rf ./kustomize_test
591+
@cp -r ./manifests/kustomize ./kustomize_test
592+
@echo "$$KUSTOMIZE_YAML" > ./kustomize_test/kustomization.yaml
593+
@kubectl create -k ./kustomize_test/
594+
595+
manifest-verify-kustomize-ee: manifests-verify-env-reset
596+
@echo "Trying to install via Kustomize"
597+
@-rm -rf ./kustomize_test
598+
@cp -r ./manifests/kustomize-enterprise ./kustomize_test
599+
@echo "$$KUSTOMIZE_YAML" > ./kustomize_test/kustomization.yaml
600+
@kubectl create -k ./kustomize_test/
601+
602+
manifest-verify-helm-ce: manifests-verify-env-reset
603+
@echo "Trying to install via Helm charts"
604+
helm install --generate-name --set "operator.features.storage=true" \
605+
./bin/charts/kube-arangodb-$(VERSION_MAJOR_MINOR_PATCH).tgz
606+
607+
manifest-verify-helm-ee: manifests-verify-env-reset
608+
@echo "Trying to install via Helm charts"
609+
helm install --generate-name --set "operator.image=arangodb/kube-arangodb-enterprise:$(VERSION_MAJOR_MINOR_PATCH)" --set "operator.features.storage=true" \
610+
./bin/charts/kube-arangodb-$(VERSION_MAJOR_MINOR_PATCH).tgz
611+
612+
541613
# Testing
542614

543615
.PHONY: run-unit-tests
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
apiVersion: kustomize.config.k8s.io/v1beta1
2+
kind: Kustomization
3+
resources:
4+
- enterprise-k2kclustersync.yaml

0 commit comments

Comments
 (0)