mirror of https://gerrit.osmocom.org/osmo-ci
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
This commit is contained in:
parent
4d214f4f9a
commit
58ecce985b
|
@ -1,99 +1,17 @@
|
||||||
# This file holds all gerrit lint verifications https://jenkins.osmocom.org/jenkins/view/Jenkins-Gerrit/.
|
# 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:
|
- project:
|
||||||
name: gerrit-lint
|
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:
|
jobs:
|
||||||
- 'gerrit-{repos}-lint'
|
- 'gerrit-lint'
|
||||||
|
|
||||||
- job-template:
|
- job:
|
||||||
name: 'gerrit-{repos}-lint'
|
name: 'gerrit-lint'
|
||||||
project-type: freestyle
|
project-type: freestyle
|
||||||
node: osmocom-gerrit-debian9
|
node: osmocom-gerrit-debian9
|
||||||
disabled: '{obj:disabled}'
|
|
||||||
retry-count: 3 # scm checkout
|
retry-count: 3 # scm checkout
|
||||||
properties:
|
properties:
|
||||||
- build-discarder:
|
- build-discarder:
|
||||||
|
@ -102,8 +20,7 @@
|
||||||
artifact-days-to-keep: -1
|
artifact-days-to-keep: -1
|
||||||
artifact-num-to-keep: -1
|
artifact-num-to-keep: -1
|
||||||
description: |
|
description: |
|
||||||
Run linting on patches submitted to gerrit for
|
Lint job of CI for patches sent to <a href="https://gerrit.osmocom.org">gerrit</a>.
|
||||||
<a href="https://gerrit.osmocom.org/#/q/status:open+project:{repos}">{repos}</a>
|
|
||||||
</br></br>
|
</br></br>
|
||||||
Related issue: <a href="https://osmocom.org/issues/5087">OS#5087</a>
|
Related issue: <a href="https://osmocom.org/issues/5087">OS#5087</a>
|
||||||
|
|
||||||
|
@ -113,11 +30,29 @@
|
||||||
description: |
|
description: |
|
||||||
osmo-ci.git branch
|
osmo-ci.git branch
|
||||||
default: 'master'
|
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:
|
scm:
|
||||||
- git:
|
- git:
|
||||||
basedir: 'code-from-gerrit'
|
basedir: 'code-from-gerrit'
|
||||||
url: '{obj:repos_url}'
|
url: '$GERRIT_REPO_URL'
|
||||||
credentials-id: d5eda5e9-b59d-44ba-88d2-43473cb6e42d
|
credentials-id: d5eda5e9-b59d-44ba-88d2-43473cb6e42d
|
||||||
branches:
|
branches:
|
||||||
- $GERRIT_BRANCH
|
- $GERRIT_BRANCH
|
||||||
|
@ -130,35 +65,12 @@
|
||||||
recursive: false
|
recursive: false
|
||||||
- git:
|
- git:
|
||||||
basedir: 'osmo-ci'
|
basedir: 'osmo-ci'
|
||||||
url: '{gerrit_url}/osmo-ci'
|
url: 'https://gerrit.osmocom.org/osmo-ci'
|
||||||
credentials-id: d5eda5e9-b59d-44ba-88d2-43473cb6e42d
|
credentials-id: d5eda5e9-b59d-44ba-88d2-43473cb6e42d
|
||||||
branches:
|
branches:
|
||||||
- '$BRANCH_CI'
|
- '$BRANCH_CI'
|
||||||
wipe-workspace: true
|
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:
|
builders:
|
||||||
- shell: 'cd code-from-gerrit && ../osmo-ci/lint/lint_diff.sh HEAD~1'
|
- shell: 'cd code-from-gerrit && ../osmo-ci/lint/lint_diff.sh HEAD~1'
|
||||||
|
|
||||||
|
|
|
@ -66,11 +66,16 @@
|
||||||
gerrit_project: '{repos}'
|
gerrit_project: '{repos}'
|
||||||
# Which jobs to run in the pipeline
|
# Which jobs to run in the pipeline
|
||||||
pipeline_build: true
|
pipeline_build: true
|
||||||
|
pipeline_lint: true
|
||||||
|
|
||||||
# in alphabetical order
|
# in alphabetical order
|
||||||
repos:
|
repos:
|
||||||
- asn1c
|
- asn1c
|
||||||
- cellmgr-ng
|
- cellmgr-ng
|
||||||
|
|
||||||
|
- docker-playground:
|
||||||
|
pipeline_build: false
|
||||||
|
|
||||||
- libasn1c
|
- libasn1c
|
||||||
- libgtpnl
|
- libgtpnl
|
||||||
- libosmo-abis
|
- libosmo-abis
|
||||||
|
@ -300,7 +305,8 @@
|
||||||
su build -c 'make compile';
|
su build -c 'make compile';
|
||||||
"
|
"
|
||||||
|
|
||||||
- dahdi-tools
|
- dahdi-tools:
|
||||||
|
pipeline_lint: false
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
- 'gerrit-{repos}'
|
- 'gerrit-{repos}'
|
||||||
|
@ -314,6 +320,14 @@
|
||||||
name: PIPELINE_BUILD
|
name: PIPELINE_BUILD
|
||||||
description: Enable the build job (runs contrib/jenkins.sh)
|
description: Enable the build job (runs contrib/jenkins.sh)
|
||||||
default: '{obj:pipeline_build}'
|
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: |
|
dsl: |
|
||||||
pipeline {{
|
pipeline {{
|
||||||
agent {{ label "osmocom-gerrit" }}
|
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") {{
|
stage("Result") {{
|
||||||
steps {{
|
steps {{
|
||||||
echo "PIPELINE_BUILD_PASSED=${{env.PIPELINE_BUILD_PASSED}}"
|
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,
|
// The end result is success if all started jobs were successful,
|
||||||
|
|
Loading…
Reference in New Issue