Backup Pharos Dashboard Data
[releng.git] / jjb / pharos / pharos.yml
index 1a605d3..d7067c4 100644 (file)
@@ -1,3 +1,4 @@
+---
 ###################################################
 # All the jobs except verify have been removed!
 # They will only be enabled on request by projects!
@@ -5,59 +6,94 @@
 - project:
     name: pharos
 
-    project: '{name}'
+    project:
+      - '{name}'
+      - '{name}-tools'
 
     jobs:
-        - 'pharos-verify-{stream}'
+      - '{project}-verify-{stream}'
+      - 'backup-pharos-dashboard'
 
     stream:
-        - master:
-            branch: '{stream}'
-            gs-pathname: ''
-            disabled: false
-        - colorado:
-            branch: 'stable/{stream}'
-            gs-pathname: '/{stream}'
-            disabled: false
+      - master:
+          branch: '{stream}'
+          gs-pathname: ''
+          disabled: false
+      - euphrates:
+          branch: 'stable/{stream}'
+          gs-pathname: '/{stream}'
+          disabled: false
 
 - job-template:
-    name: 'pharos-verify-{stream}'
+    name: '{project}-verify-{stream}'
 
     disabled: '{obj:disabled}'
 
     parameters:
-        - project-parameter:
-            project: '{project}'
-        - gerrit-parameter:
-            branch: '{branch}'
-        - 'opnfv-build-ubuntu-defaults'
+      - project-parameter:
+          project: '{project}'
+          branch: '{branch}'
+      - 'opnfv-build-ubuntu-defaults'
 
     scm:
-        - git-scm-gerrit
+      - git-scm-gerrit
 
     triggers:
-        - gerrit:
-            server-name: 'gerrit.opnfv.org'
-            trigger-on:
-                - patchset-created-event:
-                    exclude-drafts: 'false'
-                    exclude-trivial-rebase: 'false'
-                    exclude-no-code-change: 'false'
-                - draft-published-event
-                - comment-added-contains-event:
-                    comment-contains-value: 'recheck'
-                - comment-added-contains-event:
-                    comment-contains-value: 'reverify'
-            projects:
-              - project-compare-type: 'ANT'
-                project-pattern: '{project}'
-                branches:
-                  - branch-compare-type: 'ANT'
-                    branch-pattern: '**/{branch}'
-                forbidden-file-paths:
-                  - compare-type: ANT
-                    pattern: 'docs/**|.gitignore'
+      - gerrit:
+          server-name: 'gerrit.opnfv.org'
+          trigger-on:
+            - patchset-created-event:
+                exclude-drafts: 'false'
+                exclude-trivial-rebase: 'false'
+                exclude-no-code-change: 'false'
+            - draft-published-event
+            - comment-added-contains-event:
+                comment-contains-value: 'recheck'
+            - comment-added-contains-event:
+                comment-contains-value: 'reverify'
+          projects:
+            - project-compare-type: 'ANT'
+              project-pattern: '{project}'
+              branches:
+                - branch-compare-type: 'ANT'
+                  branch-pattern: '**/{branch}'
+              disable-strict-forbidden-file-verification: 'true'
+              forbidden-file-paths:
+                - compare-type: ANT
+                  pattern: 'docs/**|.gitignore'
 
     builders:
-        - shell: |
-            echo "Nothing to verify!"
+      - shell: |
+          echo "Nothing to verify!"
+
+- job-template:
+    name: 'backup-pharos-dashboard'
+
+    disabled: '{obj:disabled}'
+
+    parameters:
+      - project-parameter:
+          project: 'pharos-tools'
+          branch: 'master'
+      - 'pharos-dashboard-defaults'
+
+    scm:
+      - git-scm-gerrit
+
+    triggers:
+      - timed: '@daily'
+
+    builders:
+      - shell: |
+          mkdir -p /home/backups/
+          DATE=$(date +%Y%m%d)
+          echo "-- $DATE --"
+          echo "Backing up Pharos Dashboard data..."
+          sudo docker run -it --rm \
+            -v pharos_data:/pharos_data:ro \
+            -v /tmp:/backup \
+            alpine \
+            tar -czf /backup/pharos-dashboard-db-$(date +%Y%m%d).tar.gz -C /pharos_data ./
+          sudo mv /tmp/pharos-dashboard-db-$(date +%Y%m%d).tar.gz /home/backups/
+          sudo chown $USER:$USER $WORKSPACE/backups/pharos-dashboard-db-$(date +%Y%m%d).tar.gz
+          echo "...complete"