Fix: correctly identifying the syndesis-operator release
#!/bin/bash
OPERATOR_GO_PACKAGE="github.com/syndesisio/syndesis/install/operator"
-OPERATOR_BINARY=$HOME/.syndesis/bin/syndesis-operator
+OPERATOR="syndesis-operator"
+OPERATOR_BINARY=$HOME/.syndesis/bin/${OPERATOR}
operatorsdk_is_available() {
set +e
@@ -90,15 +91,29 @@ download_operator_binary() {
if [[ "${pattern}" != "unknown" ]]; then
release_uri="https://api.github.com/repos/syndesisio/syndesis/releases?per_page=1"
release_tag="$(readopt --tag)"
+
if [[ -n "$release_tag" ]]; then
release_uri="https://api.github.com/repos/syndesisio/syndesis/releases/tags/${release_tag}"
fi
url=$(curl -s $release_uri \
| grep browser_download_url \
+ | grep ${OPERATOR} \
| grep ${pattern} \
| cut -d '"' -f 4)
+ #
+ # Check curl returns a valid url
+ #
+ if [ -z "${url}" ]; then
+ if [[ -n "$release_tag" ]]; then
+ echo "unable to find a valid release url for release tag ${release_tag}"
+ else
+ echo "unable to find any valid release urls"
+ fi
+ return 1
+ fi
+
if $(curl -sL ${url} | tar xz -C $(dirname ${OPERATOR_BINARY})); then
chmod +x ${OPERATOR_BINARY}
else
