X-Git-Url: https://gerrit.linuxfoundation.org/infra/gitweb?a=blobdiff_plain;f=shell%2Frelease-job.sh;h=9ff67994434e90a56ed3daa80e2c640d6a5bc835;hb=44f406cbb141c28a33aae936baa6c0d90c844060;hp=eba269b8f5ccffa90b81f18c0d64472b9885e3db;hpb=dda5157a63d6d92115e36edda5cdcb35e399e6db;p=releng%2Fglobal-jjb.git diff --git a/shell/release-job.sh b/shell/release-job.sh index eba269b8..9ff67994 100644 --- a/shell/release-job.sh +++ b/shell/release-job.sh @@ -25,7 +25,7 @@ python -m pip freeze set_variables_common(){ echo "INFO: Setting common variables" - if [[ -z ${LOGS_SERVER:-} ]] || [[ -z ${CDN_URL:-} ]]; then + if [[ -z ${LOGS_SERVER:-} ]] && [[ -z ${CDN_URL:-} ]]; then echo "ERROR: LOGS_SERVER or CDN_URL not defined" exit 1 fi @@ -48,6 +48,9 @@ set_variables_common(){ release_file="None" fi + if [[ -z ${LOG_DIR:-} ]]; then + LOG_DIR=$(yq -r ".log_dir" "$release_file") + fi if [[ -n ${LOGS_SERVER:-} ]]; then logs_url="${LOGS_SERVER}/${NEXUS_PATH}${LOG_DIR}" elif [[ -n ${CDN_URL:-} ]]; then @@ -146,7 +149,7 @@ set_variables_container(){ printf "\t%-30s %s\n" CONTAINER_RELEASE_TAG: "$VERSION" printf "\t%-30s %s\n" CONTAINER_PULL_REGISTRY: "$CONTAINER_PULL_REGISTRY" printf "\t%-30s %s\n" CONTAINER_PUSH_REGISTRY: "$CONTAINER_PUSH_REGISTRY" - printf "\t%-30s %s\n" GERRIT_REF_TO_TAG: "$ref" + printf "\t%-30s %s\n" GIT_REF_TO_TAG: "$ref" printf "\t%-30s %s\n" GIT_TAG: "$GIT_TAG" } @@ -209,7 +212,7 @@ set_variables_packagecloud(){ printf "\t%-30s %s\n" PACKAGE_NAME: "$PACKAGE_NAME" printf "\t%-30s %s\n" LOG_DIR: "$LOG_DIR" printf "\t%-30s %s\n" LOGS_URL: "$logs_url" - printf "\t%-30s %s\n" GERRIT_REF_TO_TAG: "$REF" + printf "\t%-30s %s\n" GIT_REF_TO_TAG: "$REF" printf "\t%-30s %s\n" VERSION: "$VERSION" printf "\t%-30s %s\n" GIT_TAG: "$GIT_TAG" } @@ -285,13 +288,19 @@ verify_packagecloud_match_release(){ # sigul is only available on Centos # TODO: write tag-github-repo function -tag-gerrit-repo(){ +tag-git-repo(){ if [[ $TAG_RELEASE == false ]]; then - echo "INFO: Skipping gerrit repo tag" + echo "INFO: Skipping code repo tag" return fi - echo "INFO: tag gerrit with $GIT_TAG" + if [[ -z ${GERRIT_URL:-} ]]; then + GIT_REPO_BASE=github + else + GIT_REPO_BASE=gerrit + fi + + echo "INFO: tag repo with $GIT_TAG" # Import public signing key gpg --import "$SIGNING_PUBKEY" if type=$(git cat-file -t "$GIT_TAG"); then @@ -312,12 +321,16 @@ tag-gerrit-repo(){ ########## Merge Part ############## if [[ "$JOB_NAME" =~ "merge" ]] && [[ "$DRY_RUN" = false ]]; then echo "INFO: Running merge, pushing tag" - gerrit_ssh=$(echo "$GERRIT_URL" | awk -F"/" '{print $3}') - git remote set-url origin ssh://"$RELEASE_USERNAME"@"$gerrit_ssh":29418/"$PROJECT" + if [[ $GIT_REPO_BASE == "gerrit" ]]; then + gerrit_ssh=$(echo "$GERRIT_URL" | awk -F"/" '{print $3}') + git remote set-url origin ssh://"$RELEASE_USERNAME"@"$gerrit_ssh":29418/"$PROJECT" + echo -e "Host $gerrit_ssh\n\tStrictHostKeyChecking no\n" >> ~/.ssh/config + chmod 600 ~/.ssh/config + else + git remote set-url origin "$GIT_CLONE_URL""$RELEASE_USERNAME"/"$PROJECT".git + fi git config user.name "$RELEASE_USERNAME" git config user.email "$RELEASE_EMAIL" - echo -e "Host $gerrit_ssh\n\tStrictHostKeyChecking no\n" >> ~/.ssh/config - chmod 600 ~/.ssh/config git push origin "$GIT_TAG" fi fi @@ -386,7 +399,7 @@ container_release_file(){ echo "INFO: Merge will tag ref: $ref" git checkout "$ref" - tag-gerrit-repo + tag-git-repo } maven_release_file(){ @@ -403,7 +416,7 @@ maven_release_file(){ git fetch "$PATCH_DIR/${PROJECT//\//-}.bundle" git merge --ff-only FETCH_HEAD nexus_release - tag-gerrit-repo + tag-git-repo } # calls pip to download binary and source distributions from the specified index, @@ -448,7 +461,7 @@ pypi_release_file(){ echo "INFO: uploading $filecount distributions to repo $REPOSITORY" $cmd fi - tag-gerrit-repo + tag-git-repo } packagecloud_verify(){ @@ -478,7 +491,7 @@ packagecloud_promote(){ | echo "INFO: Promoted package location: \ https://packagecloud.io$(yq -r .package_html_url)" git checkout "$REF" - tag-gerrit-repo + tag-git-repo } ############################## End Function Declarations ################################