summaryrefslogtreecommitdiffstats
path: root/jjb/pharos/pharos.yml
blob: acf14885e06cd5488f00f2ec6f9c09dc17c78120 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
---
- project:
    name: pharos

    project:
      - '{name}'
      - '{name}-tools'

    disabled: false

    jobs:
      - '{project}-verify-basic'
      - 'backup-pharos-dashboard'
      - 'deploy-pharos-dashboard'

- job-template:
    name: 'backup-pharos-dashboard'

    disabled: '{obj:disabled}'

    parameters:
      - 'pharos-dashboard-defaults'

    triggers:
      - timed: '@daily'

    builders:
      - shell: |
          BACKUP_DIR=$HOME/backups/
          TMP_DIR=$HOME/tmp/
          mkdir -p $BACKUP_DIR
          echo "-- $(date +%Y%m%d) --"
          echo "Backing up Pharos Dashboard data..."
          sudo docker run --rm \
            -v pharos-data:/pharos-data:ro \
            -v $TMP_DIR:/backup \
            alpine \
            tar -czf /backup/pharos-dashboard-db-$(date +%Y%m%d).tar.gz -C /pharos-data ./
          sudo mv $TMP_DIR/pharos-dashboard-db-$(date +%Y%m%d).tar.gz $BACKUP_DIR
          sudo chown $USER:$USER $BACKUP_DIR/pharos-dashboard-db-$(date +%Y%m%d).tar.gz
          echo "...complete"

- job-template:
    name: 'deploy-pharos-dashboard'

    disabled: '{obj:disabled}'

    parameters:
      - project-parameter:
          project: 'pharos-tools'
          branch: 'master'
      - 'pharos-dashboard-defaults'

    scm:
      - git-scm-gerrit

    triggers:
      - gerrit:
          server-name: 'gerrit.opnfv.org'
          trigger-on:
            - ref-updated-event
            - comment-added-contains-event:
                comment-contains-value: '^redeploy$'
          projects:
            - project-compare-type: 'ANT'
              project-pattern: 'pharos-tools'
              branches:
                - branch-compare-type: 'ANT'
                  branch-pattern: '**/master'

    builders:
      - shell: |
          cp $HOME/config.env $WORKSPACE/dashboard
          cd $WORKSPACE/dashboard
          sudo docker-compose build
          sudo docker-compose up -d