Skip to content

Commit 216c1fe

Browse files
committed
fixed refreshInstance.sh regarding fetching default release with latest created_at;
the script erroneously sorted by the created_at time stamp of the "release" and not the "asset." Specifically for repeated workflow runs this caused inconsistencies, and the release then downloaded was not necessarily the latest one published.
1 parent 60e91f4 commit 216c1fe

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

configuration/environments_scripts/sailing_server/files/usr/local/bin/refreshInstance.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -153,11 +153,11 @@ install_environment ()
153153
load_from_release_file ()
154154
{
155155
if [[ ${INSTALL_FROM_RELEASE} == "" ]]; then
156-
GITHUB_RELEASE=$( curl -L "https://api.github.com/repos/SAP/sailing-analytics/releases?per_page=100" 2>/dev/null | jq -r 'sort_by(.created_at) | reverse | map(select(.name | startswith("main-")))[0].assets[] | select(.content_type=="application/x-tar")' )
156+
GITHUB_RELEASE=$( curl -L "https://api.github.com/repos/SAP/sailing-analytics/releases?per_page=100" 2>/dev/null | jq -r 'map(select(.name | startswith("main-")) | .assets[] | select(.content_type=="application/x-tar")) | sort_by(.created_at) | reverse | first' )
157157
INSTALL_FROM_RELEASE=$( echo "${GITHUB_RELEASE}" | jq -r '.name' | sed -e 's/\.tar\.gz$//' )
158158
echo "You didn't provide a release. Defaulting to latest main branch build ${INSTALL_FROM_RELEASE}"
159159
else
160-
GITHUB_RELEASE=$( curl -L "https://api.github.com/repos/SAP/sailing-analytics/releases?per_page=100" 2>/dev/null | jq -r 'sort_by(.created_at) | reverse | map(select(.name=="'${INSTALL_FROM_RELEASE}'"))[0].assets[] | select(.content_type=="application/x-tar")' )
160+
GITHUB_RELEASE=$( curl -L "https://api.github.com/repos/SAP/sailing-analytics/releases?per_page=100" 2>/dev/null | jq -r 'map(select(.name=="'${INSTALL_FROM_RELEASE}'") | .assets[] | select(.content_type=="application/x-tar")) | sort_by(.created_at) | reverse | first' )
161161
fi
162162
if which mail; then
163163
if [ -n "${BUILD_COMPLETE_NOTIFY}" ]; then

0 commit comments

Comments
 (0)