]> git.apps.os.sepia.ceph.com Git - ceph-build.git/commitdiff
ceph-dev-*: Trigger separate job to inform shaman of failure wip-fail-on-jenkins 1895/head
authorDavid Galloway <dgallowa@redhat.com>
Thu, 19 Aug 2021 20:23:02 +0000 (16:23 -0400)
committerDavid Galloway <dgallowa@redhat.com>
Thu, 19 Aug 2021 20:25:52 +0000 (16:25 -0400)
Fixes: https://tracker.ceph.com/issues/17912
Signed-off-by: David Galloway <dgallowa@redhat.com>
build-failure/build/failure [new file with mode: 0644]
build-failure/config/definitions/build-failure.yml [new file with mode: 0644]
ceph-dev-build/config/definitions/ceph-dev-build.yml
ceph-dev-new-build/config/definitions/ceph-dev-new-build.yml
ceph-dev-new-setup/config/definitions/ceph-dev-new-setup.yml
ceph-dev-setup/config/definitions/ceph-dev-setup.yml

diff --git a/build-failure/build/failure b/build-failure/build/failure
new file mode 100644 (file)
index 0000000..a99c166
--- /dev/null
@@ -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 (file)
index 0000000..a6b7b07
--- /dev/null
@@ -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
+
index e657ff9c2ad89af90185ff5b9c9348c82b40bf59..32c203b8a14e3c10a1b7147cfa328c0293643ab5 100644 (file)
                   - 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:
index 493907e551138bd0f899d0020553119b47579338..4f047c07c9a90d0cc99b00a6f4d73009f17805ff 100644 (file)
                   - 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:
index 37ec6670b60d72711b40ff6a998b8431c0ef6c55..c59a5e8ef20eaec6c1f8becf275588832c28cd5f 100644 (file)
                   - FAILURE
                   - ABORTED
               build-steps:
-                - shell:
-                    !include-raw:
-                      - ../../../scripts/build_utils.sh
-                      - ../../build/failure
+                - trigger-builds:
+                    - project: 'build-failure'
+                      current-parameters: true
 
     wrappers:
       - inject-passwords:
index dde05fc82578bfad31520e8be5ac3dcadd0b7be1..8d70b06e2ffc4c6304f59bbaac053e0aedd15f69 100644 (file)
                   - FAILURE
                   - ABORTED
               build-steps:
-                - shell:
-                    !include-raw:
-                      - ../../../scripts/build_utils.sh
-                      - ../../build/failure
+                - trigger-builds:
+                    - project: 'build-failure'
+                      current-parameters: true
 
     wrappers:
       - inject-passwords: