Merge "Add workaround for javadoc verify jobs"
authorAnil Belur <abelur@linuxfoundation.org>
Wed, 10 Jul 2019 08:50:17 +0000 (08:50 +0000)
committerGerrit Code Review <gerrit@linuxfoundation.org>
Wed, 10 Jul 2019 08:50:17 +0000 (08:50 +0000)
15 files changed:
docs/jjb/lf-info-vote.rst
docs/jjb/lf-macros.rst
docs/jjb/lf-maven-jobs.rst
docs/jjb/lf-release-jobs.rst
jjb/lf-ci-jobs.yaml
jjb/lf-maven-jobs.yaml
releasenotes/notes/configure-maven-sonar-goals-1b0018c932b2f9a1.yaml [new file with mode: 0644]
releasenotes/notes/openstack-cleanup-orphaned-ports-2619454ce4d083e3.yaml [new file with mode: 0644]
releasenotes/notes/openstack-stack-del-with-force-b50cadbacc49d516.yaml [new file with mode: 0644]
releasenotes/notes/standardize-nexus-proxy-release-job-9818485ddbfca867.yaml [new file with mode: 0644]
shell/check-info-votes.sh
shell/maven-sonar.sh
shell/openstack-cleanup-orphaned-ports.sh [new file with mode: 0644]
shell/openstack-cleanup-orphaned-stacks.sh
shell/release-job.sh

index 76c6d3d..64151f1 100644 (file)
@@ -7,7 +7,7 @@ INFO VOTE JOB
 Job counts the votes from the committers against a change
 to the INFO.yaml file
 
-If needed, will also check for a majority of tsc voters
+If needed, will also check for a majority of TSC voters
 (not yet implemented)
 
 Auto-merges the change on a majority vote.
index ab70a9f..6772eee 100644 (file)
@@ -250,7 +250,7 @@ Calls shell script to validate votes on a change to an INFO.yaml
 lf-releases
 -----------
 
-realises lftools.ini (required)
+releases lftools.ini (required)
 needed to push to nexus.
 
 [nexus]
index 85bebcc..ad59153 100644 (file)
@@ -466,6 +466,8 @@ interest in that kind of support.
     :java-version: Version of Java to use for the build. (default: openjdk8)
     :mvn-global-settings: The name of the Maven global settings to use for
         Maven configuration. (default: global-settings)
+    :mvn-goals: The maven goals to perform for the build.
+        (default: clean install)
     :mvn-opts: Sets MAVEN_OPTS. (default: '')
     :mvn-params: Additional mvn parameters to pass to the cli. (default: '')
     :mvn-version: Version of maven to use. (default: mvn35)
index b3a78e0..8565235 100644 (file)
@@ -28,7 +28,7 @@ Macros
 ======
 
 lf-releases
-----------------------
+-----------
 
 Release verify and merge jobs are the same except for their scm, trigger, and
 builders definition. This anchor is the common template.
index 2545a6b..a70e893 100644 (file)
     openstack-image-cleanup: true
     openstack-image-cleanup-age: 30
     openstack-image-protect: true
+    openstack-port-cleanup: true
     openstack-server-cleanup: true
     openstack-stack-cleanup: true
     openstack-volume-cleanup: true
           condition-expression: '{openstack-server-cleanup}'
           steps:
             - shell: !include-raw-escape: ../shell/openstack-cleanup-orphaned-servers.sh
+      # Ports
+      - conditional-step:
+          condition-kind: boolean-expression
+          condition-expression: '{openstack-port-cleanup}'
+          steps:
+            - shell: !include-raw-escape: ../shell/openstack-cleanup-orphaned-ports.sh
       # Volumes
       - conditional-step:
           condition-kind: boolean-expression
index f8982c0..e42dcde 100644 (file)
     github-url: 'https://github.com'
     java-version: openjdk8
     mvn-global-settings: global-settings
+    mvn-goals: clean install
     mvn-opts: ''
     mvn-params: ''
     mvn-version: mvn35
             - shell: echo 'Using SonarCloud'
             - lf-infra-maven-sonarcloud:
                 java-version: '{java-version}'
+                mvn-goals: '{mvn-goals}'
                 mvn-settings: '{mvn-settings}'
                 mvn-version: '{mvn-version}'
                 sonarcloud-project-key: '{sonarcloud-project-key}'
             - shell: echo 'Using SonarQube'
             - lf-infra-maven-sonar:
                 java-version: '{java-version}'
+                mvn-goals: '{mvn-goals}'
                 mvn-settings: '{mvn-settings}'
                 mvn-version: '{mvn-version}'
 
           java-version: '{java-version}'
       - inject:
           # Switch this to the sonar wrapper when JJB 2.0 is available
-          properties-content: SONAR_HOST_URL=$SONAR_URL
+          properties-content: |
+            SONAR_HOST_URL=$SONAR_URL
+            MAVEN_GOALS={mvn-goals}
       - lf-provide-maven-settings:
           global-settings-file: global-settings
           settings-file: '{mvn-settings}'
             SONAR_HOST_URL=https://sonarcloud.io
             PROJECT_KEY={sonarcloud-project-key}
             PROJECT_ORGANIZATION={sonarcloud-project-organization}
+            MAVEN_GOALS={mvn-goals}
             API_TOKEN={sonarcloud-api-token}
       - lf-provide-maven-settings:
           global-settings-file: global-settings
diff --git a/releasenotes/notes/configure-maven-sonar-goals-1b0018c932b2f9a1.yaml b/releasenotes/notes/configure-maven-sonar-goals-1b0018c932b2f9a1.yaml
new file mode 100644 (file)
index 0000000..642e355
--- /dev/null
@@ -0,0 +1,5 @@
+---
+fixes:
+  - |
+    Allow maven goals to be configured in maven-sonar.sh.
+    Set to "clean install" by default.
diff --git a/releasenotes/notes/openstack-cleanup-orphaned-ports-2619454ce4d083e3.yaml b/releasenotes/notes/openstack-cleanup-orphaned-ports-2619454ce4d083e3.yaml
new file mode 100644 (file)
index 0000000..77c24c2
--- /dev/null
@@ -0,0 +1,7 @@
+---
+features:
+  - |
+    Remove orphaned ports from the openstack cloud environment. These orphaned
+    ports are residue of CSIT jobs that needs to be purged, as a part of the
+    openstack cron job. A large number of stale jobs could cause IP address
+    allocation failures.
diff --git a/releasenotes/notes/openstack-stack-del-with-force-b50cadbacc49d516.yaml b/releasenotes/notes/openstack-stack-del-with-force-b50cadbacc49d516.yaml
new file mode 100644 (file)
index 0000000..31a973b
--- /dev/null
@@ -0,0 +1,5 @@
+---
+fixes:
+  - |
+    Delete stacks with the ``--force`` option to ensure that any delete
+    failures does not stop the openstack-cron jobs from continuing.
diff --git a/releasenotes/notes/standardize-nexus-proxy-release-job-9818485ddbfca867.yaml b/releasenotes/notes/standardize-nexus-proxy-release-job-9818485ddbfca867.yaml
new file mode 100644 (file)
index 0000000..ef9321f
--- /dev/null
@@ -0,0 +1,11 @@
+---
+upgrade:
+  - |
+    Projects using lf-release-jobs need to make sure they have the global
+    variable NEXUSPROXY added in Jenkins production and Jenkins sandbox
+    servers. The value of this variable should be the URL to the project's
+    Nexus server.
+fixes:
+  - |
+    Avoid the usage of project specific variables. Do not use ODLNEXUSPROXY
+    var, but instead use a generalized variable.
index 1e02a38..51ca172 100644 (file)
@@ -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
index 706697b..e78d156 100644 (file)
@@ -25,7 +25,7 @@ params+=("--settings $SETTINGS_FILE")
 
 # Disable SC2086 because we want to allow word splitting for $MAVEN_* parameters.
 # shellcheck disable=SC2086
-$MVN clean install \
+$MVN $MAVEN_GOALS \
     -e -Dsonar \
     ${params[*]} \
     $MAVEN_OPTIONS $MAVEN_PARAMS
diff --git a/shell/openstack-cleanup-orphaned-ports.sh b/shell/openstack-cleanup-orphaned-ports.sh
new file mode 100644 (file)
index 0000000..fac8d20
--- /dev/null
@@ -0,0 +1,27 @@
+#!/bin/bash -l
+# SPDX-License-Identifier: EPL-1.0
+##############################################################################
+# Copyright (c) 2019 The Linux Foundation and others.
+#
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License v1.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/epl-v10.html
+##############################################################################
+# Scans OpenStack for orphaned ports
+echo "---> Orphaned ports"
+
+os_cloud="${OS_CLOUD:-vex}"
+
+set -eux -o pipefail
+
+mapfile -t os_ports < <(openstack --os-cloud "$os_cloud" port list -f value -c ID -c status | egrep DOWN | awk '{print $1}')
+
+if [ ${#os_ports[@]} -eq 0 ]; then
+    echo "No orphaned ports found."
+else
+    for port in "${os_ports[@]}"; do
+        echo "Removing orphaned port $port"
+        openstack --os-cloud "$os_cloud" port delete "$port"
+    done
+fi
index 8140ade..ccc2996 100644 (file)
@@ -87,6 +87,6 @@ for STACK_NAME in "${OS_STACKS[@]}"; do
         continue
     else
         echo "Deleting orphaned stack: $STACK_NAME"
-        lftools openstack --os-cloud "$os_cloud" stack delete "$STACK_NAME"
+        lftools openstack --os-cloud "$os_cloud" stack delete --force "$STACK_NAME"
     fi
 done
index a5ab116..88b285c 100644 (file)
@@ -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,80 +31,80 @@ 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="${ODLNEXUSPROXY:-$NEXUS_URL}"
+NEXUS_URL="${NEXUSPROXY:-$NEXUS_URL}"
 
 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 ###################################"