blob: 40be394dd88b712380f67f1c1085dbe630bda79b [file] [log] [blame]
Zack Williamsa8f3b842018-05-04 17:21:13 -07001---
2# CORD helm chart publishing tasks
3
4- project:
5 name: helm-repo
6
7 # add repos that have documentation to the project list in both jobs
8 jobs:
9 - 'publish-helm-repo':
Luca Preteae7fc492018-12-13 16:00:37 -080010 project-regexp: '{helm-charts-projects-regexp}'
Zack Williamsa8f3b842018-05-04 17:21:13 -070011 branch-regexp: '{supported-branches-regexp}'
12
Zack Williamsa8f3b842018-05-04 17:21:13 -070013- job-template:
14 id: publish-helm-repo
15 name: 'publish-helm-repo'
Zack Williams66eef762018-05-07 17:06:03 -070016 description: |
17 Created by publish-helm-repo job-template from ci-management/jjb/helm.yaml
Zack Williamsa8f3b842018-05-04 17:21:13 -070018
19 triggers:
20 - cord-infra-gerrit-trigger-merge:
21 gerrit-server-name: '{gerrit-server-name}'
22 project-regexp: '{project-regexp}'
23 branch-regexp: '{branch-regexp}'
24 file-include-regexp: '{all-files-regexp}'
25 dependency-jobs: '{dependency-jobs}'
26
27 properties:
28 - cord-infra-properties:
29 build-days-to-keep: '{build-days-to-keep}'
30 artifact-num-to-keep: '{artifact-num-to-keep}'
31
32 wrappers:
33 - lf-infra-wrappers:
34 build-timeout: '{build-timeout}'
35 jenkins-ssh-credential: '{jenkins-ssh-credential}'
36
37 scm:
38 - lf-infra-gerrit-scm:
39 git-url: '$GIT_URL/$GERRIT_PROJECT'
Zack Williams58750872018-05-07 17:35:45 -070040 refspec: ''
Zack Williamsa8f3b842018-05-04 17:21:13 -070041 branch: '$GERRIT_BRANCH'
42 submodule-recursive: 'false'
Zack Williamscd3eb202018-10-02 14:33:13 -070043 choosing-strategy: 'gerrit'
Zack Williamsa8f3b842018-05-04 17:21:13 -070044 jenkins-ssh-credential: '{jenkins-ssh-credential}'
45
46 node: '{build-node}'
47 project-type: freestyle
48 concurrent: false
49
50 builders:
51 - shell: |
Zack Williams642e5f72018-06-05 13:24:13 -070052 #!/usr/bin/env bash
Zack Williamsbf4339c2018-08-13 07:49:45 -070053 set -eu -o pipefail
Zack Williams642e5f72018-06-05 13:24:13 -070054
Zack Williamsd5ce0ea2019-01-02 11:49:17 -070055 # Configure git
56 git config --global user.email "do-not-reply@opencord.org"
57 git config --global user.name "Jenkins"
58
59 # Checkout 'cord-charts-repo' repo that contains updated charts
60 git clone https://gerrit.opencord.org/cord-charts-repo
61
62 # Clone the `helm-repo-tools` which contains scripts
63 git clone https://gerrit.opencord.org/helm-repo-tools
Zack Williams642e5f72018-06-05 13:24:13 -070064
65 # Setup and build the helm repo
Zack Williamsa8f3b842018-05-04 17:21:13 -070066 helm init --client-only
Luca Prete3319a202018-12-13 18:40:06 -080067 helm repo add incubator http://storage.googleapis.com/kubernetes-charts-incubator
68 helm repo add cord https://charts.opencord.org
Zack Williamsbf4339c2018-08-13 07:49:45 -070069 helm repo add rook-beta https://charts.rook.io/beta
Luca Prete2ae90132018-12-13 17:14:01 -080070
Zack Williamsd5ce0ea2019-01-02 11:49:17 -070071 # Built the new repo
Luca Prete2ae90132018-12-13 17:14:01 -080072 ./helm-repo-tools/helmrepo.sh
Zack Williams642e5f72018-06-05 13:24:13 -070073
Zack Williamsd5ce0ea2019-01-02 11:49:17 -070074 # Tag and push to git the charts repo
75 pushd cord-charts-repo
76 # version tag is the current date in RFC3339 format
77 NEW_VERSION=$(date -u +%Y%m%dT%H%M%SZ)
78
79 git tag -a "$NEW_VERSION" -m "Charts tagged by CORD Jenkins publish-helm-repo job: $BUILD_NUMBER, for Gerrit patchset: $GERRIT_CHANGE_NUMBER"
80
81 echo "Tags including new tag:"
82 git tag -n
83
84 # push new tag back into repo
85 git push origin "$NEW_VERSION"
86 popd
87
88 # Set up the ssh host keys for the docs host
89 mkdir -p ~/.ssh
90 echo '{docs-ssh-host-key}' >> ~/.ssh/known_hosts
91
92 # Copy updated repo to host
93 rsync -rvzh --delete-after --exclude=.git cord-charts-repo/ {docs-ssh-host}:/var/www/charts
Zack Williams642e5f72018-06-05 13:24:13 -070094
Kailashe602fd12018-12-14 14:39:40 -080095 publishers:
96 - email:
Zack Williamsd5ce0ea2019-01-02 11:49:17 -070097 recipients: 'andy@opennetworking.org kailash@opennetworking.org luca@opennetworking.org teo@opennetworking.org saurav@opennetworking.org zdw@opennetworking.org'
Kailashe602fd12018-12-14 14:39:40 -080098