forked from secureCodeBox/secureCodeBox
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTaskfile.yaml
More file actions
110 lines (96 loc) · 4.21 KB
/
Taskfile.yaml
File metadata and controls
110 lines (96 loc) · 4.21 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
# SPDX-FileCopyrightText: the secureCodeBox authors
#
# SPDX-License-Identifier: Apache-2.0
version: "3.44.0"
env:
IMG_NS: securecodebox
IMG_TAG:
sh: 'echo "sha-$(git rev-parse --short HEAD)"'
tasks:
create-kind-cluster:
cmds:
- 'echo "Starting kind cluster for testing environment"'
- kind create cluster --name testing-env
status:
- kind get clusters | grep testing-env || exit 1
build-operator-image:
cmds:
- 'echo "Building operator image with tag ${IMG_TAG}"'
- docker build -t ${IMG_NS}/operator:${IMG_TAG} {{ .TASKFILE_DIR }}/operator
status:
- docker images | grep "${IMG_NS}/operator" | grep "${IMG_TAG}"
build-lurker-image:
cmds:
- 'echo "Building lurker image with tag ${IMG_TAG}"'
- docker build -t ${IMG_NS}/lurker:${IMG_TAG} {{ .TASKFILE_DIR }}/lurker
status:
- docker images | grep "${IMG_NS}/lurker" | grep "${IMG_TAG}"
load-operator-image:
deps: [build-operator-image]
cmds:
- kind load docker-image ${IMG_NS}/operator:${IMG_TAG} --name testing-env
status:
- kind get images --name testing-env | grep "${IMG_NS}/operator:${IMG_TAG}" || exit 1
load-lurker-image:
deps: [build-lurker-image]
cmds:
- kind load docker-image ${IMG_NS}/lurker:${IMG_TAG} --name testing-env
status:
- kind get images --name testing-env | grep "${IMG_NS}/lurker:${IMG_TAG}" || exit 1
deploy-operator:
deps: [load-operator-image, load-lurker-image]
cmds:
- 'echo "Deploying secureCodeBox operator to the testing environment"'
- kubectl config use-context kind-testing-env
- kubectl create namespace integration-tests || true
- |
helm -n securecodebox-system upgrade --create-namespace --install securecodebox-operator {{ .TASKFILE_DIR }}/operator --wait \
--set="image.repository=docker.io/${IMG_NS}/operator" \
--set="image.tag=${IMG_TAG}" \
--set="image.pullPolicy=IfNotPresent" \
--set="lurker.image.repository=docker.io/${IMG_NS}/lurker" \
--set="lurker.image.tag=${IMG_TAG}" \
--set="lurker.image.pullPolicy=IfNotPresent"
status:
- kubectl get deployment -n securecodebox-system securecodebox-controller-manager | grep "1/1" || false
build-parser-sdk-image:
cmds:
- 'echo "Building parser-sdk images with tag ${IMG_TAG}"'
- docker build -t securecodebox/parser-sdk-nodejs:${IMG_TAG} {{ .TASKFILE_DIR }}/parser-sdk/nodejs
status:
- docker images | grep "securecodebox/parser-sdk-nodejs" | grep "${IMG_TAG}"
build-hook-sdk-image:
cmds:
- 'echo "Building hook-sdk images with tag ${IMG_TAG}"'
- docker build -t securecodebox/hook-sdk-nodejs:${IMG_TAG} {{ .TASKFILE_DIR }}/hook-sdk/nodejs
status:
- docker images | grep "securecodebox/hook-sdk-nodejs" | grep "${IMG_TAG}"
prepare-testing-env:
desc: "Prepare the testing environment by running all required tasks"
cmds:
- task: create-kind-cluster
- task: deploy-operator
cleanup-testing-env:
desc: "Cleanup the testing environment by deleting the kind cluster"
cmds:
- 'echo "Cleaning up testing environment"'
- kind delete cluster --name testing-env
minio-port-forward:
desc: "Port forward the MinIO service to access it locally"
cmds:
- 'echo "Port forwarding MinIO service to localhost:9001"'
- 'echo "You can access MinIO at http://localhost:9001"'
- 'echo "Use the credentials from the secureCodeBox operator to log in:"'
- 'echo "Access Key: $(kubectl get secret -n securecodebox-system securecodebox-operator-minio -o jsonpath="{.data.root-user}" | base64 --decode)"'
- 'echo "Secret Key: $(kubectl get secret -n securecodebox-system securecodebox-operator-minio -o jsonpath="{.data.root-password}" | base64 --decode)"'
- 'echo "Press Ctrl+C to stop port forwarding"'
- kubectl port-forward -n securecodebox-system svc/securecodebox-operator-minio 9001:9001
interactive: true
test:helm:all:
cmds:
- |
find . -name "Chart.yaml" | while read -r chart_file; do
chart_dir=$(dirname "$chart_file")
echo "Running tests for helm chart: $chart_dir"
helm unittest $chart_dir
done