|
1 | 1 | #!/bin/bash
|
2 |
| -set -euxo pipefail |
3 | 2 |
|
4 |
| -echo "Setting Variables" |
5 |
| -read -p "Bunlde image: " bundleImage |
6 |
| -read -p "Index image tag: " indexImage |
7 |
| -read -p "docker or podman: " containerTool |
| 3 | +username=$2 |
| 4 | +token=$3 |
| 5 | +echo "logging in to quay" |
| 6 | +docker login -u "$username" -p "$token" quay.io |
| 7 | + |
| 8 | +echo "Generating Random Tag" |
| 9 | +bundleTag1=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 6 | head -n 1) |
| 10 | +bundleTag2=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 6 | head -n 1) |
| 11 | +bundleTag3=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 6 | head -n 1) |
| 12 | +indexTag=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 6 | head -n 1) |
| 13 | + |
| 14 | +bundleImage="quay.io/olmtest/e2e-bundle" |
| 15 | +indexImage="quay.io/olmtest/e2e-index:$indexTag" |
| 16 | + |
| 17 | +if [ $# -eq 0 ]; then |
| 18 | + echo "No container tool argument supplied" |
| 19 | + exit 1 |
| 20 | +fi |
| 21 | + |
| 22 | +if [ "$1" != "docker" && "$1" != "podman" ]; then |
| 23 | + echo "container tool argument must be podman or docker" |
| 24 | + exit 1 |
| 25 | +fi |
| 26 | + |
| 27 | +containerTool="$1" |
| 28 | +echo "Running with container tool $containerTool" |
8 | 29 |
|
9 | 30 | echo "building opm"
|
10 | 31 | go build -mod=vendor -o bin/opm ./cmd/opm
|
| 32 | +echo "building initializer" |
| 33 | +go build -mod=vendor -o bin/initializer ./cmd/initializer |
| 34 | + |
11 | 35 | echo "building prometheus bundles"
|
12 |
| -./bin/opm alpha bundle build --directory manifests/prometheus/0.14.0 --tag $bundleImage:0.14.0 --package prometheus --channels preview --default preview |
13 |
| -./bin/opm alpha bundle build --directory manifests/prometheus/0.15.0 --tag $bundleImage:0.15.0 --package prometheus --channels preview --default preview |
14 |
| -./bin/opm alpha bundle build --directory manifests/prometheus/0.22.2 --tag $bundleImage:0.22.2 --package prometheus --channels preview --default preview |
| 36 | +./bin/opm alpha bundle build --directory manifests/prometheus/0.14.0 --tag $bundleImage:$bundleTag1 --package prometheus --channels preview --default preview |
| 37 | +./bin/opm alpha bundle build --directory manifests/prometheus/0.15.0 --tag $bundleImage:$bundleTag2 --package prometheus --channels preview --default preview |
| 38 | +./bin/opm alpha bundle build --directory manifests/prometheus/0.22.2 --tag $bundleImage:$bundleTag3 --package prometheus --channels preview --default preview |
| 39 | + |
15 | 40 | echo "pushing prometheus bundles"
|
16 |
| -$containerTool push $bundleImage:0.14.0 |
17 |
| -$containerTool push $bundleImage:0.15.0 |
18 |
| -$containerTool push $bundleImage:0.22.2 |
| 41 | +$containerTool push $bundleImage:$bundleTag1 |
| 42 | +$containerTool push $bundleImage:$bundleTag2 |
| 43 | +$containerTool push $bundleImage:$bundleTag3 |
| 44 | + |
19 | 45 | echo "building index image with prometheus"
|
20 |
| -./bin/opm index add -b="$bundleImage:0.14.0,$bundleImage:0.15.0,$bundleImage:0.22.2" -t "$indexImage" -c="$containerTool" |
| 46 | +./bin/opm index add -b="$bundleImage:$bundleTag1,$bundleImage:$bundleTag2,$bundleImage:$bundleTag3" -t "$indexImage" -c="$containerTool" |
| 47 | + |
21 | 48 | echo "pushing index image"
|
| 49 | +$containerTool images |
22 | 50 | $containerTool push $indexImage
|
| 51 | + |
23 | 52 | echo "sleep for 30s before pulling image"
|
24 | 53 | sleep 30s
|
| 54 | + |
25 | 55 | echo "exporting from index"
|
26 | 56 | ./bin/opm index export -i="$indexImage" -o="prometheus" -c="$containerTool"
|
| 57 | + |
| 58 | +echo "running the initializer on the exported content" |
| 59 | +./bin/initializer -m="downloaded" |
0 commit comments