
Fix #6: Define TAG in .gitlab-ci.yml and update scripts to defer to it. renamed: scripts/push-test-image.sh -> scripts/push-image.sh renamed: scripts/test-tag.sh -> scripts/test-image.sh Refactored some of the scripts/* so they are generic and not tied to CI usages. Added error checking and output to push-rolling-image.sh and remove-tag.sh Added scripts/trigger.sh to auto-trigger builds. Signed-off-by: James Ketrenos <james.p.ketrenos@intel.com>
42 lines
1.0 KiB
Bash
Executable File
42 lines
1.0 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
# Bring in the variables from SOLUTION file, supporting
|
|
# nested substitution
|
|
. SOLUTION
|
|
. MANIFEST
|
|
|
|
VARS=($(sed -nE "s,(^[^#][^=]*).*$,\1,pg" SOLUTION))
|
|
VARS+=($(sed -nE "s,(^[^#][^=]*).*$,\1,pg" MANIFEST))
|
|
for var in ${VARS[@]}; do
|
|
export ${var}
|
|
done
|
|
|
|
RELEASE_INFO=${RELEASE_INFO:-N/A}
|
|
[[ "${RELEASE_INFO}" == "N/A" ]] && {
|
|
TAG=${TAG:-test-build-${OS_DISTRO}-${PACKAGE_STREAM}-$(date +%Y%m%d)}
|
|
} || {
|
|
TAG=${TAG:-test-${OS_DISTRO}-${PACKAGE_STREAM}-${RELEASE_INFO}}
|
|
}
|
|
|
|
# Parse out the FQDN from the REGISTRY_URL and escape
|
|
# the group/project/path
|
|
FQDN=${REGISTRY_URL%%/*}
|
|
PROJECT=$(echo ${REGISTRY_URL#*/}/${CONTAINER} | sed s,/,%2F,g)
|
|
|
|
echo -e "Deleting tag:\n ${CONTAINER}:${TAG}\nFrom:\n ${PROJECT}"
|
|
|
|
RESULTS=$(curl --noproxy '*' -s -k \
|
|
-u ${HARBOR_USER}:${HARBOR_PASSWD} \
|
|
-i \
|
|
-X DELETE \
|
|
-H "accept: application/json" \
|
|
"https://${FQDN}/api/repositories/${PROJECT}/tags/${TAG}")
|
|
|
|
echo ${RESULTS} | grep -q "HTTP.*200" && {
|
|
echo "Tag deleted successfully."
|
|
} || {
|
|
>&2 echo "Error deleting tag:"
|
|
>&2 echo "${RESULTS}"
|
|
exit 1
|
|
}
|