Zack Williams | 7468c36 | 2018-04-06 09:52:30 -0700 | [diff] [blame] | 1 | --- |
| 2 | # CORD lint and static code validation job templates |
Zack Williams | 92f9b1f | 2018-04-11 09:58:49 -0700 | [diff] [blame] | 3 | # These are invoked by the per-git-repo jobs stored in verify/ |
Zack Williams | 7468c36 | 2018-04-06 09:52:30 -0700 | [diff] [blame] | 4 | |
| 5 | # Verify that there is valid license/copyright on files |
| 6 | - job-template: |
| 7 | id: verify-licensed |
Zack Williams | 92f9b1f | 2018-04-11 09:58:49 -0700 | [diff] [blame] | 8 | name: 'verify_{project}_licensed' |
| 9 | description: | |
Zack Williams | 92f9b1f | 2018-04-11 09:58:49 -0700 | [diff] [blame] | 10 | Created by verify-licensed job-template from ci-management/jjb/lint.yaml |
Zack Williams | 7468c36 | 2018-04-06 09:52:30 -0700 | [diff] [blame] | 11 | |
| 12 | triggers: |
| 13 | - cord-infra-gerrit-trigger-patchset: |
| 14 | gerrit-server-name: '{gerrit-server-name}' |
| 15 | project-regexp: '^{project}$' |
| 16 | branch-regexp: '{branch-regexp}' |
Zack Williams | c27ca2d | 2018-04-11 13:16:45 -0700 | [diff] [blame] | 17 | file-include-regexp: '{all-files-regexp}' |
Zack Williams | 7468c36 | 2018-04-06 09:52:30 -0700 | [diff] [blame] | 18 | dependency-jobs: '{dependency-jobs}' |
| 19 | |
| 20 | properties: |
| 21 | - cord-infra-properties: |
| 22 | build-days-to-keep: '{build-days-to-keep}' |
| 23 | artifact-num-to-keep: '{artifact-num-to-keep}' |
| 24 | |
| 25 | wrappers: |
| 26 | - lf-infra-wrappers: |
| 27 | build-timeout: '{build-timeout}' |
| 28 | jenkins-ssh-credential: '{jenkins-ssh-credential}' |
| 29 | |
| 30 | scm: |
| 31 | - lf-infra-gerrit-scm: |
| 32 | git-url: '$GIT_URL/$GERRIT_PROJECT' |
| 33 | refspec: '$GERRIT_REFSPEC' |
| 34 | branch: '$GERRIT_BRANCH' |
| 35 | submodule-recursive: 'false' |
| 36 | choosing-strategy: gerrit |
| 37 | jenkins-ssh-credential: '{jenkins-ssh-credential}' |
| 38 | |
| 39 | node: '{build-node}' |
| 40 | project-type: freestyle |
| 41 | concurrent: true |
| 42 | |
| 43 | builders: |
| 44 | - shell: !include-raw-escape: shell/licensecheck.sh |
| 45 | |
| 46 | |
| 47 | # run `ansible-lint` to validate ansible playbooks/roles |
| 48 | - job-template: |
| 49 | id: verify-ansible-lint |
Zack Williams | 92f9b1f | 2018-04-11 09:58:49 -0700 | [diff] [blame] | 50 | name: 'verify_{project}_ansible-lint' |
| 51 | description: | |
Zack Williams | 92f9b1f | 2018-04-11 09:58:49 -0700 | [diff] [blame] | 52 | Created by verify-ansible-lint job-template from ci-management/jjb/lint.yaml |
Zack Williams | 7468c36 | 2018-04-06 09:52:30 -0700 | [diff] [blame] | 53 | |
| 54 | triggers: |
| 55 | - cord-infra-gerrit-trigger-patchset: |
| 56 | gerrit-server-name: '{gerrit-server-name}' |
| 57 | project-regexp: '^{project}$' |
| 58 | branch-regexp: '{branch-regexp}' |
Zack Williams | c27ca2d | 2018-04-11 13:16:45 -0700 | [diff] [blame] | 59 | file-include-regexp: '{all-files-regexp}' |
Zack Williams | 7468c36 | 2018-04-06 09:52:30 -0700 | [diff] [blame] | 60 | dependency-jobs: '{dependency-jobs}' |
| 61 | |
| 62 | properties: |
| 63 | - cord-infra-properties: |
| 64 | build-days-to-keep: '{build-days-to-keep}' |
| 65 | artifact-num-to-keep: '{artifact-num-to-keep}' |
| 66 | |
| 67 | wrappers: |
| 68 | - lf-infra-wrappers: |
| 69 | build-timeout: '{build-timeout}' |
| 70 | jenkins-ssh-credential: '{jenkins-ssh-credential}' |
| 71 | |
| 72 | scm: |
| 73 | - lf-infra-gerrit-scm: |
| 74 | git-url: '$GIT_URL/$GERRIT_PROJECT' |
| 75 | refspec: '$GERRIT_REFSPEC' |
| 76 | branch: '$GERRIT_BRANCH' |
| 77 | submodule-recursive: 'false' |
| 78 | choosing-strategy: gerrit |
| 79 | jenkins-ssh-credential: '{jenkins-ssh-credential}' |
| 80 | |
| 81 | node: '{build-node}' |
| 82 | project-type: freestyle |
| 83 | concurrent: true |
| 84 | |
| 85 | builders: |
| 86 | - shell: !include-raw-escape: shell/ansiblelint.sh |
| 87 | |
| 88 | |
Zack Williams | d5ce0ea | 2019-01-02 11:49:17 -0700 | [diff] [blame] | 89 | # check helm charts with `helm lint --strict` and that charts version is |
| 90 | # updated when the contents of a chart is modified. |
Zack Williams | 7468c36 | 2018-04-06 09:52:30 -0700 | [diff] [blame] | 91 | - job-template: |
| 92 | id: verify-helm-lint |
Zack Williams | 92f9b1f | 2018-04-11 09:58:49 -0700 | [diff] [blame] | 93 | name: 'verify_{project}_helm-lint' |
| 94 | description: | |
Zack Williams | 92f9b1f | 2018-04-11 09:58:49 -0700 | [diff] [blame] | 95 | Created by verify-helm-lint job-template from ci-management/jjb/lint.yaml |
Zack Williams | 7468c36 | 2018-04-06 09:52:30 -0700 | [diff] [blame] | 96 | |
| 97 | triggers: |
| 98 | - cord-infra-gerrit-trigger-patchset: |
| 99 | gerrit-server-name: '{gerrit-server-name}' |
| 100 | project-regexp: '^{project}$' |
| 101 | branch-regexp: '{branch-regexp}' |
Zack Williams | c27ca2d | 2018-04-11 13:16:45 -0700 | [diff] [blame] | 102 | file-include-regexp: '{all-files-regexp}' |
Zack Williams | 7468c36 | 2018-04-06 09:52:30 -0700 | [diff] [blame] | 103 | dependency-jobs: '{dependency-jobs}' |
| 104 | |
| 105 | properties: |
| 106 | - cord-infra-properties: |
| 107 | build-days-to-keep: '{build-days-to-keep}' |
| 108 | artifact-num-to-keep: '{artifact-num-to-keep}' |
| 109 | |
| 110 | wrappers: |
| 111 | - lf-infra-wrappers: |
| 112 | build-timeout: '{build-timeout}' |
| 113 | jenkins-ssh-credential: '{jenkins-ssh-credential}' |
| 114 | |
| 115 | scm: |
| 116 | - lf-infra-gerrit-scm: |
| 117 | git-url: '$GIT_URL/$GERRIT_PROJECT' |
| 118 | refspec: '$GERRIT_REFSPEC' |
| 119 | branch: '$GERRIT_BRANCH' |
| 120 | submodule-recursive: 'false' |
| 121 | choosing-strategy: gerrit |
| 122 | jenkins-ssh-credential: '{jenkins-ssh-credential}' |
| 123 | |
| 124 | node: '{build-node}' |
| 125 | project-type: freestyle |
| 126 | concurrent: true |
| 127 | |
| 128 | builders: |
Zack Williams | 61f0111 | 2018-05-15 15:57:42 -0700 | [diff] [blame] | 129 | - shell: | |
Zack Williams | 82a8da4 | 2018-08-20 11:11:12 -0700 | [diff] [blame] | 130 | #!/usr/bin/env bash |
| 131 | set -eu -o pipefail |
| 132 | |
Zack Williams | 1ab8892 | 2019-05-22 15:43:23 -0700 | [diff] [blame^] | 133 | # Setup helm and external repos |
Zack Williams | 61f0111 | 2018-05-15 15:57:42 -0700 | [diff] [blame] | 134 | helm init --client-only |
Zack Williams | 1ab8892 | 2019-05-22 15:43:23 -0700 | [diff] [blame^] | 135 | helm repo add incubator https://kubernetes-charts-incubator.storage.googleapis.com |
Zack Williams | b557a21 | 2018-08-17 14:53:10 -0700 | [diff] [blame] | 136 | helm repo add rook-beta https://charts.rook.io/beta |
Luca Prete | ae7fc49 | 2018-12-13 16:00:37 -0800 | [diff] [blame] | 137 | helm repo add cord https://charts.opencord.org |
Zack Williams | 61f0111 | 2018-05-15 15:57:42 -0700 | [diff] [blame] | 138 | |
Luca Prete | 2ae9013 | 2018-12-13 17:14:01 -0800 | [diff] [blame] | 139 | git clone https://gerrit.opencord.org/helm-repo-tools |
| 140 | ./helm-repo-tools/helmlint.sh clean |
Zack Williams | 70123f0 | 2019-01-23 12:15:12 -0700 | [diff] [blame] | 141 | |
| 142 | # Specify the remote branch to compare against |
| 143 | export COMPARISON_BRANCH="origin/$GERRIT_BRANCH" |
Zack Williams | d5ce0ea | 2019-01-02 11:49:17 -0700 | [diff] [blame] | 144 | ./helm-repo-tools/chart_version_check.sh |
Zack Williams | 32293ee | 2018-05-18 09:15:13 -0700 | [diff] [blame] | 145 | |
| 146 | |
| 147 | # run `shellcheck` to validate shell scripts charts |
| 148 | - job-template: |
| 149 | id: verify-shellcheck |
| 150 | name: 'verify_{project}_shellcheck' |
| 151 | description: | |
| 152 | Created by {id} job-template from ci-management/jjb/lint.yaml |
| 153 | |
| 154 | triggers: |
| 155 | - cord-infra-gerrit-trigger-patchset: |
| 156 | gerrit-server-name: '{gerrit-server-name}' |
| 157 | project-regexp: '^{project}$' |
| 158 | branch-regexp: '{branch-regexp}' |
| 159 | file-include-regexp: '{all-files-regexp}' |
| 160 | dependency-jobs: '{dependency-jobs}' |
| 161 | |
| 162 | properties: |
| 163 | - cord-infra-properties: |
| 164 | build-days-to-keep: '{build-days-to-keep}' |
| 165 | artifact-num-to-keep: '{artifact-num-to-keep}' |
| 166 | |
| 167 | wrappers: |
| 168 | - lf-infra-wrappers: |
| 169 | build-timeout: '{build-timeout}' |
| 170 | jenkins-ssh-credential: '{jenkins-ssh-credential}' |
| 171 | |
| 172 | scm: |
| 173 | - lf-infra-gerrit-scm: |
| 174 | git-url: '$GIT_URL/$GERRIT_PROJECT' |
| 175 | refspec: '$GERRIT_REFSPEC' |
| 176 | branch: '$GERRIT_BRANCH' |
| 177 | submodule-recursive: 'false' |
| 178 | choosing-strategy: gerrit |
| 179 | jenkins-ssh-credential: '{jenkins-ssh-credential}' |
| 180 | |
| 181 | node: '{build-node}' |
| 182 | project-type: freestyle |
| 183 | concurrent: true |
| 184 | |
| 185 | builders: |
| 186 | - shell: !include-raw-escape: shell/shcheck.sh |