← Back to team overview

canonical-hw-cert team mailing list archive

[Merge] ~jocave/hwcert-jenkins-jobs:split-dashboard-jobs into hwcert-jenkins-jobs:master

 

Jonathan Cave has proposed merging ~jocave/hwcert-jenkins-jobs:split-dashboard-jobs into hwcert-jenkins-jobs:master.

Requested reviews:
  hwcert-jenkins (hwcert-jenkins)

For more details, see:
https://code.launchpad.net/~jocave/hwcert-jenkins-jobs/+git/hwcert-jenkins-jobs/+merge/429283

Split the dashboard manager jobs (and sru bug flow script) in to two separate jobs for each board for easier tracking of problems.

Should also terminate the job with an appropriate status on the assumption that the scripts themselves return error codes.
-- 
Your team hwcert-jenkins is requested to review the proposed merge of ~jocave/hwcert-jenkins-jobs:split-dashboard-jobs into hwcert-jenkins-jobs:master.
diff --git a/jobs/infrastructure/trello/trello-manager.sh b/jobs/infrastructure/trello/deb-board-manager.sh
similarity index 61%
rename from jobs/infrastructure/trello/trello-manager.sh
rename to jobs/infrastructure/trello/deb-board-manager.sh
index 278c0b0..fbfecf2 100644
--- a/jobs/infrastructure/trello/trello-manager.sh
+++ b/jobs/infrastructure/trello/deb-board-manager.sh
@@ -16,23 +16,18 @@
 set +e
 set -x
 
-#Remove previous venv
-rm -rf env
-cat <<EOF >build-env.sh
-{build_env}
-EOF
-. build-env.sh
-git -C hwcert-jenkins-tools pull || (rm -rf hwcert-jenkins-tools && git clone https://git.launchpad.net/hwcert-jenkins-tools)
 git -C hwcert-data pull || git clone git+ssh://ce-certification-qa@xxxxxxxxxxxxxxxxx/~canonical-hw-cert/hwcert-jenkins-jobs/+git/hwcert-data
 
-# This marks kernel sru bugs complete for snaps that are marked complete in trello
-certification-dashboard-manager.sru-bug-manager --project kernel-sru-workflow
-
-# This migrates trello cards to the appropriate lane based on snap status
-certification-dashboard-manager.snap-board-manager hwcert-data/snaps.yaml
-
 # This marks kernel sru bugs complete for kernel debs that are marked complete in trello
-export TRELLO_BOARD="$TRELLO_BOARD_KERNEL_DEB"
-certification-dashboard-manager.sru-bug-manager --project kernel-sru-workflow --deb
+certification-dashboard-manager.sru-bug-manager --board "$TRELLO_BOARD" --project kernel-sru-workflow --deb
+BUG_MANAGER_RESULT="$?"
+
 # This migrates trello cards to the appropriate lane based on kernel deb status
-certification-dashboard-manager.deb-board-manager hwcert-data/debs.yaml
+certification-dashboard-manager.deb-board-manager --board "$TRELLO_BOARD" hwcert-data/debs.yaml
+BOARD_MANAGER_RESULT="$?"
+
+if [ "$BUG_MANAGER_RESULT" -ne 0 ] || [ "$BOARD_MANAGER_RESULT" -ne 0 ]; then
+    exit 1
+fi
+
+exit 0
\ No newline at end of file
diff --git a/jobs/infrastructure/trello/snap-board-manager.sh b/jobs/infrastructure/trello/snap-board-manager.sh
new file mode 100644
index 0000000..e7ad5fc
--- /dev/null
+++ b/jobs/infrastructure/trello/snap-board-manager.sh
@@ -0,0 +1,33 @@
+#!/bin/bash
+#
+# Copyright (C) 2017 Canonical Ltd
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License version 3 as
+# published by the Free Software Foundation.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+set +e
+set -x
+
+git -C hwcert-data pull || git clone git+ssh://ce-certification-qa@xxxxxxxxxxxxxxxxx/~canonical-hw-cert/hwcert-jenkins-jobs/+git/hwcert-data
+
+# This marks kernel sru bugs complete for snaps that are marked complete in trello
+certification-dashboard-manager.sru-bug-manager --board "$TRELLO_BOARD" --project kernel-sru-workflow
+BUG_MANAGER_RESULT="$?"
+
+# This migrates trello cards to the appropriate lane based on snap status
+certification-dashboard-manager.snap-board-manager --board "$TRELLO_BOARD" hwcert-data/snaps.yaml
+BOARD_MANAGER_RESULT="$?"
+
+if [ "$BUG_MANAGER_RESULT" -ne 0 ] || [ "$BOARD_MANAGER_RESULT" -ne 0 ]; then
+    exit 1
+fi
+
+exit 0
diff --git a/jobs/infrastructure/trello/trello.yaml b/jobs/infrastructure/trello/trello.yaml
index e8bbf69..f8418f9 100644
--- a/jobs/infrastructure/trello/trello.yaml
+++ b/jobs/infrastructure/trello/trello.yaml
@@ -1,12 +1,12 @@
 - project:
     name: trello
     jobs:
-        - '{prefix}-trello-manager'
+        - '{prefix}-snap-dashboard-manager'
+        - '{prefix}-kernel-deb-dashboard-manager'
 
 - job-template:
-    name: '{prefix}-trello-manager'
+    name: '{prefix}-snap-dashboard-manager'
     project-type: freestyle
-    # node: snapbuild
     description: |
       Various automated operations on the snap-update-verification trello board
     properties:
@@ -33,12 +33,45 @@
           - text:
              credential-id: trello-board-suv
              variable: TRELLO_BOARD
+          - file:
+             credential-id: lp-credentials
+             variable: LAUNCHPAD_CREDENTIALS
+    builders:
+        - shell:
+              !include-raw: snap-board-manager.sh
+
+- job-template:
+    name: '{prefix}-kernel-deb-dashboard-manager'
+    project-type: freestyle
+    description: |
+      Various automated operations on the kenel-deb trello board
+    properties:
+    - build-discarder:
+        num-to-keep: 10
+    triggers:
+      - timed: # every 10 minutes
+          'H/10 * * * *'
+    wrappers:
+      - timeout:
+          timeout: 20
+          fail: true
+      - timestamps
+      - ssh-agent-credentials:
+          users:
+              - 'ssh-ce-certification-qa'
+      - credentials-binding:
+          - text:
+             credential-id: trello-api-token
+             variable: TRELLO_TOKEN
+          - text:
+             credential-id: trello-api-key
+             variable: TRELLO_API_KEY
           - text:
              credential-id: trello-board-kernel-deb
-             variable: TRELLO_BOARD_KERNEL_DEB
+             variable: TRELLO_BOARD
           - file:
              credential-id: lp-credentials
              variable: LAUNCHPAD_CREDENTIALS
     builders:
         - shell:
-              !include-raw: trello-manager.sh
+              !include-raw: deb-board-manager.sh

Follow ups