Skip to content

Commit

Permalink
Added switch just for develop to prevent semver problems
Browse files Browse the repository at this point in the history
  • Loading branch information
jharmison-redhat committed Sep 19, 2020
1 parent 9a3c2a7 commit 4f72f0f
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 10 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ script:
- KUSTOMIZE_PATH=${KUSTOMIZE} TEST_OPERATOR_NAMESPACE=default molecule test -s kind-namespace
deploy:
- provider: script
script: hack/operate.sh --push-images --bundle --version=develop --verbose --formatter
script: hack/operate.sh --push-images --bundle --develop --verbose --formatter
on:
branch: develop
- provider: script
Expand Down
37 changes: 28 additions & 9 deletions hack/operate.sh
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ function print_usage() {
"[(-V |--version=)SEMVER] " \
"[(-C |--channels=)CHANNELS] " \
"[(-t |--extra-tag=)TAG] " \
"[--develop] " \
"[--bundle]"
}

Expand Down Expand Up @@ -152,6 +153,9 @@ OPTIONS
-C |--channels=CHANNELS Set the channels label for the bundle image.
-t |--extra-tag=TAG As well as SEMVER, also publish a version
tagged as TAG.
--develop Don't push to the SEMVER tag, either from
operate.conf or the --version option, and
instead push only to the develop tag
--bundle Build and publish an OLM bundle to the tag
at ${IMG}-bundle:${VERSION}
Expand Down Expand Up @@ -192,6 +196,7 @@ UNDEPLOY_CR=
OVERLAY=default
VERSION=
CHANNELS=
DEVLEOP=
BUNDLE=
EXTRA_TAGS=()

Expand Down Expand Up @@ -270,6 +275,9 @@ while [ $# -gt 0 ]; do
-t|--extra-tag=*)
EXTRA_TAGS+=($(parse_arg -t "$1" "$2")) || shift
;;
--develop)
DEVELOP=true
;;
--bundle)
BUNDLE=true
;;
Expand Down Expand Up @@ -333,10 +341,16 @@ function quay_login() {
function push_images() {
quay_login || return 1
# Push the images to the logged in repository
for tag in $VERSION ${EXTRA_TAGS[@]}; do
error_run "Building $IMG:$tag" make docker-build IMG=$IMG:$tag || return 1
error_run "Pushing $IMG:$tag" make docker-push IMG=$IMG:$tag || return 1
done
if [ -z "$DEVELOP" ]; then
for tag in $VERSION ${EXTRA_TAGS[@]}; do
error_run "Building $IMG:$tag" make docker-build IMG=$IMG:$tag || return 1
error_run "Pushing $IMG:$tag" make docker-push IMG=$IMG:$tag || return 1
fi
done
else
error_run "Building $IMG:develop" make docker-build IMG=$IMG:develop || return 1
error_run "Pushing $IMG:develop" make docker-push IMG=$IMG:develop || return 1
fi
}

function validate_cluster() {
Expand Down Expand Up @@ -423,11 +437,16 @@ function publish_bundle() {
error_run "Building bundle manifests" 'kustomize build --load_restrictor none config/manifests | operator-sdk generate bundle --overwrite --version $VERSION --channels "$CHANNELS"' || return 1
error_run "Validating bundle" operator-sdk bundle validate ./bundle || return 1
error_run "Building bundle image" docker build -f bundle.Dockerfile -t "$IMG-bundle:$VERSION" . || return 1
error_run "Pushing image $IMG-bundle:$VERSION" docker push "$IMG-bundle:$VERSION" || return 1
for tag in ${EXTRA_TAGS[@]}; do
error_run "Tagging bundle image with $tag" docker tag "$IMG-bundle:$VERSION" "$IMG-bundle:$tag" || return 1
error_run "Pushing image $IMG-bundle:$tag" docker push "$IMG-bundle:$tag" || return 1
done
if [ -z "$DEVELOP" ]; then
error_run "Pushing image $IMG-bundle:$VERSION" docker push "$IMG-bundle:$VERSION" || return 1
for tag in ${EXTRA_TAGS[@]}; do
error_run "Tagging bundle image with $tag" docker tag "$IMG-bundle:$VERSION" "$IMG-bundle:$tag" || return 1
error_run "Pushing image $IMG-bundle:$tag" docker push "$IMG-bundle:$tag" || return 1
done
else
error_run "Tagging bundle image with develop" docker tag "$IMG-bundle:$VERSION" "$IMG-bundle:develop" || return 1
error_run "Pushing image $IMG-bundle:develop" docker push "$IMG-bundle:develop" || return 1
fi
pushd config/rbac &>/dev/null
warn_run "Removing namespaced Role from kustomization" 'kustomize edit remove resource namespaced/role.yaml' ||:
warn_run "Removing namespaced RoleBinding from kustomization" 'kustomize edit remove resource namespaced/role.yaml' ||:
Expand Down

0 comments on commit 4f72f0f

Please sign in to comment.