From efce69317c6b74c8f3f5c869efed5bc4f533dd7c Mon Sep 17 00:00:00 2001 From: Anil Belur Date: Wed, 7 Feb 2024 13:05:28 +1000 Subject: [PATCH] Feat!: Update JJB version to 6x Jenkins Job Builder 6.0.0 is released and breaks backward compatibility with 5.1.0. The breaking changes with previous 5.1.0 release: - Jobs are now expanded the same way as job templates. - Macros without parameters are now expanded the same way as macros with parameters. - Tags !include-raw: and !include-raw-escape: should now be used the same way in jobs and macros without parameters as they are used in job templates and macros with parameters. - Update pre-commit dependencies Ref: https://storyboard.openstack.org/#!/story/2010963 https://storyboard.openstack.org/#!/story/2010588 NOTE: Set the var "JJB_VERSION" to "6.0.0" at the GH orginazation level for GHA JJB Verify to pick up the latest version of JJB. Issue-ID: CIMAN-33 LF-JIRA RELENG-5131 Change-Id: Icdeecb8bf216ceab4c5af5720f3bd89d3ef2621d Signed-off-by: Anil Belur --- .pre-commit-config.yaml | 6 ++-- global-jjb | 2 +- jjb/integration/integration-macros.yaml | 8 ++--- jjb/integration/netconf-pnp-simulator-verify.sh | 12 ++++---- tox.ini | 39 ++++++++++++++++++++----- 5 files changed, 46 insertions(+), 21 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index ca94141f5..497c63417 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,7 +1,7 @@ --- repos: - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v4.4.0 + rev: v4.5.0 hooks: - id: trailing-whitespace - id: check-executables-have-shebangs @@ -21,12 +21,12 @@ repos: - id: gitlint - repo: https://github.com/adrienverge/yamllint.git - rev: v1.31.0 + rev: v1.34.0 hooks: - id: yamllint - repo: https://github.com/pre-commit/mirrors-prettier - rev: v3.0.0-alpha.9-for-vscode + rev: v4.0.0-alpha.8 hooks: - id: prettier stages: [commit] diff --git a/global-jjb b/global-jjb index 766dbef8a..5d336574e 160000 --- a/global-jjb +++ b/global-jjb @@ -1 +1 @@ -Subproject commit 766dbef8a63d824d6e551d4f179806521be95d13 +Subproject commit 5d336574e77fb349ace15356ef8ffb816d463544 diff --git a/jjb/integration/integration-macros.yaml b/jjb/integration/integration-macros.yaml index 5e9099908..a101a71b4 100644 --- a/jjb/integration/integration-macros.yaml +++ b/jjb/integration/integration-macros.yaml @@ -40,7 +40,7 @@ - builder: name: integration-install-robotframework-py3 builders: - - shell: !include-raw: + - shell: !include-raw-escape: - include-raw-integration-install-robotframework-py3.sh - builder: @@ -48,13 +48,13 @@ builders: - shell: | git clone https://gerrit.onap.org/r/ci-management /tmp/ci-management - cp /tmp/ci-management/jjb/integration/*csit.sh ${WORKSPACE} - ${WORKSPACE}/run-csit.sh ${TESTPLAN} ${TESTOPTIONS} + cp /tmp/ci-management/jjb/integration/*csit.sh "$WORKSPACE" + "$WORKSPACE/run-csit.sh" "$TESTPLAN" "$TESTOPTIONS" - builder: name: integration-run-project-test builders: - - shell: "${WORKSPACE}/csit/run-project-csit.sh ${TESTOPTIONS}" + - shell: "$WORKSPACE/csit/run-project-csit.sh $TESTOPTIONS" - builder: name: integration-autorelease-fix-relativepaths diff --git a/jjb/integration/netconf-pnp-simulator-verify.sh b/jjb/integration/netconf-pnp-simulator-verify.sh index 28e8ae3b6..6617f70c3 100644 --- a/jjb/integration/netconf-pnp-simulator-verify.sh +++ b/jjb/integration/netconf-pnp-simulator-verify.sh @@ -25,7 +25,7 @@ DOCKER_COMPOSE_LOG="/tmp/docker-compose.log" DOCKER_COMPOSE_LOG_MSG=( "success:" "entered RUNNING state" ) DOCKER_COMPOSE_SLEEP_INTERVAL=60 -if [ -z ${NETCONF_SIM_SERVICE_NAME} ]; +if [ -z "$NETCONF_SIM_SERVICE_NAME" ]; then echo "ERROR: netconf-pnp-simulator service name not set." exit 1 @@ -34,17 +34,17 @@ fi pushd $DOCKER_ROOT # Dump container logs -sleep ${DOCKER_COMPOSE_SLEEP_INTERVAL} # Hang for a while so the services settle -docker-compose logs --no-color > ${DOCKER_COMPOSE_LOG} +sleep "$DOCKER_COMPOSE_SLEEP_INTERVAL" # Hang for a while so the services settle +docker-compose logs --no-color > "$DOCKER_COMPOSE_LOG" # Get the supervisord services running within container -supervisord_services=($(docker-compose exec -T ${NETCONF_SIM_SERVICE_NAME} /bin/sh -c \ +supervisord_services=($(docker-compose exec -T "$NETCONF_SIM_SERVICE_NAME" /bin/sh -c \ 'cat /etc/supervisord.conf /etc/supervisord.d/*' | grep -ho "program:[-a-zA-Z0-9]*" | cut -d: -f 2)) # Check all services are running and fail if not -for service in ${supervisord_services[@]}; +for service in "${{supervisord_services[@]}}"; do - if ! grep -q "${DOCKER_COMPOSE_LOG_MSG[0]} $service ${DOCKER_COMPOSE_LOG_MSG[1]}" ${DOCKER_COMPOSE_LOG}; + if ! grep -q "${{DOCKER_COMPOSE_LOG_MSG[0]}} $service ${{DOCKER_COMPOSE_LOG_MSG[1]}}" "$DOCKER_COMPOSE_LOG"; then echo "ERROR: Service $service is not running, failing the build." exit 1 diff --git a/tox.ini b/tox.ini index a88044059..fc81f926a 100644 --- a/tox.ini +++ b/tox.ini @@ -1,13 +1,38 @@ [tox] minversion = 1.6 -envlist = coala +envlist = jjb-version skipsdist = true -[testenv:coala] -basepython = python3 +[testenv:jenkins-jobs] deps = - coala - coala-bears + jenkins-job-builder=={env:JJB_VERSION:6.0.0} +commands = + jenkins-jobs {posargs:--help} + +[testenv:jjb-version] +commands = python {toxinidir}/check_jjb_version.py + +[testenv:pre-commit-install] +basepython = python3 +deps = pre-commit +commands = + pre-commit install + pre-commit install --hook-type commit-msg + +[testenv:pre-commit-uninstall] +basepython = python3 +deps = pre-commit +commands = + pre-commit uninstall + pre-commit uninstall --hook-type commit-msg + +[testenv:pre-commit] +basepython = python3 +deps = pre-commit +passenv = HOME commands = - python3 -m nltk.downloader punkt maxent_treebank_pos_tagger averaged_perceptron_tagger - coala --non-interactive + pre-commit run --all-files --show-diff-on-failure + pre-commit run gitlint --hook-stage commit-msg --commit-msg-filename .git/COMMIT_EDITMSG + # Gitlint only proposes a pre-commit configuration for the commit-msg stage but none for the commit stage. + # Its default arguments --passed and --msg-filename are different from CI recommandations. + # As a result, the line above is always skipped in jenkins CI since there cannot be a .git/COMMIT_EDITMSG file. -- 2.16.6