69 lines
1.6 KiB
Bash
Executable File
69 lines
1.6 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
# Determine if it is Mac OS and switch to use gxargs instead
|
|
CMD=xargs
|
|
if [ $(which system_profiler) ]; then
|
|
CMD=gxargs
|
|
fi
|
|
|
|
# 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}}
|
|
}
|
|
|
|
docker tag ${CONTAINER}:${TAG} ${REPO_URL}/${CONTAINER}:${TAG} \
|
|
&& docker push ${REPO_URL}/${CONTAINER}:${TAG} \
|
|
|| {
|
|
echo "Unable to tag and push image to ${REPO_URL}."
|
|
exit 1
|
|
}
|
|
|
|
[[ "${TAG}" =~ "test-*" ]] && {
|
|
cat << EOM
|
|
|
|
This image was pushed with the 'test-' tag prefix:
|
|
|
|
${REGISTRY_URL}/${CONTAINER}:${TAG}
|
|
|
|
If the image looks good, you can promote this build:
|
|
|
|
1. Tag the tree it as ${TAG}
|
|
|
|
git commit -s -a -m "Build of ${TAG/test-}"
|
|
git tag -f ${TAG/test-}
|
|
|
|
2. Remove the 'test-' prefix from the tag:
|
|
|
|
docker tag ${CONTAINER}:${TAG/test-} ${REGISTRY_URL}/${CONTAINER}:${TAG/test-}
|
|
docker push ${REGISTRY_URL}/${CONTAINER}:${TAG/test-}
|
|
|
|
3. Roll this version to the 'latest':
|
|
|
|
docker tag ${CONTAINER}:${TAG/test-} ${REGISTRY_URL}/${CONTAINER}:latest-${OS_DISTRO}-${PACKAGE_STREAM}
|
|
docker push ${REGISTRY_URL}/${CONTAINER}:latest-${OS_DISTRO}-${PACKAGE_STREAM}
|
|
|
|
EOM
|
|
} || {
|
|
cat << EOM
|
|
|
|
This image was pushed:
|
|
|
|
${REGISTRY_URL}/${CONTAINER}:${TAG}
|
|
|
|
EOM
|
|
}
|
|
|