From d75b6bb8373eb649eb694113f73a9207cce3602f Mon Sep 17 00:00:00 2001 From: Dave Wallace Date: Mon, 25 Jan 2021 21:41:14 -0500 Subject: Skip VPP build for merge jobs with Gerrit ID != git HEAD. - Since merge jobs are serialized after the patches have been merged into git, all merge jobs which do not have the same Gerrit ID as git HEAD are redundant. Skip them to save useless cycles and to reduce the size of the build queues when multiple patches are merged in a short amount of time. - This also fixes the issue with packagecloud packages containing different contents then the associated Gerrit ID when built & pushed in this state. Change-Id: I822492bd1d523576373bb268258c181a9c5edb42 Signed-off-by: Dave Wallace --- jjb/scripts/packagecloud_push.sh | 23 +++++++++++++++++++---- jjb/scripts/vpp/build.sh | 37 ++++++++++++++++++++++--------------- jjb/scripts/vpp/docs.sh | 32 +++++++++++++++++++++----------- jjb/scripts/vpp/make-test-docs.sh | 28 +++++++++++++++++++--------- jjb/scripts/vpp/sphinx-docs.sh | 30 ++++++++++++++++++++---------- 5 files changed, 101 insertions(+), 49 deletions(-) (limited to 'jjb') diff --git a/jjb/scripts/packagecloud_push.sh b/jjb/scripts/packagecloud_push.sh index af3bf48ff..a4ae9b166 100644 --- a/jjb/scripts/packagecloud_push.sh +++ b/jjb/scripts/packagecloud_push.sh @@ -1,6 +1,6 @@ #!/bin/bash -# Copyright (c) 2020 Cisco and/or its affiliates. +# Copyright (c) 2021 Cisco and/or its affiliates. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at: @@ -17,6 +17,22 @@ echo "---> jjb/scripts/packagecloud_push.sh" set -euxo pipefail +line="*************************************************************************" + +# Nothing was built if this is a merge job being run when +# the git HEAD id is not the same as the Gerrit New Revision ID +if [[ ${JOB_NAME} == *merge* ]] && [ -n "${GERRIT_NEWREV:-}" ] && + [ "$GERRIT_NEWREV" != "$GIT_COMMIT" ] ; then + echo -e "\n$line\nSkipping package push. A newer patch has been merged.\n$line\n" + exit 0 +fi + +DRYRUN="${DRYRUN:-}" +if [ "${DRYRUN,,}" = "true" ] ; then + echo -e "\n$line\nSkipping package push because DRYRUN is '${DRYRUN,,}'.\n$line\n" + exit 0 +fi + echo "STARTING PACKAGECLOUD PUSH" sleep 10 @@ -58,8 +74,7 @@ if [ -f ~/.packagecloud ]; then fi ;; *) - echo "ERROR: Unsupported OS '$FACTER_OS'" - echo "PACKAGECLOUD PUSH FAILED!" + echo -e "\n$line\n* ERROR: Unsupported OS '$FACTER_OS'\n* PACKAGECLOUD PUSH FAILED!\n$line\n" exit 1 ;; esac @@ -83,4 +98,4 @@ else exit 1 fi -echo "PACKAGECLOUD PUSH COMPLETE" +echo -e "\n$line\n* PACKAGECLOUD PUSH COMPLETE\n$line\n" diff --git a/jjb/scripts/vpp/build.sh b/jjb/scripts/vpp/build.sh index 52cee0978..148999cec 100644 --- a/jjb/scripts/vpp/build.sh +++ b/jjb/scripts/vpp/build.sh @@ -1,7 +1,6 @@ #!/bin/bash -# basic build script example -# Copyright (c) 2020 Cisco and/or its affiliates. +# Copyright (c) 2021 Cisco and/or its affiliates. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at: @@ -16,11 +15,24 @@ echo "---> jjb/scripts/vpp/build.sh" -set -xe -o pipefail +set -euxo pipefail + +line="*************************************************************************" +# Don't build anything if this is a merge job being run when +# the git HEAD id is not the same as the Gerrit New Revision id. +if [[ ${JOB_NAME} == *merge* ]] && [ -n "${GERRIT_NEWREV:-}" ] && + [ "$GERRIT_NEWREV" != "$GIT_COMMIT" ] ; then + echo -e "\n$line\nSkipping build. A newer patch has been merged.\n$line\n" + exit 0 +fi OS_ID=$(grep '^ID=' /etc/os-release | cut -f2- -d= | sed -e 's/\"//g') OS_VERSION_ID=$(grep '^VERSION_ID=' /etc/os-release | cut -f2- -d= | sed -e 's/\"//g') OS_ARCH=$(uname -m) +DRYRUN="${DRYRUN:-}" +IS_CSIT_VPP_JOB="${IS_CSIT_VPP_JOB:-}" +MAKE_PARALLEL_FLAGS="${MAKE_PARALLEL_FLAGS:-}" +MAKE_PARALLEL_JOBS="${MAKE_PARALLEL_JOBS:-}" echo "sha1sum of this script: ${0}" sha1sum $0 @@ -35,11 +47,11 @@ sha1sum $0 # echo $CCACHE_DIR does not exist. #fi -if [ "x${MAKE_PARALLEL_FLAGS}" != "x" ] +if [ -n "${MAKE_PARALLEL_FLAGS}" ] then echo "Building VPP. Number of cores for build set with" \ "MAKE_PARALLEL_FLAGS='${MAKE_PARALLEL_FLAGS}'." -elif [ "x${MAKE_PARALLEL_JOBS}" != "x" ] +elif [ -n "${MAKE_PARALLEL_JOBS}" ] then echo "Building VPP. Number of cores for build set with" \ "MAKE_PARALLEL_JOBS='${MAKE_PARALLEL_JOBS}'." @@ -48,14 +60,11 @@ else "using build default ($(grep -c ^processor /proc/cpuinfo))." fi -echo "CC=${CC}" -echo "IS_CSIT_VPP_JOB=${IS_CSIT_VPP_JOB}" - # If we are not a CSIT job just building packages, then use make verify, # else use make pkg-verify. -if [ "x${IS_CSIT_VPP_JOB}" != "xTrue" ] +if [ "${IS_CSIT_VPP_JOB,,}" != "true" ] then - if [ "x${MAKE_PARALLEL_JOBS}" != "x" ] + if [ -n "${MAKE_PARALLEL_JOBS}" ] then export TEST_JOBS="${MAKE_PARALLEL_JOBS}" echo "Testing VPP with ${TEST_JOBS} cores." @@ -65,12 +74,10 @@ then "See test logs for the exact number." fi echo "Building using \"make verify\"" - [ "x${DRYRUN}" == "xTrue" ] || make UNATTENDED=yes verify + [ "${DRYRUN,,}" = "true" ] || make UNATTENDED=yes verify else echo "Building using \"make pkg-verify\"" - [ "x${DRYRUN}" == "xTrue" ] || make UNATTENDED=yes pkg-verify + [ "${DRYRUN,,}" = "true" ] || make UNATTENDED=yes pkg-verify fi -echo "*******************************************************************" -echo "* VPP ${OS_ID^^}-${OS_VERSION_ID}-${OS_ARCH^^} BUILD SUCCESSFULLY COMPLETED" -echo "*******************************************************************" +echo -e "\n$line\n* VPP ${OS_ID^^}-${OS_VERSION_ID}-${OS_ARCH^^} BUILD SUCCESSFULLY COMPLETED\n$line\n" diff --git a/jjb/scripts/vpp/docs.sh b/jjb/scripts/vpp/docs.sh index 0899b6615..866b32217 100644 --- a/jjb/scripts/vpp/docs.sh +++ b/jjb/scripts/vpp/docs.sh @@ -1,6 +1,6 @@ #!/bin/bash -# Copyright (c) 2020 Cisco and/or its affiliates. +# Copyright (c) 2021 Cisco and/or its affiliates. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at: @@ -15,19 +15,29 @@ echo "---> jjb/scripts/vpp/docs.sh" -set -xe -o pipefail -[ "$DOCS_REPO_URL" ] || DOCS_REPO_URL="https://nexus.fd.io/content/sites/site" -[ "$PROJECT_PATH" ] || PROJECT_PATH=io/fd/vpp -[ "$DOC_FILE" ] || DOC_FILE=vpp.docs.zip -[ "$DOC_DIR" ] || DOC_DIR=build-root/docs/html -[ "$SITE_DIR" ] || SITE_DIR=build-root/docs/deploy-site/ -[ "$RESOURCES_DIR" ] || RESOURCES_DIR=${SITE_DIR}/src/site/resources -[ "$MVN" ] || MVN="/opt/apache/maven/bin/mvn" -[ "$VERSION" ] || VERSION=$(./build-root/scripts/version rpm-version) +set -euxo pipefail + +line="*************************************************************************" +# Don't build anything if this is a merge job being run when +# the git HEAD id is not the same as the Gerrit New Revision id. +if [[ ${JOB_NAME} == *merge* ]] && [ -n "${GERRIT_NEWREV:-}" ] && + [ "$GERRIT_NEWREV" != "$GIT_COMMIT" ] ; then + echo -e "\n$line\nSkipping doxygen docs build. A newer patch has been merged.\n$line\n" + exit 0 +fi + +DOCS_REPO_URL=${DOCS_REPO_URL:-"https://nexus.fd.io/content/sites/site"} +PROJECT_PATH=${PROJECT_PATH:-"io/fd/vpp"} +DOC_FILE=${DOC_FILE:-"vpp.docs.zip"} +DOC_DIR=${DOC_DIR:-"build-root/docs/html"} +SITE_DIR=${SITE_DIR:-"build-root/docs/deploy-site"} +RESOURCES_DIR=${RESOURCES_DIR:-"${SITE_DIR}/src/site/resources"} +MVN=${MVN:-"/opt/apache/maven/bin/mvn"} +VERSION=${VERSION:-"$(./build-root/scripts/version rpm-version)"} make doxygen -if [[ ${JOB_NAME} == *merge* ]]; then +if [[ ${JOB_NAME} == *merge* ]] ; then mkdir -p $(dirname ${RESOURCES_DIR}) mv -f ${DOC_DIR} ${RESOURCES_DIR} cd ${SITE_DIR} diff --git a/jjb/scripts/vpp/make-test-docs.sh b/jjb/scripts/vpp/make-test-docs.sh index d15cac380..d20a7b817 100644 --- a/jjb/scripts/vpp/make-test-docs.sh +++ b/jjb/scripts/vpp/make-test-docs.sh @@ -1,6 +1,6 @@ #!/bin/bash -# Copyright (c) 2020 Cisco and/or its affiliates. +# Copyright (c) 2021 Cisco and/or its affiliates. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at: @@ -15,14 +15,24 @@ echo "---> jjb/scripts/vpp/make-test-docs.sh" -set -xe -o pipefail -[ "$DOCS_REPO_URL" ] || DOCS_REPO_URL="https://nexus.fd.io/content/sites/site" -[ "$PROJECT_PATH" ] || PROJECT_PATH=io/fd/vpp -[ "$DOC_DIR" ] || DOC_DIR=build-root/build-test/doc/html -[ "$SITE_DIR" ] || SITE_DIR=build-root/docs/deploy-site -[ "$RESOURCES_DIR" ] || RESOURCES_DIR=${SITE_DIR}/src/site/resources/vpp_make_test -[ "$MVN" ] || MVN="/opt/apache/maven/bin/mvn" -[ "$VERSION" ] || VERSION=$(./build-root/scripts/version rpm-version) +set -euxo pipefail + +line="*************************************************************************" +# Don't build anything if this is a merge job being run when +# the git HEAD id is not the same as the Gerrit New Revision id. +if [[ ${JOB_NAME} == *merge* ]] && [ -n "${GERRIT_NEWREV:-}" ] && + [ "$GERRIT_NEWREV" != "$GIT_COMMIT" ] ; then + echo -e "\n$line\nSkipping 'make test' doxygen docs build. A newer patch has been merged.\n$line\n" + exit 0 +fi + +DOCS_REPO_URL=${DOCS_REPO_URL:-"https://nexus.fd.io/content/sites/site"} +PROJECT_PATH=${PROJECT_PATH:-"io/fd/vpp"} +DOC_DIR=${DOC_DIR:-"build-root/build-test/doc/html"} +SITE_DIR=${SITE_DIR:-"build-root/docs/deploy-site"} +RESOURCES_DIR=${RESOURCES_DIR:-"${SITE_DIR}/src/site/resources/vpp_make_test"} +MVN=${MVN:-"/opt/apache/maven/bin/mvn"} +VERSION=${VERSION:-"$(./build-root/scripts/version rpm-version)"} make test-doc diff --git a/jjb/scripts/vpp/sphinx-docs.sh b/jjb/scripts/vpp/sphinx-docs.sh index b9eb64bc7..d80b4cd38 100644 --- a/jjb/scripts/vpp/sphinx-docs.sh +++ b/jjb/scripts/vpp/sphinx-docs.sh @@ -1,6 +1,6 @@ #!/bin/bash -# Copyright (c) 2020 Cisco and/or its affiliates. +# Copyright (c) 2021 Cisco and/or its affiliates. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at: @@ -15,15 +15,25 @@ echo "---> jjb/scripts/vpp/sphinx-docs.sh" -set -xe -o pipefail -[ "$DOCS_REPO_URL" ] || DOCS_REPO_URL="https://nexus.fd.io/content/sites/site" -[ "$PROJECT_PATH" ] || PROJECT_PATH=io/fd/vpp -[ "$DOC_FILE" ] || DOC_FILE=vpp.docs.zip -[ "$DOC_DIR" ] || DOC_DIR=./docs/_build/html -[ "$SITE_DIR" ] || SITE_DIR=build-root/docs/deploy-site -[ "$RESOURCES_DIR" ] || RESOURCES_DIR=${SITE_DIR}/src/site/resources -[ "$MVN" ] || MVN="/opt/apache/maven/bin/mvn" -[ "$VERSION" ] || VERSION=$(./build-root/scripts/version rpm-version) +set -euxo pipefail + +line="*************************************************************************" +# Don't build anything if this is a merge job being run when +# the git HEAD id is not the same as the Gerrit New Revision id. +if [[ ${JOB_NAME} == *merge* ]] && [ -n "${GERRIT_NEWREV:-}" ] && + [ "$GERRIT_NEWREV" != "$GIT_COMMIT" ] ; then + echo -e "\n$line\nSkipping sphinx docs build. A newer patch has been merged.\n$line\n" + exit 0 +fi + +DOCS_REPO_URL=${DOCS_REPO_URL:-"https://nexus.fd.io/content/sites/site"} +PROJECT_PATH=${PROJECT_PATH:-"io/fd/vpp"} +DOC_FILE=${DOC_FILE:-"vpp.docs.zip"} +DOC_DIR=${DOC_DIR:-"./docs/_build/html"} +SITE_DIR=${SITE_DIR:-"build-root/docs/deploy-site"} +RESOURCES_DIR=${RESOURCES_DIR:-"${SITE_DIR}/src/site/resources"} +MVN=${MVN:-"/opt/apache/maven/bin/mvn"} +VERSION=${VERSION:-"$(./build-root/scripts/version rpm-version)"} make docs-venv CONFIRM=-y FORCE=--force-yes make docs -- cgit 1.2.3-korg