1
1
#! /usr/bin/env bash
2
2
3
- set -x
4
-
5
3
# Load bingo tools for kind
6
4
source .bingo/variables.env
7
5
@@ -14,8 +12,9 @@ SAVE=false
14
12
CONTAINER_RUNTIME=docker
15
13
REGISTRY=quay.io/olmtest
16
14
TARGET_BRANCH=master
17
- JUST_CHECK =false
15
+ CHECK =false
18
16
LOAD_KIND=false
17
+ BUILD=true
19
18
20
19
while [ $# -gt 0 ]; do
21
20
case " $1 " in
@@ -29,7 +28,7 @@ while [ $# -gt 0 ]; do
29
28
;;
30
29
# check if images need to be updated - won't build or push images
31
30
--check)
32
- JUST_CHECK =" true"
31
+ CHECK =" true"
33
32
;;
34
33
# container runtime to use, e.g. podman (default docker)
35
34
--container-runtime=* )
@@ -49,11 +48,25 @@ while [ $# -gt 0 ]; do
49
48
--save)
50
49
SAVE=" true"
51
50
;;
51
+ --skip-build)
52
+ BUILD=" false"
53
+ ;;
52
54
* )
53
55
printf " *************************\n"
54
56
printf " * Error: Invalid argument.\n"
55
57
# shellcheck disable=SC2059
56
- printf " * Usage: %s [--opm-version=version] [--push=true|false] [--container-runtime=runtime] [--registry=registry] [--target-branch=branch]\n" " $0 "
58
+ printf " * Usage: %s [--opm-version=version] [--check] [--push] [--container-runtime=runtime] [--registry=registry] [--target-branch=branch] [--kind-load] [--save] [--skip-build] \n" " $0 "
59
+ printf " \n"
60
+ printf " \t--opm-version: opm version to build the fixtures against, e.g. 1.39.0\n"
61
+ printf " \t--check: check if images need to be updated - won't build or push images\n"
62
+ printf " \t--push: push images to registry after build\n"
63
+ printf " \t--container-runtime: container runtime to use, e.g. podman (default docker)\n"
64
+ printf " \t--registry: registry to push images (default: quay.io/olmtest)\n"
65
+ printf " \t--target-branch: target branch to compare against when checking for changes (default: master)\n"
66
+ printf " \t--kind-load: load fixture images into kind cluster (default: false)\n"
67
+ printf " \t--save: save images to tar.gz files (default: false)\n"
68
+ printf " \t--skip-build: skip building images - useful if you just want to kind-load/save/push (default: false)\n"
69
+
57
70
printf " *************************\n"
58
71
exit 1
59
72
esac
@@ -80,6 +93,8 @@ function check_changes() {
80
93
fi
81
94
}
82
95
96
+ set -x
97
+
83
98
# Fixtures
84
99
BUNDLE_V1_IMAGE=" ${REGISTRY} /busybox-bundle:1.0.0-${OPM_VERSION} "
85
100
BUNDLE_V1_DEP_IMAGE=" ${REGISTRY} /busybox-dependency-bundle:1.0.0-${OPM_VERSION} "
@@ -92,7 +107,7 @@ INDEX_V2="${REGISTRY}/busybox-dependencies-index:2.0.0-with-ListBundles-method-$
92
107
TEST_CATALOG_IMAGE=" ${REGISTRY} /test-catalog:${OPM_VERSION} "
93
108
94
109
# Prints true if changes are detected, false otherwise
95
- if [ " $JUST_CHECK " = true ]; then
110
+ if [ " CHECK " = true ]; then
96
111
check_changes
97
112
exit 0
98
113
fi
@@ -109,7 +124,26 @@ if [ "$LOAD_KIND" = true ]; then
109
124
exit 0
110
125
fi
111
126
112
- # Assumes images are already built
127
+ if [ " $BUILD " = " true" ]; then
128
+ # Busybox Operator
129
+ # Build bundles
130
+ ${CONTAINER_RUNTIME} build -t " ${BUNDLE_V1_IMAGE} " ./test/images/busybox-index/busybox/1.0.0
131
+ ${CONTAINER_RUNTIME} build -t " ${BUNDLE_V1_DEP_IMAGE} " ./test/images/busybox-index/busybox-dependency/1.0.0
132
+ ${CONTAINER_RUNTIME} build -t " ${BUNDLE_V2_IMAGE} " ./test/images/busybox-index/busybox/2.0.0
133
+ ${CONTAINER_RUNTIME} build -t " ${BUNDLE_V2_DEP_IMAGE} " ./test/images/busybox-index/busybox-dependency/2.0.0
134
+
135
+
136
+ # Build catalogs
137
+ ${CONTAINER_RUNTIME} build -t " ${INDEX_V1} " --build-arg=" OPM_VERSION=v${OPM_VERSION} " --build-arg=" CONFIGS_DIR=indexv1" ./test/images/busybox-index
138
+ ${CONTAINER_RUNTIME} build -t " ${INDEX_V2} " --build-arg=" OPM_VERSION=v${OPM_VERSION} " --build-arg=" CONFIGS_DIR=indexv2" ./test/images/busybox-index
139
+
140
+ # The following catalog used for e2e tests related to serving an extracted registry
141
+ # See catalog_e2e_test.go
142
+ # let's just reuse one of the other catalogs for this - the tests don't care about the content
143
+ # only that a catalog's content can be extracted and served by a different container
144
+ ${CONTAINER_RUNTIME} tag " ${INDEX_V2} " " ${TEST_CATALOG_IMAGE} "
145
+ fi
146
+
113
147
if [ " ${SAVE} " = true ]; then
114
148
${CONTAINER_RUNTIME} save " ${BUNDLE_V1_IMAGE} " | gzip > bundlev1.tar.gz
115
149
${CONTAINER_RUNTIME} save " ${BUNDLE_V1_DEP_IMAGE} " | gzip > bundlev1dep.tar.gz
@@ -121,23 +155,8 @@ if [ "${SAVE}" = true ]; then
121
155
${CONTAINER_RUNTIME} save " ${INDEX_V2} " | gzip > indexv2.tar.gz
122
156
123
157
${CONTAINER_RUNTIME} save " ${TEST_CATALOG_IMAGE} " | gzip > testcatalog.tar.gz
124
- exit 0
125
158
fi
126
159
127
- # Busybox Operator Index Image
128
- ${CONTAINER_RUNTIME} build -t " ${BUNDLE_V1_IMAGE} " ./test/images/busybox-index/busybox/1.0.0
129
- ${CONTAINER_RUNTIME} build -t " ${BUNDLE_V1_DEP_IMAGE} " ./test/images/busybox-index/busybox-dependency/1.0.0
130
- ${CONTAINER_RUNTIME} build -t " ${BUNDLE_V2_IMAGE} " ./test/images/busybox-index/busybox/2.0.0
131
- ${CONTAINER_RUNTIME} build -t " ${BUNDLE_V2_DEP_IMAGE} " ./test/images/busybox-index/busybox-dependency/2.0.0
132
-
133
- # Build catalog from templates
134
- ${CONTAINER_RUNTIME} build -t " ${INDEX_V1} " --build-arg=" OPM_VERSION=v${OPM_VERSION} " --build-arg=" CONFIGS_DIR=indexv1" ./test/images/busybox-index
135
- ${CONTAINER_RUNTIME} build -t " ${INDEX_V2} " --build-arg=" OPM_VERSION=v${OPM_VERSION} " --build-arg=" CONFIGS_DIR=indexv2" ./test/images/busybox-index
136
-
137
- # Test catalog used for e2e tests related to serving an extracted registry
138
- # Let's reuse one of the other indices for this
139
- ${CONTAINER_RUNTIME} tag " ${INDEX_V2} " " ${TEST_CATALOG_IMAGE} "
140
-
141
160
if [ " $PUSH " = true ]; then
142
161
# push bundles
143
162
${CONTAINER_RUNTIME} push " ${BUNDLE_V1_IMAGE} "
0 commit comments