From e2d77861a8298614065342c56ba333740a8f716b Mon Sep 17 00:00:00 2001 From: David Galloway Date: Thu, 19 Aug 2021 16:23:02 -0400 Subject: [PATCH] ceph-dev-*: Trigger separate job to inform shaman of failure Fixes: https://tracker.ceph.com/issues/17912 Signed-off-by: David Galloway --- build-failure/build/failure | 42 +++++++++++++++++++ .../config/definitions/build-failure.yml | 25 +++++++++++ .../config/definitions/ceph-dev-build.yml | 9 ++-- .../config/definitions/ceph-dev-new-build.yml | 9 ++-- .../config/definitions/ceph-dev-new-setup.yml | 7 ++-- .../config/definitions/ceph-dev-setup.yml | 7 ++-- 6 files changed, 79 insertions(+), 20 deletions(-) create mode 100644 build-failure/build/failure create mode 100644 build-failure/config/definitions/build-failure.yml diff --git a/build-failure/build/failure b/build-failure/build/failure new file mode 100644 index 00000000..a99c166e --- /dev/null +++ b/build-failure/build/failure @@ -0,0 +1,42 @@ +#!/bin/bash -ex + +# note: the failed_build_status call relies on normalized variable names that +# are infered by the builds themselves. If the build fails before these are +# set, they will be posted with empty values +BRANCH=`branch_slash_filter $BRANCH` + +# This build-failure job will only have one word for the $DISTROS parameter +# because all the failed job's paramters are passed to this job when it's triggered. +case $DISTROS in + focal) + NORMAL_DISTRO="ubuntu" + NORMAL_DISTRO_VERSION="focal" + ;; + bionic) + NORMAL_DISTRO="ubuntu" + NORMAL_DISTRO_VERSION="bionic" + ;; + centos8) + NORMAL_DISTRO="centos" + NORMAL_DISTRO_VERSION="8" + ;; + centos7) + NORMAL_DISTRO="centos" + NORMAL_DISTRO_VERSION="7" + ;; + leap15) + NORMAL_DISTRO="opensuse" + NORMAL_DISTRO_VERSION="15.2" + ;; + windows) + NORMAL_DISTRO="windows" + NORMAL_DISTRO_VERSION="1809" + ;; + *) + echo "Unable to determine distro.\nThis job will be unable to notify shaman of a build failure and it will remain in \"building\" indefinitely." + exit 1 + ;; +esac + +# update shaman with the failed build status +failed_build_status "ceph" $NORMAL_DISTRO $NORMAL_DISTRO_VERSION $ARCHS diff --git a/build-failure/config/definitions/build-failure.yml b/build-failure/config/definitions/build-failure.yml new file mode 100644 index 00000000..a6b7b07b --- /dev/null +++ b/build-failure/config/definitions/build-failure.yml @@ -0,0 +1,25 @@ +- job: + name: build-failure + description: "This job gets triggered by ceph-dev-*-{setup,build} when the job fails.\r\nThis is useful for when a Jenkins builder crashes and can't run the failure script itself." + project-type: freestyle + defaults: global + quiet-period: 5 + block-downstream: false + block-upstream: false + properties: + - build-discarder: + days-to-keep: 14 + discard-old-builds: true + + builders: + - shell: + !include-raw: + - ../../../scripts/build_utils.sh + - ../../build/failure + + wrappers: + - credentials-binding: + - text: + credential-id: shaman-api-key + variable: SHAMAN_API_KEY + diff --git a/ceph-dev-build/config/definitions/ceph-dev-build.yml b/ceph-dev-build/config/definitions/ceph-dev-build.yml index e657ff9c..32c203b8 100644 --- a/ceph-dev-build/config/definitions/ceph-dev-build.yml +++ b/ceph-dev-build/config/definitions/ceph-dev-build.yml @@ -114,12 +114,9 @@ - FAILURE - ABORTED build-steps: - - inject: - properties-file: ${WORKSPACE}/build_info - - shell: - !include-raw: - - ../../../scripts/build_utils.sh - - ../../build/failure + - trigger-builds: + - project: 'build-failure' + current-parameters: true wrappers: - inject-passwords: diff --git a/ceph-dev-new-build/config/definitions/ceph-dev-new-build.yml b/ceph-dev-new-build/config/definitions/ceph-dev-new-build.yml index 493907e5..4f047c07 100644 --- a/ceph-dev-new-build/config/definitions/ceph-dev-new-build.yml +++ b/ceph-dev-new-build/config/definitions/ceph-dev-new-build.yml @@ -122,12 +122,9 @@ - FAILURE - ABORTED build-steps: - - inject: - properties-file: ${WORKSPACE}/build_info - - shell: - !include-raw: - - ../../../scripts/build_utils.sh - - ../../build/failure + - trigger-builds: + - project: 'build-failure' + current-parameters: true wrappers: - inject-passwords: diff --git a/ceph-dev-new-setup/config/definitions/ceph-dev-new-setup.yml b/ceph-dev-new-setup/config/definitions/ceph-dev-new-setup.yml index 37ec6670..c59a5e8e 100644 --- a/ceph-dev-new-setup/config/definitions/ceph-dev-new-setup.yml +++ b/ceph-dev-new-setup/config/definitions/ceph-dev-new-setup.yml @@ -51,10 +51,9 @@ - FAILURE - ABORTED build-steps: - - shell: - !include-raw: - - ../../../scripts/build_utils.sh - - ../../build/failure + - trigger-builds: + - project: 'build-failure' + current-parameters: true wrappers: - inject-passwords: diff --git a/ceph-dev-setup/config/definitions/ceph-dev-setup.yml b/ceph-dev-setup/config/definitions/ceph-dev-setup.yml index dde05fc8..8d70b06e 100644 --- a/ceph-dev-setup/config/definitions/ceph-dev-setup.yml +++ b/ceph-dev-setup/config/definitions/ceph-dev-setup.yml @@ -51,10 +51,9 @@ - FAILURE - ABORTED build-steps: - - shell: - !include-raw: - - ../../../scripts/build_utils.sh - - ../../build/failure + - trigger-builds: + - project: 'build-failure' + current-parameters: true wrappers: - inject-passwords: -- 2.39.5