blob: 3c42ccd9eb35b7039c655560f9ab5a7302d81cd4 [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: |
hwchiue3815ab2019-10-17 15:06:25 -070017 Created by publish-helm-repo job-template from ci-management/jjb/charts.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'
Zack Williamsccc14742020-01-22 13:15:59 -070042 submodule-disable: '{submodule-disable}'
Zack Williamsa8f3b842018-05-04 17:21:13 -070043 submodule-recursive: 'false'
Zack Williamsccc14742020-01-22 13:15:59 -070044 submodule-timeout: '{submodule-timeout}'
Zack Williamscd3eb202018-10-02 14:33:13 -070045 choosing-strategy: 'gerrit'
Zack Williamsa8f3b842018-05-04 17:21:13 -070046 jenkins-ssh-credential: '{jenkins-ssh-credential}'
47
Zack Williams5cb98dc2019-12-17 17:01:28 -070048 node: 'ubuntu16.04-basebuild-2c-4g'
Zack Williamsa8f3b842018-05-04 17:21:13 -070049 project-type: freestyle
50 concurrent: false
51
52 builders:
53 - shell: |
Zack Williams642e5f72018-06-05 13:24:13 -070054 #!/usr/bin/env bash
Zack Williamsbf4339c2018-08-13 07:49:45 -070055 set -eu -o pipefail
Zack Williams642e5f72018-06-05 13:24:13 -070056
Zack Williams79e756c2019-01-03 14:44:21 -070057 echo "git version: $(git --version)"
58
Zack Williamsd5ce0ea2019-01-02 11:49:17 -070059 # Configure git
Zack Williams7a7a3182020-08-13 14:15:40 -070060 git config --global user.email "do-not-reply@opennetworking.org"
Zack Williamsd5ce0ea2019-01-02 11:49:17 -070061 git config --global user.name "Jenkins"
62
63 # Checkout 'cord-charts-repo' repo that contains updated charts
Zack Williamse76c6b42019-01-02 20:39:38 -070064 git clone ssh://jenkins@gerrit.opencord.org:29418/cord-charts-repo.git
Zack Williamsd5ce0ea2019-01-02 11:49:17 -070065
66 # Clone the `helm-repo-tools` which contains scripts
Zack Williamse76c6b42019-01-02 20:39:38 -070067 git clone ssh://jenkins@gerrit.opencord.org:29418/helm-repo-tools.git
Zack Williams642e5f72018-06-05 13:24:13 -070068
Zack Williams1ab88922019-05-22 15:43:23 -070069 # Setup helm and external repos
Zack Williamsa8f3b842018-05-04 17:21:13 -070070 helm init --client-only
Zack Williams1ab88922019-05-22 15:43:23 -070071 helm repo add incubator https://kubernetes-charts-incubator.storage.googleapis.com
Zack Williamsa56a4762020-03-23 09:28:43 -070072 helm repo add rook-release https://charts.rook.io/release
Zack Williams1ab88922019-05-22 15:43:23 -070073 helm repo add cord https://charts.opencord.org
divyadesai930dc4c2020-05-25 05:41:50 +000074 helm repo add elastic https://helm.elastic.co
75 helm repo add kiwigrid https://kiwigrid.github.io
Luca Prete2ae90132018-12-13 17:14:01 -080076
Zack Williamse6856b82019-01-02 17:22:19 -070077 # Update the repo
Luca Prete2ae90132018-12-13 17:14:01 -080078 ./helm-repo-tools/helmrepo.sh
Zack Williams642e5f72018-06-05 13:24:13 -070079
Zack Williamsd5ce0ea2019-01-02 11:49:17 -070080 # Tag and push to git the charts repo
81 pushd cord-charts-repo
Zack Williamse6856b82019-01-02 17:22:19 -070082
Zack Williams79e756c2019-01-03 14:44:21 -070083 # only update if charts are changed
84 set +e
85 if git diff --exit-code index.yaml > /dev/null; then
86 echo "No changes to charts in patchset $GERRIT_CHANGE_NUMBER on project: $GERRIT_PROJECT, exiting."
87 exit 0
88 fi
89 set -e
90
Zack Williamsd5ce0ea2019-01-02 11:49:17 -070091 # version tag is the current date in RFC3339 format
92 NEW_VERSION=$(date -u +%Y%m%dT%H%M%SZ)
93
Zack Williamse6856b82019-01-02 17:22:19 -070094 # Add changes and create commit
95 git add -A
Zack Williams79e756c2019-01-03 14:44:21 -070096 git commit -m "Changed by CORD Jenkins publish-helm-repo job: $BUILD_NUMBER, for project: $GERRIT_PROJECT, patchset: $GERRIT_CHANGE_NUMBER"
Zack Williamse6856b82019-01-02 17:22:19 -070097
98 # create tag on new commit
99 git tag "$NEW_VERSION"
Zack Williamsd5ce0ea2019-01-02 11:49:17 -0700100
101 echo "Tags including new tag:"
102 git tag -n
103
Zack Williamse76c6b42019-01-02 20:39:38 -0700104 # push new commit and tag back into repo
Zack Williams79e756c2019-01-03 14:44:21 -0700105 git push origin
106 git push origin "$NEW_VERSION"
Zack Williamsd5ce0ea2019-01-02 11:49:17 -0700107 popd
108
109 # Set up the ssh host keys for the docs host
110 mkdir -p ~/.ssh
111 echo '{docs-ssh-host-key}' >> ~/.ssh/known_hosts
112
113 # Copy updated repo to host
114 rsync -rvzh --delete-after --exclude=.git cord-charts-repo/ {docs-ssh-host}:/var/www/charts
Zack Williams642e5f72018-06-05 13:24:13 -0700115
Kailashe602fd12018-12-14 14:39:40 -0800116 publishers:
117 - email:
Zack Williamsd5ce0ea2019-01-02 11:49:17 -0700118 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 -0800119
Zack Williams99150c62019-07-02 13:44:30 -0700120# check helm charts with `helm lint --strict` and that charts version is
121# updated when the contents of a chart is modified.
122- job-template:
123 id: verify-helm-lint
124 name: 'verify_{project}_helm-lint'
125 description: |
hwchiue3815ab2019-10-17 15:06:25 -0700126 Created by verify-helm-lint job-template from ci-management/jjb/charts.yaml
Zack Williams99150c62019-07-02 13:44:30 -0700127
128 triggers:
129 - cord-infra-gerrit-trigger-patchset:
130 gerrit-server-name: '{gerrit-server-name}'
131 project-regexp: '^{project}$'
132 branch-regexp: '{branch-regexp}'
133 file-include-regexp: '{all-files-regexp}'
134 dependency-jobs: '{dependency-jobs}'
135
136 properties:
137 - cord-infra-properties:
138 build-days-to-keep: '{build-days-to-keep}'
139 artifact-num-to-keep: '{artifact-num-to-keep}'
140
141 wrappers:
142 - lf-infra-wrappers:
143 build-timeout: '{build-timeout}'
144 jenkins-ssh-credential: '{jenkins-ssh-credential}'
145
146 scm:
147 - lf-infra-gerrit-scm:
148 git-url: '$GIT_URL/$GERRIT_PROJECT'
149 refspec: '$GERRIT_REFSPEC'
150 branch: '$GERRIT_BRANCH'
Zack Williamsccc14742020-01-22 13:15:59 -0700151 submodule-disable: '{submodule-disable}'
Zack Williams99150c62019-07-02 13:44:30 -0700152 submodule-recursive: 'false'
Zack Williamsccc14742020-01-22 13:15:59 -0700153 submodule-timeout: '{submodule-timeout}'
Zack Williams99150c62019-07-02 13:44:30 -0700154 choosing-strategy: gerrit
155 jenkins-ssh-credential: '{jenkins-ssh-credential}'
156
Zack Williams5cb98dc2019-12-17 17:01:28 -0700157 node: 'ubuntu16.04-basebuild-2c-4g'
Zack Williams99150c62019-07-02 13:44:30 -0700158 project-type: freestyle
159 concurrent: true
160
161 builders:
162 - shell: |
163 #!/usr/bin/env bash
164 set -eu -o pipefail
165
166 # Setup helm and external repos
167 helm init --client-only
168 helm repo add incubator https://kubernetes-charts-incubator.storage.googleapis.com
Zack Williamsa56a4762020-03-23 09:28:43 -0700169 helm repo add rook-release https://charts.rook.io/release
Zack Williams99150c62019-07-02 13:44:30 -0700170 helm repo add cord https://charts.opencord.org
171
172 git clone https://gerrit.opencord.org/helm-repo-tools
173 ./helm-repo-tools/helmlint.sh clean
174
175 # Specify the remote branch to compare against
176 export COMPARISON_BRANCH="origin/$GERRIT_BRANCH"
177 ./helm-repo-tools/chart_version_check.sh
178
179 # Check for chart version conflicts by building the repo (don't upload)
180 git clone ssh://jenkins@gerrit.opencord.org:29418/cord-charts-repo.git
181 ./helm-repo-tools/helmrepo.sh