sts-sponsors team mailing list archive
-
sts-sponsors team
-
Mailing list archive
-
Message #08981
[Merge] ~lloydwaltersj/maas-ci/+git/maas-ci-config:fix-trigger-issue into ~maas-committers/maas-ci/+git/maas-ci-config:master
Jack Lloyd-Walters has proposed merging ~lloydwaltersj/maas-ci/+git/maas-ci-config:fix-trigger-issue into ~maas-committers/maas-ci/+git/maas-ci-config:master.
Commit message:
add a parameter to report failures, rather than relying on an old build cause methos
Requested reviews:
MAAS Committers (maas-committers)
For more details, see:
https://code.launchpad.net/~lloydwaltersj/maas-ci/+git/maas-ci-config/+merge/444182
--
Your team MAAS Committers is requested to review the proposed merge of ~lloydwaltersj/maas-ci/+git/maas-ci-config:fix-trigger-issue into ~maas-committers/maas-ci/+git/maas-ci-config:master.
diff --git a/jenkins/jobs/ansible_collection.groovy b/jenkins/jobs/ansible_collection.groovy
index a54af91..86c6b61 100644
--- a/jenkins/jobs/ansible_collection.groovy
+++ b/jenkins/jobs/ansible_collection.groovy
@@ -188,7 +188,7 @@ pipeline {
}
failure {
script {
- if (params.GITHUB_BRANCH == "main" && currentBuild.getBuildCauses("hudson.triggers.TimerTrigger$TimerTriggerCause")) {
+ if (params.reportFailure) {
mattermostSend (color: 'red', message: "[${env.JOB_NAME} #${env.BUILD_NUMBER}](${env.BUILD_URL}) [${params.GH_BRANCH}](${params.GH_REPO}/commit/${env.COMMIT_SHA}) :fire: failed")
}
}
diff --git a/jenkins/jobs/ansible_collection.yaml b/jenkins/jobs/ansible_collection.yaml
index bff14f5..d305326 100644
--- a/jenkins/jobs/ansible_collection.yaml
+++ b/jenkins/jobs/ansible_collection.yaml
@@ -78,6 +78,10 @@
name: MAAS_TEST_VIRSH_HOST
description: "The host or address to add as a Virsh host in the tests"
default: "arm64.labmaas"
+ - bool:
+ name: reportFailure
+ description: Whether to report a failure message to mattermost for this job
+ default: True
triggers:
- timed: '@daily'
dsl: !include-jinja2: ansible_collection.groovy
diff --git a/jenkins/jobs/ansible_playbook.groovy b/jenkins/jobs/ansible_playbook.groovy
index cc2a552..fe37fb9 100644
--- a/jenkins/jobs/ansible_playbook.groovy
+++ b/jenkins/jobs/ansible_playbook.groovy
@@ -81,7 +81,7 @@ pipeline {
}
failure {
script {
- if (params.GITHUB_BRANCH == "main" && currentBuild.getBuildCauses("hudson.triggers.TimerTrigger$TimerTriggerCause")) {
+ if (params.reportFailure) {
mattermostSend (color: 'red', message: "[${env.JOB_NAME} #${env.BUILD_NUMBER}](${env.BUILD_URL}) [${params.GITHUB_BRANCH}](${params.GITHUB_REPO}/commit/${env.COMMIT_SHA}) :fire: failed")
}
}
diff --git a/jenkins/jobs/ansible_playbook.yaml b/jenkins/jobs/ansible_playbook.yaml
index d5f5e67..50eae09 100644
--- a/jenkins/jobs/ansible_playbook.yaml
+++ b/jenkins/jobs/ansible_playbook.yaml
@@ -56,6 +56,10 @@
name: DEBUG_LEVEL
description: Debug Level to use in the ansible playbooks (ie -v)
default:
+ - bool:
+ name: reportFailure
+ description: Whether to report a failure message to mattermost for this job
+ default: True
- string:
name: CONTAINERS_IMAGE
description: LXD image for containers used in tests
diff --git a/jenkins/jobs/gh_repo_tester.groovy b/jenkins/jobs/gh_repo_tester.groovy
index e1b044c..fd69973 100644
--- a/jenkins/jobs/gh_repo_tester.groovy
+++ b/jenkins/jobs/gh_repo_tester.groovy
@@ -91,6 +91,7 @@ def makeBuild(job_name, job) {
parameters: [
[$class: 'StringParameterValue', name: 'GITHUB_REPO', value: job.GITHUB_REPO],
[$class: 'StringParameterValue', name: 'GITHUB_BRANCH', value: job.GITHUB_BRANCH],
+ [$class: 'BooleanParameterValue', name: 'reportFailure', value: False],
],
propagate: false,
wait: false,
Follow ups