-
Notifications
You must be signed in to change notification settings - Fork 47
/
build-push-e2e-catalog.sh
executable file
·65 lines (56 loc) · 1.77 KB
/
build-push-e2e-catalog.sh
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
#! /bin/bash
set -o errexit
set -o nounset
set -o pipefail
help="
build-push-e2e-catalog.sh is a script to build and push the e2e catalog image using kaniko.
Usage:
build-push-e2e-catalog.sh [NAMESPACE] [TAG]
Argument Descriptions:
- NAMESPACE is the namespace the kaniko Job should be created in
- TAG is the full tag used to build and push the catalog image
"
if [[ "$#" -ne 2 ]]; then
echo "Illegal number of arguments passed"
echo "${help}"
exit 1
fi
namespace=$1
tag=$2
echo "${namespace}" "${tag}"
kubectl create configmap -n "${namespace}" --from-file=testdata/catalogs/test-catalog.Dockerfile operator-controller-e2e.dockerfile
kubectl create configmap -n "${namespace}" --from-file=testdata/catalogs/test-catalog operator-controller-e2e.build-contents
kubectl apply -f - << EOF
apiVersion: batch/v1
kind: Job
metadata:
name: kaniko
namespace: "${namespace}"
spec:
template:
spec:
containers:
- name: kaniko
image: gcr.io/kaniko-project/executor:latest
args: ["--dockerfile=/workspace/test-catalog.Dockerfile",
"--context=/workspace/",
"--destination=${tag}",
"--skip-tls-verify"]
volumeMounts:
- name: dockerfile
mountPath: /workspace/
- name: build-contents
mountPath: /workspace/test-catalog/
restartPolicy: Never
volumes:
- name: dockerfile
configMap:
name: operator-controller-e2e.dockerfile
items:
- key: test-catalog.Dockerfile
path: test-catalog.Dockerfile
- name: build-contents
configMap:
name: operator-controller-e2e.build-contents
EOF
kubectl wait --for=condition=Complete -n "${namespace}" jobs/kaniko --timeout=60s