diff options
author | Oliver Smith <osmith@sysmocom.de> | 2022-10-06 11:49:59 +0200 |
---|---|---|
committer | Oliver Smith <osmith@sysmocom.de> | 2022-10-07 15:39:53 +0200 |
commit | 58ecce985b5225793e337da7fb9adb43d8031940 (patch) | |
tree | 03820ec21b2aae8453c222a3c95c96db2eaa5a53 | |
parent | 4d214f4f9af1d33b840c64937172cd2f8a412698 (diff) |
jobs/gerrit-lint: run as part of pipeline
Reduce mails by running gerrit-lint as part of the gerrit-verifications
pipeline.
Related: OS#2385
Change-Id: I5f1340248cd116c5fa5134eee3fae50baf7ef851
-rw-r--r-- | jobs/gerrit-lint.yml | 142 | ||||
-rw-r--r-- | jobs/gerrit-verifications.yml | 39 |
2 files changed, 65 insertions, 116 deletions
diff --git a/jobs/gerrit-lint.yml b/jobs/gerrit-lint.yml index 602ce68..819d17d 100644 --- a/jobs/gerrit-lint.yml +++ b/jobs/gerrit-lint.yml @@ -1,99 +1,17 @@ # This file holds all gerrit lint verifications https://jenkins.osmocom.org/jenkins/view/Jenkins-Gerrit/. -# One can simply add a gerrit job by adding project's repository to repos list. +# Add project's repositories to jobs/gerrit-verifications.yml. When +# pipeline_lint is set for that project, the pipeline will call the gerrit-lint +# job for it. - project: name: gerrit-lint - # following default values can be overridden by each repo - disabled: false - gerrit_url: 'ssh://jenkins@gerrit.osmocom.org:29418' - repos_url: '{gerrit_url}/{repos}' - gerrit_project: '{repos}' - - # in alphabetical order - repos: - - asn1c - - cellmgr-ng - - docker-playground - - libasn1c - - libgtpnl - - libosmo-abis - - libosmo-gprs - - libosmo-netif - - libosmo-pfcp - - libosmo-sccp - - libosmocore - - libsmpp34 - - libtelnet - - libusrp - - openbsc - - openggsn - - osmo-bsc - - osmo-bsc-nat - - osmo-bts - - osmo-hnodeb - - osmo-hnbgw - - osmo-upf - - osmo-ci - - - osmo_dia2gsup: - repos_url: '{gerrit_url}/erlang/{repos}' - gerrit_project: 'erlang/{repos}' - - - osmo-e1-hardware - - osmo-ggsn - - osmo-gsm-manuals - - - osmo_gsup: - repos_url: '{gerrit_url}/erlang/{repos}' - gerrit_project: 'erlang/{repos}' - - - osmo-hlr - - osmo-iuh - - osmo-mgw - - osmo-msc - - osmo-pcap - - osmo-pcu - - - osmo-python-tests: - repos_url: '{gerrit_url}/python/{repos}' - gerrit_project: 'python/{repos}' - - - osmo-sgsn - - - osmo_ss7: - repos_url: '{gerrit_url}/erlang/{repos}' - gerrit_project: 'erlang/{repos}' - - - osmo-sip-connector - - osmo-trx - - osmocom-bb - - osmo-tetra - - osmo-sysmon - - osmo-remsim - - simtrace2 - - osmo-asf4-dfu - - osmo-ccid-firmware - - osmo-e1d - - osmo-cbc - - osmo-e1-recorder - - gapk - - osmo-uecups - - osmo-el2tpd - - osmo-smlc - - osmo-gbproxy - - pysim - - - osmo-ttcn3-hacks: - repos_url: 'https://gerrit.osmocom.org/{repos}' - jobs: - - 'gerrit-{repos}-lint' + - 'gerrit-lint' -- job-template: - name: 'gerrit-{repos}-lint' +- job: + name: 'gerrit-lint' project-type: freestyle node: osmocom-gerrit-debian9 - disabled: '{obj:disabled}' retry-count: 3 # scm checkout properties: - build-discarder: @@ -102,8 +20,7 @@ artifact-days-to-keep: -1 artifact-num-to-keep: -1 description: | - Run linting on patches submitted to gerrit for - <a href="https://gerrit.osmocom.org/#/q/status:open+project:{repos}">{repos}</a> + Lint job of CI for patches sent to <a href="https://gerrit.osmocom.org">gerrit</a>. </br></br> Related issue: <a href="https://osmocom.org/issues/5087">OS#5087</a> @@ -113,11 +30,29 @@ description: | osmo-ci.git branch default: 'master' + - string: + name: GERRIT_BRANCH + description: set by gerrit verification pipeline job + - string: + name: GERRIT_HOST + description: set by gerrit verification pipeline job + - string: + name: GERRIT_PATCHSET_REVISION + description: set by gerrit verification pipeline job + - string: + name: GERRIT_PORT + description: set by gerrit verification pipeline job + - string: + name: GERRIT_REFSPEC + description: set by gerrit verification pipeline job + - string: + name: GERRIT_REPO_URL + description: set by gerrit verification pipeline job scm: - git: basedir: 'code-from-gerrit' - url: '{obj:repos_url}' + url: '$GERRIT_REPO_URL' credentials-id: d5eda5e9-b59d-44ba-88d2-43473cb6e42d branches: - $GERRIT_BRANCH @@ -130,35 +65,12 @@ recursive: false - git: basedir: 'osmo-ci' - url: '{gerrit_url}/osmo-ci' + url: 'https://gerrit.osmocom.org/osmo-ci' credentials-id: d5eda5e9-b59d-44ba-88d2-43473cb6e42d branches: - '$BRANCH_CI' wipe-workspace: true - triggers: - - gerrit: - trigger-on: - - patchset-created-event: - exclude-drafts: true - exclude-no-code-change: true - projects: - - project-compare-type: 'PLAIN' - project-pattern: '{obj:gerrit_project}' - branches: - - branch-compare-type: 'ANT' - branch-pattern: '**' - skip-vote: - successful: false - failed: false - unstable: false - notbuilt: false - silent: false - escape-quotes: false - no-name-and-email: false - trigger-for-unreviewed-patches: true - server-name: gerrit.osmocom.org - builders: - shell: 'cd code-from-gerrit && ../osmo-ci/lint/lint_diff.sh HEAD~1' diff --git a/jobs/gerrit-verifications.yml b/jobs/gerrit-verifications.yml index 26f7f64..135e04f 100644 --- a/jobs/gerrit-verifications.yml +++ b/jobs/gerrit-verifications.yml @@ -66,11 +66,16 @@ gerrit_project: '{repos}' # Which jobs to run in the pipeline pipeline_build: true + pipeline_lint: true # in alphabetical order repos: - asn1c - cellmgr-ng + + - docker-playground: + pipeline_build: false + - libasn1c - libgtpnl - libosmo-abis @@ -300,7 +305,8 @@ su build -c 'make compile'; " - - dahdi-tools + - dahdi-tools: + pipeline_lint: false jobs: - 'gerrit-{repos}' @@ -314,6 +320,14 @@ name: PIPELINE_BUILD description: Enable the build job (runs contrib/jenkins.sh) default: '{obj:pipeline_build}' + - bool: + name: PIPELINE_LINT + description: Enable the lint job + default: '{obj:pipeline_lint}' + - string: + name: REPO_URL + description: Clone URL, to be passed to jobs started in the pipeline + default: '{obj:repos_url}' dsl: | pipeline {{ agent {{ label "osmocom-gerrit" }} @@ -338,11 +352,34 @@ }} }} }} + stage("Lint") {{ + when {{ + expression {{ params.PIPELINE_LINT }} + }} + steps {{ + script {{ + // Run the lint job for this repository and keep going on failure + catchError(buildResult: 'SUCCESS', stageResult: 'FAILURE') {{ + env.PIPELINE_LINT_PASSED = "0" + build job: 'gerrit-lint', parameters: [ + string(name: "GERRIT_BRANCH", value: "${{env.GERRIT_BRANCH}}"), + string(name: "GERRIT_HOST", value: "${{env.GERRIT_HOST}}"), + string(name: "GERRIT_PATCHSET_REVISION", value: "${{env.GERRIT_PATCHSET_REVISION}}"), + string(name: "GERRIT_PORT", value: "${{env.GERRIT_PORT}}"), + string(name: "GERRIT_REFSPEC", value: "${{env.GERRIT_REFSPEC}}"), + string(name: "GERRIT_REPO_URL", value: "${{env.REPO_URL}}"), + ] + env.PIPELINE_LINT_PASSED = "1" + }} + }} + }} + }} }} }} stage("Result") {{ steps {{ echo "PIPELINE_BUILD_PASSED=${{env.PIPELINE_BUILD_PASSED}}" + echo "PIPELINE_LINT_PASSED=${{env.PIPELINE_LINT_PASSED}}" }} }} // The end result is success if all started jobs were successful, |