From 2a10c83b2d506008cc6c01c134515fb6328e1f3a Mon Sep 17 00:00:00 2001 From: Anil Belur Date: Sun, 7 Jul 2019 10:31:16 +1000 Subject: [PATCH] Fix script indent to 4 spaces Change the indent to 4 spaces which is consistant with rest of scripts in the repo. Add missing script anchor for debugging. Change-Id: I543441162636b2931665b16ddc50836c11dfd7f8 Signed-off-by: Anil Belur --- shell/check-info-votes.sh | 30 +++++------ shell/release-job.sh | 132 +++++++++++++++++++++++----------------------- 2 files changed, 82 insertions(+), 80 deletions(-) diff --git a/shell/check-info-votes.sh b/shell/check-info-votes.sh index 1e02a386..51ca172f 100644 --- a/shell/check-info-votes.sh +++ b/shell/check-info-votes.sh @@ -16,17 +16,17 @@ pip="pip3" # For OPNFV if [[ $NODE_NAME =~ "lf-build" ]]; then - pip=pip + pip=pip fi if [ -d "/opt/pyenv" ]; then - echo "---> Setting up pyenv" - export PYENV_ROOT="/opt/pyenv" - export PATH="$PYENV_ROOT/bin:$PATH" - PYTHONPATH=$(pwd) - export PYTHONPATH - pyenv local 3.6.4 - export PYENV_VERSION="3.6.4" + echo "---> Setting up pyenv" + export PYENV_ROOT="/opt/pyenv" + export PATH="$PYENV_ROOT/bin:$PATH" + PYTHONPATH=$(pwd) + export PYTHONPATH + pyenv local 3.6.4 + export PYENV_VERSION="3.6.4" fi $pip install --user niet @@ -39,12 +39,12 @@ lftools infofile check-votes INFO.yaml "$GERRIT_URL" "$ref" > gerrit_comment.txt exit_status="$?" if [[ "$exit_status" -ne 0 ]]; then - echo "Vote not yet complete" - cat gerrit_comment.txt - exit "$exit_status" + echo "Vote not yet complete" + cat gerrit_comment.txt + exit "$exit_status" else - echo "Vote completed submitting review" - ssh -p "$GERRIT_PORT" "$USER"@"$GERRIT_HOST" gerrit review "$GERRIT_PATCHSET_REVISION" --verified 1 - sleep 5 - ssh -p "$GERRIT_PORT" "$USER"@"$GERRIT_HOST" gerrit review "$GERRIT_PATCHSET_REVISION" --submit + echo "Vote completed submitting review" + ssh -p "$GERRIT_PORT" "$USER"@"$GERRIT_HOST" gerrit review "$GERRIT_PATCHSET_REVISION" --verified 1 + sleep 5 + ssh -p "$GERRIT_PORT" "$USER"@"$GERRIT_HOST" gerrit review "$GERRIT_PATCHSET_REVISION" --submit fi diff --git a/shell/release-job.sh b/shell/release-job.sh index 727aeb77..88b285c4 100644 --- a/shell/release-job.sh +++ b/shell/release-job.sh @@ -8,12 +8,14 @@ # which accompanies this distribution, and is available at # http://www.eclipse.org/legal/epl-v10.html ############################################################################## +echo "---> release-job.sh" + set -eu -o pipefail if [ -d "/opt/pyenv" ]; then - echo "---> Setting up pyenv" - export PYENV_ROOT="/opt/pyenv" - export PATH="$PYENV_ROOT/bin:$PATH" + echo "---> Setting up pyenv" + export PYENV_ROOT="/opt/pyenv" + export PATH="$PYENV_ROOT/bin:$PATH" fi PYTHONPATH=$(pwd) export PYTHONPATH @@ -29,12 +31,12 @@ MAVEN_CENTRAL_URL="${MAVEN_CENTRAL_URL:-None}" #OPTIONAL if grep -q "\.maven_central_url" "$release_file"; then - MAVEN_CENTRAL_URL="$(niet ".maven_central_url" "$release_file")" + MAVEN_CENTRAL_URL="$(niet ".maven_central_url" "$release_file")" fi if [ "${LOGS_SERVER}" == 'None' ]; then - echo "FAILED: log server not found" - exit 1 + echo "FAILED: log server not found" + exit 1 fi NEXUS_URL="${NEXUSPROXY:-$NEXUS_URL}" @@ -43,66 +45,66 @@ release_files=$(git diff HEAD^1 --name-only -- "releases/") echo "RELEASE FILES ARE AS FOLLOWS: $release_files" for release_file in $release_files; do - echo "This is the release file: $release_file" - echo "--> Verifying $release_file Schema." - echo "DUMMY CODE:" - #Make sure the schema check catches a missing trailing / on log_dir - #lftools schema is written, but not the schema file (yet) - echo "lftools schema verify [OPTIONS] $release_file $SCHEMAFILE" - - VERSION="$(niet ".version" "$release_file")" - PROJECT="$(niet ".project" "$release_file")" - LOG_DIR="$(niet ".log_dir" "$release_file")" - - - NEXUS_PATH="${SILO}/${JENKINS_HOSTNAME}/" - LOGS_URL="${LOGS_SERVER}/${NEXUS_PATH}${LOG_DIR}" - PATCH_DIR="$(mktemp -d)" - - pushd "$PATCH_DIR" - wget --quiet "${LOGS_URL}"staging-repo.txt.gz - STAGING_REPO="$(zcat staging-repo.txt)" - - #INFO - echo "INFO:" - echo "RELEASE_FILE: $release_file" - echo "LOGS_SERVER: $LOGS_SERVER" - echo "NEXUS_URL: $NEXUS_URL" - echo "NEXUS_PATH: $NEXUS_PATH" - echo "ODLNEXUSPROXY: $ODLNEXUSPROXY" - echo "JENKINS_HOSTNAME: $JENKINS_HOSTNAME" - echo "SILO: $SILO" - echo "PROJECT: $PROJECT" - echo "STAGING_REPO: $STAGING_REPO" - echo "VERSION: $VERSION" - echo "PROJECT: $PROJECT" - echo "LOG DIR: $LOG_DIR" - - wget --quiet "${LOGS_URL}"/patches/{"${PROJECT}".bundle,taglist.log.gz} - gunzip taglist.log.gz - cat "$PATCH_DIR"/taglist.log - popd - - git checkout "$(awk '{print $NF}' "$PATCH_DIR/taglist.log")" - git fetch "$PATCH_DIR/$PROJECT.bundle" - git merge --ff-only FETCH_HEAD - git tag -am "$PROJECT $VERSION" "v$VERSION" - sigul --batch -c "$SIGUL_CONFIG" sign-git-tag "$SIGUL_KEY" v"$VERSION" < "$SIGUL_PASSWORD" - echo "Showing latest signature for $PROJECT:" - git log --show-signature -n1 - - - ########## Merge Part ############## - if [[ "$JOB_NAME" =~ "merge" ]]; then - echo "Running merge" - git push origin "v$VERSION" - lftools nexus release --server "$NEXUS_URL" "$STAGING_REPO" - if [ "${MAVEN_CENTRAL_URL}" == 'None' ]; then - echo "No Maven central url specified, not pushing to maven central" - else - lftools nexus release --server "$MAVEN_CENTRAL_URL" "$STAGING_REPO" + echo "This is the release file: $release_file" + echo "--> Verifying $release_file Schema." + echo "DUMMY CODE:" + #Make sure the schema check catches a missing trailing / on log_dir + #lftools schema is written, but not the schema file (yet) + echo "lftools schema verify [OPTIONS] $release_file $SCHEMAFILE" + + VERSION="$(niet ".version" "$release_file")" + PROJECT="$(niet ".project" "$release_file")" + LOG_DIR="$(niet ".log_dir" "$release_file")" + + + NEXUS_PATH="${SILO}/${JENKINS_HOSTNAME}/" + LOGS_URL="${LOGS_SERVER}/${NEXUS_PATH}${LOG_DIR}" + PATCH_DIR="$(mktemp -d)" + + pushd "$PATCH_DIR" + wget --quiet "${LOGS_URL}"staging-repo.txt.gz + STAGING_REPO="$(zcat staging-repo.txt)" + + #INFO + echo "INFO:" + echo "RELEASE_FILE: $release_file" + echo "LOGS_SERVER: $LOGS_SERVER" + echo "NEXUS_URL: $NEXUS_URL" + echo "NEXUS_PATH: $NEXUS_PATH" + echo "ODLNEXUSPROXY: $ODLNEXUSPROXY" + echo "JENKINS_HOSTNAME: $JENKINS_HOSTNAME" + echo "SILO: $SILO" + echo "PROJECT: $PROJECT" + echo "STAGING_REPO: $STAGING_REPO" + echo "VERSION: $VERSION" + echo "PROJECT: $PROJECT" + echo "LOG DIR: $LOG_DIR" + + wget --quiet "${LOGS_URL}"/patches/{"${PROJECT}".bundle,taglist.log.gz} + gunzip taglist.log.gz + cat "$PATCH_DIR"/taglist.log + popd + + git checkout "$(awk '{print $NF}' "$PATCH_DIR/taglist.log")" + git fetch "$PATCH_DIR/$PROJECT.bundle" + git merge --ff-only FETCH_HEAD + git tag -am "$PROJECT $VERSION" "v$VERSION" + sigul --batch -c "$SIGUL_CONFIG" sign-git-tag "$SIGUL_KEY" v"$VERSION" < "$SIGUL_PASSWORD" + echo "Showing latest signature for $PROJECT:" + git log --show-signature -n1 + + + ########## Merge Part ############## + if [[ "$JOB_NAME" =~ "merge" ]]; then + echo "Running merge" + git push origin "v$VERSION" + lftools nexus release --server "$NEXUS_URL" "$STAGING_REPO" + if [ "${MAVEN_CENTRAL_URL}" == 'None' ]; then + echo "No Maven central url specified, not pushing to maven central" + else + lftools nexus release --server "$MAVEN_CENTRAL_URL" "$STAGING_REPO" + fi fi - fi done echo "########### End Script release-job.sh ###################################" -- 2.16.6