Fix release merge jobs to work with AWS S3_BUCKET when CDN_URL
is set.
Log shipping is being migrated from Nexus2 log server to AWS S3
Buckets. This requires the release job scripts to handle CDN_URL
and set the correct value for LOG_SERVER.
Issue: RELENG-3307
Change-Id: I508dd15508d9c9dd3741edf220d64526abed644f
Signed-off-by: Anil Belur <abelur@linuxfoundation.org>
--- /dev/null
+---
+fixes:
+ - |
+ Fix release merge jobs to work with AWS S3_BUCKET when CDN_URL is set.
+
+ Log shipping is being migrated from Nexus2 Log to AWS S3 Buckets. This
+ requires the release job scripts to handle CDN_URL and set the correct
+ value for LOG_SERVER.
set_variables_common(){
echo "INFO: Setting common variables"
set_variables_common(){
echo "INFO: Setting common variables"
- if [[ -z ${LOGS_SERVER:-} ]]; then
- echo "ERROR: LOGS_SERVER not defined"
+ if [[ -z ${LOGS_SERVER:-} ]] || [[ -z ${CDN_URL:-} ]]; then
+ echo "ERROR: LOGS_SERVER or CDN_URL not defined"
exit 1
fi
NEXUS_PATH="${SILO}/${JENKINS_HOSTNAME}/"
exit 1
fi
NEXUS_PATH="${SILO}/${JENKINS_HOSTNAME}/"
+ if [[ -n ${LOGS_SERVER:-} ]]; then
+ logs_url="${LOGS_SERVER}/${NEXUS_PATH}${LOG_DIR}"
+ elif [[ -n ${CDN_URL:-} ]]; then
+ logs_url="https://${CDN_URL:-}/logs/${NEXUS_PATH}${LOG_DIR}"
+ fi
+ logs_url=${logs_url%/} # strip any trailing '/'
+
# Jenkins parameter drop-down defaults DISTRIBUTION_TYPE to None
# in the contain/maven release job; get value from release yaml.
# Packagecloud and PyPI jobs set the appropriate value.
# Jenkins parameter drop-down defaults DISTRIBUTION_TYPE to None
# in the contain/maven release job; get value from release yaml.
# Packagecloud and PyPI jobs set the appropriate value.
printf "\t%-30s\n" RELEASE_ENVIRONMENT_INFO:
printf "\t%-30s %s\n" RELEASE_FILE: "$release_file"
printf "\t%-30s %s\n" LOGS_SERVER: "$LOGS_SERVER"
printf "\t%-30s\n" RELEASE_ENVIRONMENT_INFO:
printf "\t%-30s %s\n" RELEASE_FILE: "$release_file"
printf "\t%-30s %s\n" LOGS_SERVER: "$LOGS_SERVER"
+ printf "\t%-30s %s\n" CDN_URL: "${CDN_URL:-None}"
printf "\t%-30s %s\n" NEXUS_PATH: "$NEXUS_PATH"
printf "\t%-30s %s\n" JENKINS_HOSTNAME: "$JENKINS_HOSTNAME"
printf "\t%-30s %s\n" SILO: "$SILO"
printf "\t%-30s %s\n" NEXUS_PATH: "$NEXUS_PATH"
printf "\t%-30s %s\n" JENKINS_HOSTNAME: "$JENKINS_HOSTNAME"
printf "\t%-30s %s\n" SILO: "$SILO"
if [[ -z ${LOG_DIR:-} ]]; then
LOG_DIR=$(yq -r ".log_dir" "$release_file")
fi
if [[ -z ${LOG_DIR:-} ]]; then
LOG_DIR=$(yq -r ".log_dir" "$release_file")
fi
- LOGS_URL="${LOGS_SERVER}/${NEXUS_PATH}${LOG_DIR}"
- LOGS_URL=${LOGS_URL%/} # strip any trailing '/'
# Continuing displaying Release Information (Maven)
printf "\t%-30s\n" RELEASE_MAVEN_INFO:
printf "\t%-30s %s\n" VERSION: "$VERSION"
printf "\t%-30s %s\n" GIT_TAG: "$GIT_TAG"
printf "\t%-30s %s\n" LOG_DIR: "$LOG_DIR"
# Continuing displaying Release Information (Maven)
printf "\t%-30s\n" RELEASE_MAVEN_INFO:
printf "\t%-30s %s\n" VERSION: "$VERSION"
printf "\t%-30s %s\n" GIT_TAG: "$GIT_TAG"
printf "\t%-30s %s\n" LOG_DIR: "$LOG_DIR"
- printf "\t%-30s %s\n" LOGS_URL: "$LOGS_URL"
+ printf "\t%-30s %s\n" LOGS_URL: "$logs_url"
}
set_variables_container(){
}
set_variables_container(){
if [[ -z ${LOG_DIR:-} ]]; then
LOG_DIR=$(yq -r ".log_dir" "$release_file")
fi
if [[ -z ${LOG_DIR:-} ]]; then
LOG_DIR=$(yq -r ".log_dir" "$release_file")
fi
- LOGS_URL="${LOGS_SERVER}/${NEXUS_PATH}${LOG_DIR}"
- LOGS_URL=${LOGS_URL%/} # strip any trailing '/'
if [[ -z ${PYPI_PROJECT:-} ]]; then
PYPI_PROJECT=$(yq -r ".pypi_project" "$release_file")
fi
if [[ -z ${PYPI_PROJECT:-} ]]; then
PYPI_PROJECT=$(yq -r ".pypi_project" "$release_file")
fi
# Continuing displaying Release Information (pypi)
printf "\t%-30s\n" RELEASE_PYPI_INFO:
printf "\t%-30s %s\n" LOG_DIR: "$LOG_DIR"
# Continuing displaying Release Information (pypi)
printf "\t%-30s\n" RELEASE_PYPI_INFO:
printf "\t%-30s %s\n" LOG_DIR: "$LOG_DIR"
- printf "\t%-30s %s\n" LOGS_URL: "$LOGS_URL"
+ printf "\t%-30s %s\n" LOGS_URL: "$logs_url"
printf "\t%-30s %s\n" PYPI_INDEX: "$PYPI_INDEX" # from job configuration
printf "\t%-30s %s\n" PYPI_PROJECT: "$PYPI_PROJECT"
printf "\t%-30s %s\n" PYTHON_VERSION: "$PYTHON_VERSION"
printf "\t%-30s %s\n" PYPI_INDEX: "$PYPI_INDEX" # from job configuration
printf "\t%-30s %s\n" PYPI_PROJECT: "$PYPI_PROJECT"
printf "\t%-30s %s\n" PYTHON_VERSION: "$PYTHON_VERSION"
if [[ -z ${PACKAGE_NAME:-} ]]; then
PACKAGE_NAME=$(yq -r ".package_name" "$release_file")
fi
if [[ -z ${PACKAGE_NAME:-} ]]; then
PACKAGE_NAME=$(yq -r ".package_name" "$release_file")
fi
- logs_url="${LOGS_SERVER}/${NEXUS_PATH}${LOG_DIR}"
- logs_url=${logs_url%/} # strip any trailing '/'
printf "\t%-30s %s\n" PACKAGE_NAME: "$PACKAGE_NAME"
printf "\t%-30s %s\n" LOG_DIR: "$LOG_DIR"
printf "\t%-30s %s\n" PACKAGE_NAME: "$PACKAGE_NAME"
printf "\t%-30s %s\n" LOG_DIR: "$LOG_DIR"
}
verify_version_match_release(){
}
verify_version_match_release(){
- echo "INFO: Fetching console log from $LOGS_URL"
- wget -P /tmp "${LOGS_URL}/"console.log.gz
+ echo "INFO: Fetching console log from $logs_url"
+ wget -P /tmp "${logs_url}/"console.log.gz
echo "INFO: Searching for uploaded step and version $VERSION in job log"
if zgrep "Successfully uploaded" /tmp/console.log.gz | grep "$VERSION"; then
echo "INFO: found expected strings in job log"
echo "INFO: Searching for uploaded step and version $VERSION in job log"
if zgrep "Successfully uploaded" /tmp/console.log.gz | grep "$VERSION"; then
echo "INFO: found expected strings in job log"
# check prerequisites to detect mistakes in the release YAML file
verify_pypi_match_release(){
# check prerequisites to detect mistakes in the release YAML file
verify_pypi_match_release(){
- echo "INFO: Fetching console log from $LOGS_URL"
- wget -q -P /tmp "${LOGS_URL}/"console.log.gz
+ echo "INFO: Fetching console log from $logs_url"
+ wget -q -P /tmp "${logs_url}/"console.log.gz
echo "INFO: Searching for uploaded step, project $PYPI_PROJECT and version $VERSION in job log"
# pypi-upload.sh generates success message with file list
if zgrep -i "uploaded" /tmp/console.log.gz | grep "$PYPI_PROJECT" | grep "$VERSION" ; then
echo "INFO: Searching for uploaded step, project $PYPI_PROJECT and version $VERSION in job log"
# pypi-upload.sh generates success message with file list
if zgrep -i "uploaded" /tmp/console.log.gz | grep "$PYPI_PROJECT" | grep "$VERSION" ; then
maven_release_file(){
echo "INFO: Processing maven release"
maven_release_file(){
echo "INFO: Processing maven release"
- echo "INFO: wget -P $PATCH_DIR ${LOGS_URL}/staging-repo.txt.gz"
- wget -P "$PATCH_DIR" "${LOGS_URL}/"staging-repo.txt.gz
+ echo "INFO: wget -P $PATCH_DIR ${logs_url}/staging-repo.txt.gz"
+ wget -P "$PATCH_DIR" "${logs_url}/"staging-repo.txt.gz
- echo "INFO: wget ${LOGS_URL}/patches/{${PROJECT//\//-}.bundle,taglist.log.gz}"
- wget "${LOGS_URL}"/patches/{"${PROJECT//\//-}".bundle,taglist.log.gz}
+ echo "INFO: wget ${logs_url}/patches/{${PROJECT//\//-}.bundle,taglist.log.gz}"
+ wget "${logs_url}"/patches/{"${PROJECT//\//-}".bundle,taglist.log.gz}
gunzip taglist.log.gz
cat "$PATCH_DIR"/taglist.log
popd
gunzip taglist.log.gz
cat "$PATCH_DIR"/taglist.log
popd