diff options
author | Arnstein Ressem <aressem@verizonmedia.com> | 2021-10-12 14:13:32 +0200 |
---|---|---|
committer | Arnstein Ressem <aressem@verizonmedia.com> | 2021-10-12 14:13:32 +0200 |
commit | 73871120b1df18836943e0a5cc5eed859e5f0cfb (patch) | |
tree | 4ec85b9230e86d547aa14c505f21eeec22a800e3 /screwdriver/update-vespa-version-in-sample-apps.sh | |
parent | 79e0709e4dc3589b1b54dfb46a3de113ba7eda9b (diff) |
Add release job for Vespa artifacts.
Diffstat (limited to 'screwdriver/update-vespa-version-in-sample-apps.sh')
-rwxr-xr-x | screwdriver/update-vespa-version-in-sample-apps.sh | 65 |
1 files changed, 65 insertions, 0 deletions
diff --git a/screwdriver/update-vespa-version-in-sample-apps.sh b/screwdriver/update-vespa-version-in-sample-apps.sh new file mode 100755 index 00000000000..d20e8846716 --- /dev/null +++ b/screwdriver/update-vespa-version-in-sample-apps.sh @@ -0,0 +1,65 @@ +#!/usr/bin/ssh-agent /bin/bash +# Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. + +set -euo pipefail +set -x + +if [[ $# -ne 1 ]]; then + echo "Usage: $0 <Vespa version>" + exit 1 +fi + +readonly VESPA_RELEASE="$1" +readonly TRUE="true" +readonly FALSE="false" + +export JAVA_HOME=$(dirname $(dirname $(readlink -f /usr/bin/java))) + +function is_published { + BUNDLE_PLUGIN_HTTP_CODE=$(curl --write-out %{http_code} --silent --location --output /dev/null https://repo.maven.apache.org/maven2/com/yahoo/vespa/bundle-plugin/${VESPA_RELEASE}/) + if [ $BUNDLE_PLUGIN_HTTP_CODE = "200" ] ; then + echo "$TRUE" + else + echo "$FALSE" + fi +} + +function wait_until_published { + cnt=0 + until [[ $(is_published) = "$TRUE" ]]; do + ((cnt+=1)) + # Wait max 60 minutes + if (( $cnt > 60 )); then + echo "ERROR: Artifacts with version ${VESPA_RELEASE} not found on central maven repo." + exit 1 + fi + echo "Waiting 60 seconds for version ${VESPA_RELEASE} on central maven repo ($cnt times)." + sleep 60 + done +} + +wait_until_published + +ssh-add -D +set +x +ssh-add <(echo $SAMPLE_APPS_DEPLOY_KEY | base64 -d) +set -x + +# Supported from git 2.3 +export GIT_SSH_COMMAND="ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no" +git --version + +git clone git@github.com:vespa-engine/sample-apps.git +cd sample-apps + +# Update Vespa version property in pom.xml +mvn versions:set-property -Dproperty=vespa_version -DnewVersion=${VESPA_RELEASE} + +changes=$(git status --porcelain | wc -l) + +if (( changes > 0 )); then + echo "Updating Vespa version to ${VESPA_RELEASE}." + git commit -a -m "Update Vespa version to ${VESPA_RELEASE}." + git pull --rebase + git push +fi |