@@ -17,38 +17,54 @@ set -euxo pipefail
1717
1818source " $( dirname " ${0} " ) /teamcity-support.sh"
1919
20+ # Default values are defined for the certified bundle.
21+ RH_PROJECT=" 5f5a433f9d6546ed7aa8634d"
22+ RH_REGISTRY=" scan.connect.redhat.com"
23+ RH_REPO=" ospid-857fe786-3eb7-4508-aafd-cc74c1b1dc24/cockroachdb-operator-bundle"
24+ BUNDLE_DIR=" bundle/cockroachdb-certified"
2025
21- tc_start_block " Variable Setup"
22- VERSION=" v" $( cat version.txt)
23- # Matching the version name regex from within the cockroach code except
24- # for the `metadata` part at the end because Docker tags don't support
25- # `+` in the tag name.
26- # https://github.com/cockroachdb/cockroach/blob/4c6864b44b9044874488cfedee3a31e6b23a6790/pkg/util/version/version.go#L75
27- image_tag=" $( echo " ${VERSION} " | grep -E -o ' ^v(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)(-[-.0-9A-Za-z]+)?$' ) "
28- # ^major ^minor ^patch ^preRelease
29-
30- if [[ -z " $image_tag " ]] ; then
31- echo " Invalid VERSION \" ${VERSION} \" . Must be of the format \" vMAJOR.MINOR.PATCH(-PRERELEASE)?\" ."
32- exit 1
26+ # If this is the marketplace bundle, update accordingly.
27+ if ! [[ -z " ${MARKETPLACE} " ]]; then
28+ RH_PROJECT=" 61765afbdd607bfc82e643b8"
29+ RH_REPO=" ospid-61765afbdd607bfc82e643b8/cockroachdb-operator-bundle-marketplace"
30+ BUNDLE_DIR=" bundle/cockroachdb-certified-rhmp"
3331fi
3432
35- rhel_registry=" scan.connect.redhat.com"
36- rh_bundle_image_repository=" ospid-857fe786-3eb7-4508-aafd-cc74c1b1dc24/cockroachdb-operator-bundle"
37- image=" $rhel_registry /$rh_bundle_image_repository :$image_tag "
33+ # If it's a dry run, add -dryrun to the image
34+ if ! [[ -z " ${DRY_RUN} " ]]; then RH_REPO=" ${RH_REPO} -dryrun" ; fi
3835
39- if ! [[ -z " ${DRY_RUN} " ]] ; then
40- image=" ${image} -dryrun"
41- fi
42- tc_end_block " Variable Setup"
36+ IMAGE=" ${RH_REGISTRY} /${RH_REPO} :${TAG} "
37+
38+ main () {
39+ docker_login " ${RH_REGISTRY} " " ${OPERATOR_REDHAT_REGISTRY_USER} " " ${OPERATOR_REDHAT_REGISTRY_KEY} "
40+
41+ generate_bundle
42+ publish_bundle_image
43+ run_preflight
44+ }
45+
46+ generate_bundle () {
47+ # create the certified and marketplace bundles
48+ tc_start_block " Generate bundle"
49+ make release/generate-bundle
50+ tc_end_block " Generate bundle"
51+ }
52+
53+ publish_bundle_image () {
54+ tc_start_block " Make and push bundle image"
4355
56+ pushd " ${BUNDLE_DIR} "
57+ docker build -t " ${IMAGE} " .
58+ docker push " ${IMAGE} "
59+ popd
4460
45- tc_start_block " Make and push docker images"
46- configure_docker_creds
47- docker_login " $rhel_registry " " $OPERATOR_BUNDLE_REDHAT_REGISTRY_USER " " $OPERATOR_BUNDLE_REDHAT_REGISTRY_KEY "
61+ tc_end_block " Make and push bundle image"
62+ }
4863
49- # TODO(rail): switch to bazel generated images when it supports "FROM: scratch"
50- cd deploy/certified-metadata-bundle/cockroach-operator
51- docker build -t $image -f bundle.Dockerfile .
52- docker push $image
64+ run_preflight () {
65+ bazel build //hack/bin:preflight
66+ PFLT_PYXIS_API_TOKEN=" ${REDHAT_API_TOKEN} " bazel-bin/hack/bin/preflight \
67+ check operator " ${IMAGE} " --docker-config ~ /.docker/config.json
68+ }
5369
54- tc_end_block " Make and push docker images "
70+ main " $@ "
0 commit comments