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: | |
| 17 | Created by publish-helm-repo job-template from ci-management/jjb/helm.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' |
| 42 | submodule-recursive: 'false' |
Zack Williams | cd3eb20 | 2018-10-02 14:33:13 -0700 | [diff] [blame] | 43 | choosing-strategy: 'gerrit' |
Zack Williams | a8f3b84 | 2018-05-04 17:21:13 -0700 | [diff] [blame] | 44 | jenkins-ssh-credential: '{jenkins-ssh-credential}' |
| 45 | |
| 46 | node: '{build-node}' |
| 47 | project-type: freestyle |
| 48 | concurrent: false |
| 49 | |
| 50 | builders: |
| 51 | - shell: | |
Zack Williams | 642e5f7 | 2018-06-05 13:24:13 -0700 | [diff] [blame] | 52 | #!/usr/bin/env bash |
Zack Williams | bf4339c | 2018-08-13 07:49:45 -0700 | [diff] [blame] | 53 | set -eu -o pipefail |
Zack Williams | 642e5f7 | 2018-06-05 13:24:13 -0700 | [diff] [blame] | 54 | |
Zack Williams | d5ce0ea | 2019-01-02 11:49:17 -0700 | [diff] [blame] | 55 | # 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 |
Zack Williams | e76c6b4 | 2019-01-02 20:39:38 -0700 | [diff] [blame^] | 60 | git clone ssh://jenkins@gerrit.opencord.org:29418/cord-charts-repo.git |
Zack Williams | d5ce0ea | 2019-01-02 11:49:17 -0700 | [diff] [blame] | 61 | |
| 62 | # Clone the `helm-repo-tools` which contains scripts |
Zack Williams | e76c6b4 | 2019-01-02 20:39:38 -0700 | [diff] [blame^] | 63 | git clone ssh://jenkins@gerrit.opencord.org:29418/helm-repo-tools.git |
Zack Williams | 642e5f7 | 2018-06-05 13:24:13 -0700 | [diff] [blame] | 64 | |
| 65 | # Setup and build the helm repo |
Zack Williams | a8f3b84 | 2018-05-04 17:21:13 -0700 | [diff] [blame] | 66 | helm init --client-only |
Luca Prete | 3319a20 | 2018-12-13 18:40:06 -0800 | [diff] [blame] | 67 | helm repo add incubator http://storage.googleapis.com/kubernetes-charts-incubator |
| 68 | helm repo add cord https://charts.opencord.org |
Zack Williams | bf4339c | 2018-08-13 07:49:45 -0700 | [diff] [blame] | 69 | helm repo add rook-beta https://charts.rook.io/beta |
Luca Prete | 2ae9013 | 2018-12-13 17:14:01 -0800 | [diff] [blame] | 70 | |
Zack Williams | e6856b8 | 2019-01-02 17:22:19 -0700 | [diff] [blame] | 71 | # Update the repo |
Luca Prete | 2ae9013 | 2018-12-13 17:14:01 -0800 | [diff] [blame] | 72 | ./helm-repo-tools/helmrepo.sh |
Zack Williams | 642e5f7 | 2018-06-05 13:24:13 -0700 | [diff] [blame] | 73 | |
Zack Williams | d5ce0ea | 2019-01-02 11:49:17 -0700 | [diff] [blame] | 74 | # Tag and push to git the charts repo |
| 75 | pushd cord-charts-repo |
Zack Williams | e6856b8 | 2019-01-02 17:22:19 -0700 | [diff] [blame] | 76 | |
Zack Williams | d5ce0ea | 2019-01-02 11:49:17 -0700 | [diff] [blame] | 77 | # version tag is the current date in RFC3339 format |
| 78 | NEW_VERSION=$(date -u +%Y%m%dT%H%M%SZ) |
| 79 | |
Zack Williams | e6856b8 | 2019-01-02 17:22:19 -0700 | [diff] [blame] | 80 | # Add changes and create commit |
| 81 | git add -A |
| 82 | git commit -m "Changes created by CORD Jenkins publish-helm-repo job: $BUILD_NUMBER, for Gerrit patchset: $GERRIT_CHANGE_NUMBER" |
| 83 | |
| 84 | # create tag on new commit |
| 85 | git tag "$NEW_VERSION" |
Zack Williams | d5ce0ea | 2019-01-02 11:49:17 -0700 | [diff] [blame] | 86 | |
| 87 | echo "Tags including new tag:" |
| 88 | git tag -n |
| 89 | |
Zack Williams | e76c6b4 | 2019-01-02 20:39:38 -0700 | [diff] [blame^] | 90 | # push new commit and tag back into repo |
| 91 | git push --follow-tags origin |
Zack Williams | d5ce0ea | 2019-01-02 11:49:17 -0700 | [diff] [blame] | 92 | popd |
| 93 | |
| 94 | # Set up the ssh host keys for the docs host |
| 95 | mkdir -p ~/.ssh |
| 96 | echo '{docs-ssh-host-key}' >> ~/.ssh/known_hosts |
| 97 | |
| 98 | # Copy updated repo to host |
| 99 | 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] | 100 | |
Kailash | e602fd1 | 2018-12-14 14:39:40 -0800 | [diff] [blame] | 101 | publishers: |
| 102 | - email: |
Zack Williams | d5ce0ea | 2019-01-02 11:49:17 -0700 | [diff] [blame] | 103 | 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] | 104 | |