-
Bug
-
Resolution: Done
-
Major
-
None
-
None
Today we have this block of code in the push-container-to-quay job, which is called three times.
It should be externalized to a separate Jenkinsfile + job, so that it can be called AFTER pushing the quay image.
Resulting job should fail and send email if the CDN setup is incorrect.
if [[ ${REPO} == "theia-rhel8" ]]; then image="${PULP_REGISTRY}${PULLREPO}:${TAG}" echo "[INFO] Add CDN support for ${image}" set -x set +e cdn_folder="crw_theia_artifacts" # debug info docker container ls -all # /home/theia/lib/cdn.json does not exist in 2.2-19 version of the container. See https://issues.redhat.com/browse/CRW-993 CDN_JSON=$(docker run --name theia-container --entrypoint /bin/bash "$image" -c "cat /home/theia/lib/cdn.json 2>/dev/null") if [[ $? -eq 0 ]] && [[ ${CDN_JSON} ]]; then for file in $(echo "${CDN_JSON}" | jq --raw-output '.[] | select((has("cdn")) and (has("external")|not)) | .chunk,.resource' | grep -v 'null' ) do dir=$(dirname "$file") mkdir -p "$cdn_folder/$dir" docker cp "theia-container:/home/theia/lib/$file" "$cdn_folder/$file" done echo "[INFO] Files to push to Akamai storage:" echo "[INFO] $(find "$cdn_folder" -type f -print)" if [ -z "${AKAMAI_CHE_AUTH:-}" ]; then echo "[ERROR] CDN files will not be pushed to the Akamai directory since the 'AKAMAI_CHE_AUTH' environment variable is not set" exit 0 fi echo "[INFO] Push CDN files to the Akamai directory" for file in $(find "$cdn_folder" -type f -print); do echo "[INFO] Push $file" docker run -i --rm -v "${AKAMAI_CHE_AUTH}:/root/.akamai-cli/.netstorage/auth" -v "$(pwd)/$cdn_folder:/$cdn_folder" akamai/cli netstorage upload --directory "${AKAMAI_CHE_DIR:-che}" "${file}" done else echo "[WARN] No /home/theia/lib/cdn.json found in ${image} -- cannot add CDN support!" fi docker rm "theia-container" >/dev/null set +x set -e fi
DoD:
- new Jenkinsfile
- new Jenkins job that uses the Jenkinsfile
- updated jobs push-latest-containers-to-quay & push-container-to-quay – must call this new job instead when image is theia-rhel8