Code Review
/
policy
/
parent.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
review
|
tree
raw
|
inline
| side by side
Update release scripts for branches
[policy/parent.git]
/
integration
/
src
/
release_scripts
/
mkart.sh
diff --git
a/integration/src/release_scripts/mkart.sh
b/integration/src/release_scripts/mkart.sh
index
48a368e
..
2243e29
100755
(executable)
--- a/
integration/src/release_scripts/mkart.sh
+++ b/
integration/src/release_scripts/mkart.sh
@@
-36,6
+36,14
@@
# can get through the firewall.
#
# can get through the firewall.
#
+# Use the bash internal OSTYPE variable to check for MacOS
+if [[ "$OSTYPE" == "darwin"* ]]
+then
+ SED="gsed"
+else
+ SED="sed"
+fi
+
set -e
has_docker_images=false
set -e
has_docker_images=false
@@
-57,53
+65,53
@@
if [ -z "${BRANCH}" ]; then
echo "cannot extract default branch from ${TOPDIR}/.gitreview" >&2
exit 1
fi
echo "cannot extract default branch from ${TOPDIR}/.gitreview" >&2
exit 1
fi
-echo Branch:
${BRANCH}
+echo Branch:
"${BRANCH}"
PROJECT=$(awk -F= '$1 == "project" { print $2 }' "${TOPDIR}/.gitreview" |
PROJECT=$(awk -F= '$1 == "project" { print $2 }' "${TOPDIR}/.gitreview" |
-
sed
's/.git$//')
+
$SED
's/.git$//')
if [ -z "${PROJECT}" ]; then
echo "cannot extract project from ${TOPDIR}/.gitreview" >&2
exit 1
fi
if [ -z "${PROJECT}" ]; then
echo "cannot extract project from ${TOPDIR}/.gitreview" >&2
exit 1
fi
-echo Project: ${PROJECT}
-TPROJ=$(echo ${PROJECT} | sed 's!/!%2F!')
-DPROJ=$(echo ${PROJECT} | sed 's!/!-!')
+echo Project: "${PROJECT}"
+DPROJ=$(echo "${PROJECT}" | $SED 's!/!-!')
VERSION=$(
xmllint --xpath \
'/*[local-name()="project"]/*[local-name()="version"]/text()' \
"${TOPDIR}/pom.xml" |
VERSION=$(
xmllint --xpath \
'/*[local-name()="project"]/*[local-name()="version"]/text()' \
"${TOPDIR}/pom.xml" |
-
sed
's!-SNAPSHOT!!'
+
$SED
's!-SNAPSHOT!!'
)
if [ -z "${VERSION}" ]; then
echo "cannot extract version from ${TOPDIR}/pom.xml" >&2
exit 1
fi
)
if [ -z "${VERSION}" ]; then
echo "cannot extract version from ${TOPDIR}/pom.xml" >&2
exit 1
fi
-echo
Version: ${VERSION}
+echo
"Version: ${VERSION}"
prefix='https://jenkins.onap.org/view/policy/job/'
STAGE_ID=$(
prefix='https://jenkins.onap.org/view/policy/job/'
STAGE_ID=$(
- curl --silent
${prefix}${DPROJ}-maven-stage-${BRANCH}/
|
+ curl --silent
"${prefix}${DPROJ}-maven-stage-${BRANCH}/"
|
grep "Last completed build" |
grep "Last completed build" |
-
sed
-e 's!.*Last completed build .#!!' -e 's!).*!!' |
+
$SED
-e 's!.*Last completed build .#!!' -e 's!).*!!' |
head -1
)
if [ -z "${STAGE_ID}" ]; then
echo "cannot extract last maven stage ID from jenkins" >&2
exit 1
fi
head -1
)
if [ -z "${STAGE_ID}" ]; then
echo "cannot extract last maven stage ID from jenkins" >&2
exit 1
fi
-STAGE_ID=
${DPROJ}-maven-stage-${BRANCH}/${STAGE_ID}/
-echo Stage ID:
${STAGE_ID}
+STAGE_ID=
"${DPROJ}-maven-stage-${BRANCH}/${STAGE_ID}/"
+echo Stage ID:
"${STAGE_ID}"
prefix='https://jenkins.onap.org/view/policy/job/'
prefix='https://jenkins.onap.org/view/policy/job/'
-JOB_OUT=$(curl --silent
${prefix}${STAGE_ID}/console
)
+JOB_OUT=$(curl --silent
"${prefix}${STAGE_ID}/consoleFull"
)
echo "${JOB_OUT}" | grep -q "Finished: SUCCESS"
echo "${JOB_OUT}" | grep -q "Finished: SUCCESS"
+# shellcheck disable=SC2181
if [ $? -ne 0 ]; then
echo "last jenkins build has not completed successfully" >&2
exit 1
fi
if [ $? -ne 0 ]; then
echo "last jenkins build has not completed successfully" >&2
exit 1
fi
-echo Creating
${TOPDIR}/releases/${VERSION}.yaml
+echo Creating
"${TOPDIR}/releases/${VERSION}.yaml"
echo "distribution_type: 'maven'" > "${TOPDIR}/releases/${VERSION}.yaml"
echo "version: '${VERSION}'" >> "${TOPDIR}/releases/${VERSION}.yaml"
echo "distribution_type: 'maven'" > "${TOPDIR}/releases/${VERSION}.yaml"
echo "version: '${VERSION}'" >> "${TOPDIR}/releases/${VERSION}.yaml"