Zack Williams | a8f3b84 | 2018-05-04 17:21:13 -0700 | [diff] [blame] | 1 | --- |
| 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 Prete | ae7fc49 | 2018-12-13 16:00:37 -0800 | [diff] [blame] | 10 | project-regexp: '{helm-charts-projects-regexp}' |
Zack Williams | a8f3b84 | 2018-05-04 17:21:13 -0700 | [diff] [blame] | 11 | branch-regexp: '{supported-branches-regexp}' |
| 12 | |
Zack Williams | a8f3b84 | 2018-05-04 17:21:13 -0700 | [diff] [blame] | 13 | - job-template: |
| 14 | id: publish-helm-repo |
| 15 | name: 'publish-helm-repo' |
Zack Williams | 66eef76 | 2018-05-07 17:06:03 -0700 | [diff] [blame] | 16 | description: | |
hwchiu | e3815ab | 2019-10-17 15:06:25 -0700 | [diff] [blame] | 17 | Created by publish-helm-repo job-template from ci-management/jjb/charts.yaml |
Zack Williams | a8f3b84 | 2018-05-04 17:21:13 -0700 | [diff] [blame] | 18 | |
| 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 Williams | 5875087 | 2018-05-07 17:35:45 -0700 | [diff] [blame] | 40 | refspec: '' |
Zack Williams | a8f3b84 | 2018-05-04 17:21:13 -0700 | [diff] [blame] | 41 | branch: '$GERRIT_BRANCH' |
Zack Williams | ccc1474 | 2020-01-22 13:15:59 -0700 | [diff] [blame] | 42 | submodule-disable: '{submodule-disable}' |
Zack Williams | a8f3b84 | 2018-05-04 17:21:13 -0700 | [diff] [blame] | 43 | submodule-recursive: 'false' |
Zack Williams | ccc1474 | 2020-01-22 13:15:59 -0700 | [diff] [blame] | 44 | submodule-timeout: '{submodule-timeout}' |
Zack Williams | cd3eb20 | 2018-10-02 14:33:13 -0700 | [diff] [blame] | 45 | choosing-strategy: 'gerrit' |
Zack Williams | a8f3b84 | 2018-05-04 17:21:13 -0700 | [diff] [blame] | 46 | jenkins-ssh-credential: '{jenkins-ssh-credential}' |
| 47 | |
Zack Williams | 5cb98dc | 2019-12-17 17:01:28 -0700 | [diff] [blame] | 48 | node: 'ubuntu16.04-basebuild-2c-4g' |
Zack Williams | a8f3b84 | 2018-05-04 17:21:13 -0700 | [diff] [blame] | 49 | project-type: freestyle |
| 50 | concurrent: false |
| 51 | |
| 52 | builders: |
| 53 | - shell: | |
Zack Williams | 642e5f7 | 2018-06-05 13:24:13 -0700 | [diff] [blame] | 54 | #!/usr/bin/env bash |
Zack Williams | bf4339c | 2018-08-13 07:49:45 -0700 | [diff] [blame] | 55 | set -eu -o pipefail |
Zack Williams | 642e5f7 | 2018-06-05 13:24:13 -0700 | [diff] [blame] | 56 | |
Zack Williams | 79e756c | 2019-01-03 14:44:21 -0700 | [diff] [blame] | 57 | echo "git version: $(git --version)" |
| 58 | |
Zack Williams | d5ce0ea | 2019-01-02 11:49:17 -0700 | [diff] [blame] | 59 | # Configure git |
Zack Williams | 7a7a318 | 2020-08-13 14:15:40 -0700 | [diff] [blame] | 60 | git config --global user.email "do-not-reply@opennetworking.org" |
Zack Williams | d5ce0ea | 2019-01-02 11:49:17 -0700 | [diff] [blame] | 61 | git config --global user.name "Jenkins" |
| 62 | |
| 63 | # Checkout 'cord-charts-repo' repo that contains updated charts |
Zack Williams | e76c6b4 | 2019-01-02 20:39:38 -0700 | [diff] [blame] | 64 | git clone ssh://jenkins@gerrit.opencord.org:29418/cord-charts-repo.git |
Zack Williams | d5ce0ea | 2019-01-02 11:49:17 -0700 | [diff] [blame] | 65 | |
| 66 | # Clone the `helm-repo-tools` which contains scripts |
Zack Williams | e76c6b4 | 2019-01-02 20:39:38 -0700 | [diff] [blame] | 67 | git clone ssh://jenkins@gerrit.opencord.org:29418/helm-repo-tools.git |
Zack Williams | 642e5f7 | 2018-06-05 13:24:13 -0700 | [diff] [blame] | 68 | |
Zack Williams | 1ab8892 | 2019-05-22 15:43:23 -0700 | [diff] [blame] | 69 | # Setup helm and external repos |
Matteo Scandolo | 41f5a9c | 2021-01-06 15:45:17 -0800 | [diff] [blame] | 70 | helm repo add stable https://charts.helm.sh/stable |
Zack Williams | a56a476 | 2020-03-23 09:28:43 -0700 | [diff] [blame] | 71 | helm repo add rook-release https://charts.rook.io/release |
Zack Williams | 1ab8892 | 2019-05-22 15:43:23 -0700 | [diff] [blame] | 72 | helm repo add cord https://charts.opencord.org |
divyadesai | 930dc4c | 2020-05-25 05:41:50 +0000 | [diff] [blame] | 73 | helm repo add elastic https://helm.elastic.co |
| 74 | helm repo add kiwigrid https://kiwigrid.github.io |
Luca Prete | 2ae9013 | 2018-12-13 17:14:01 -0800 | [diff] [blame] | 75 | |
Zack Williams | e6856b8 | 2019-01-02 17:22:19 -0700 | [diff] [blame] | 76 | # Update the repo |
Luca Prete | 2ae9013 | 2018-12-13 17:14:01 -0800 | [diff] [blame] | 77 | ./helm-repo-tools/helmrepo.sh |
Zack Williams | 642e5f7 | 2018-06-05 13:24:13 -0700 | [diff] [blame] | 78 | |
Zack Williams | d5ce0ea | 2019-01-02 11:49:17 -0700 | [diff] [blame] | 79 | # Tag and push to git the charts repo |
| 80 | pushd cord-charts-repo |
Zack Williams | e6856b8 | 2019-01-02 17:22:19 -0700 | [diff] [blame] | 81 | |
Zack Williams | 79e756c | 2019-01-03 14:44:21 -0700 | [diff] [blame] | 82 | # only update if charts are changed |
| 83 | set +e |
| 84 | if git diff --exit-code index.yaml > /dev/null; then |
| 85 | echo "No changes to charts in patchset $GERRIT_CHANGE_NUMBER on project: $GERRIT_PROJECT, exiting." |
| 86 | exit 0 |
| 87 | fi |
| 88 | set -e |
| 89 | |
Zack Williams | d5ce0ea | 2019-01-02 11:49:17 -0700 | [diff] [blame] | 90 | # version tag is the current date in RFC3339 format |
| 91 | NEW_VERSION=$(date -u +%Y%m%dT%H%M%SZ) |
| 92 | |
Zack Williams | e6856b8 | 2019-01-02 17:22:19 -0700 | [diff] [blame] | 93 | # Add changes and create commit |
| 94 | git add -A |
Zack Williams | 79e756c | 2019-01-03 14:44:21 -0700 | [diff] [blame] | 95 | git commit -m "Changed by CORD Jenkins publish-helm-repo job: $BUILD_NUMBER, for project: $GERRIT_PROJECT, patchset: $GERRIT_CHANGE_NUMBER" |
Zack Williams | e6856b8 | 2019-01-02 17:22:19 -0700 | [diff] [blame] | 96 | |
| 97 | # create tag on new commit |
| 98 | git tag "$NEW_VERSION" |
Zack Williams | d5ce0ea | 2019-01-02 11:49:17 -0700 | [diff] [blame] | 99 | |
| 100 | echo "Tags including new tag:" |
| 101 | git tag -n |
| 102 | |
Zack Williams | e76c6b4 | 2019-01-02 20:39:38 -0700 | [diff] [blame] | 103 | # push new commit and tag back into repo |
Zack Williams | 79e756c | 2019-01-03 14:44:21 -0700 | [diff] [blame] | 104 | git push origin |
| 105 | git push origin "$NEW_VERSION" |
Zack Williams | d5ce0ea | 2019-01-02 11:49:17 -0700 | [diff] [blame] | 106 | popd |
| 107 | |
| 108 | # Set up the ssh host keys for the docs host |
| 109 | mkdir -p ~/.ssh |
| 110 | echo '{docs-ssh-host-key}' >> ~/.ssh/known_hosts |
| 111 | |
| 112 | # Copy updated repo to host |
| 113 | rsync -rvzh --delete-after --exclude=.git cord-charts-repo/ {docs-ssh-host}:/var/www/charts |
Zack Williams | 642e5f7 | 2018-06-05 13:24:13 -0700 | [diff] [blame] | 114 | |
Kailash | e602fd1 | 2018-12-14 14:39:40 -0800 | [diff] [blame] | 115 | publishers: |
| 116 | - email: |
Zack Williams | d5ce0ea | 2019-01-02 11:49:17 -0700 | [diff] [blame] | 117 | recipients: 'andy@opennetworking.org kailash@opennetworking.org luca@opennetworking.org teo@opennetworking.org saurav@opennetworking.org zdw@opennetworking.org' |
Kailash | e602fd1 | 2018-12-14 14:39:40 -0800 | [diff] [blame] | 118 | |
Zack Williams | 99150c6 | 2019-07-02 13:44:30 -0700 | [diff] [blame] | 119 | # check helm charts with `helm lint --strict` and that charts version is |
| 120 | # updated when the contents of a chart is modified. |
| 121 | - job-template: |
| 122 | id: verify-helm-lint |
| 123 | name: 'verify_{project}_helm-lint' |
| 124 | description: | |
hwchiu | e3815ab | 2019-10-17 15:06:25 -0700 | [diff] [blame] | 125 | Created by verify-helm-lint job-template from ci-management/jjb/charts.yaml |
Zack Williams | 99150c6 | 2019-07-02 13:44:30 -0700 | [diff] [blame] | 126 | |
| 127 | triggers: |
| 128 | - cord-infra-gerrit-trigger-patchset: |
| 129 | gerrit-server-name: '{gerrit-server-name}' |
| 130 | project-regexp: '^{project}$' |
| 131 | branch-regexp: '{branch-regexp}' |
| 132 | file-include-regexp: '{all-files-regexp}' |
| 133 | dependency-jobs: '{dependency-jobs}' |
| 134 | |
| 135 | properties: |
| 136 | - cord-infra-properties: |
| 137 | build-days-to-keep: '{build-days-to-keep}' |
| 138 | artifact-num-to-keep: '{artifact-num-to-keep}' |
| 139 | |
| 140 | wrappers: |
| 141 | - lf-infra-wrappers: |
| 142 | build-timeout: '{build-timeout}' |
| 143 | jenkins-ssh-credential: '{jenkins-ssh-credential}' |
| 144 | |
| 145 | scm: |
| 146 | - lf-infra-gerrit-scm: |
| 147 | git-url: '$GIT_URL/$GERRIT_PROJECT' |
| 148 | refspec: '$GERRIT_REFSPEC' |
| 149 | branch: '$GERRIT_BRANCH' |
Zack Williams | ccc1474 | 2020-01-22 13:15:59 -0700 | [diff] [blame] | 150 | submodule-disable: '{submodule-disable}' |
Zack Williams | 99150c6 | 2019-07-02 13:44:30 -0700 | [diff] [blame] | 151 | submodule-recursive: 'false' |
Zack Williams | ccc1474 | 2020-01-22 13:15:59 -0700 | [diff] [blame] | 152 | submodule-timeout: '{submodule-timeout}' |
Zack Williams | 99150c6 | 2019-07-02 13:44:30 -0700 | [diff] [blame] | 153 | choosing-strategy: gerrit |
| 154 | jenkins-ssh-credential: '{jenkins-ssh-credential}' |
| 155 | |
Zack Williams | 5cb98dc | 2019-12-17 17:01:28 -0700 | [diff] [blame] | 156 | node: 'ubuntu16.04-basebuild-2c-4g' |
Zack Williams | 99150c6 | 2019-07-02 13:44:30 -0700 | [diff] [blame] | 157 | project-type: freestyle |
| 158 | concurrent: true |
| 159 | |
| 160 | builders: |
| 161 | - shell: | |
| 162 | #!/usr/bin/env bash |
| 163 | set -eu -o pipefail |
| 164 | |
| 165 | # Setup helm and external repos |
Matteo Scandolo | 09269c9 | 2021-01-06 12:28:18 -0800 | [diff] [blame] | 166 | helm repo add stable https://charts.helm.sh/stable |
Zack Williams | a56a476 | 2020-03-23 09:28:43 -0700 | [diff] [blame] | 167 | helm repo add rook-release https://charts.rook.io/release |
Zack Williams | 99150c6 | 2019-07-02 13:44:30 -0700 | [diff] [blame] | 168 | helm repo add cord https://charts.opencord.org |
| 169 | |
| 170 | git clone https://gerrit.opencord.org/helm-repo-tools |
| 171 | ./helm-repo-tools/helmlint.sh clean |
| 172 | |
| 173 | # Specify the remote branch to compare against |
| 174 | export COMPARISON_BRANCH="origin/$GERRIT_BRANCH" |
| 175 | ./helm-repo-tools/chart_version_check.sh |
| 176 | |
| 177 | # Check for chart version conflicts by building the repo (don't upload) |
| 178 | git clone ssh://jenkins@gerrit.opencord.org:29418/cord-charts-repo.git |
| 179 | ./helm-repo-tools/helmrepo.sh |