aboutsummaryrefslogtreecommitdiffstats
path: root/jobs/gerrit-binpkgs.yml
diff options
context:
space:
mode:
authorOliver Smith <osmith@sysmocom.de>2022-10-07 15:39:38 +0200
committerOliver Smith <osmith@sysmocom.de>2022-10-11 12:07:40 +0200
commit9e1f9ae0390e96eac52c448048bd13d771034397 (patch)
tree65b66a3be43d22a05f7ad1d31230dfb9c3fbf5ea /jobs/gerrit-binpkgs.yml
parent7614916a72011a15f226b7a0fc6003e7860374ec (diff)
jobs/gerrit-binpkgs: new job for deb, rpm packages
Build deb and rpm packages for each patch submitted to gerrit for the projects in the list. Example: https://gerrit.osmocom.org/c/osmo-bsc-nat/+/29492 Related: OS#2385 Change-Id: I7ca8869c2e9f2e7c74a360933be12b5c2b47c2fc
Diffstat (limited to 'jobs/gerrit-binpkgs.yml')
-rw-r--r--jobs/gerrit-binpkgs.yml118
1 files changed, 118 insertions, 0 deletions
diff --git a/jobs/gerrit-binpkgs.yml b/jobs/gerrit-binpkgs.yml
new file mode 100644
index 0000000..5c72a41
--- /dev/null
+++ b/jobs/gerrit-binpkgs.yml
@@ -0,0 +1,118 @@
+# This file holds all gerrit verifications for building deb and rpm packages.
+# https://jenkins.osmocom.org/jenkins/view/Jenkins-Gerrit/.
+# One can simply add a gerrit job by adding project's repository to repos list.
+
+- project:
+ name: gerrit-binpkgs
+ jobs:
+ - 'gerrit-binpkgs-{type}'
+ type:
+ - 'deb'
+ - 'rpm'
+
+- job-template:
+ name: 'gerrit-binpkgs-{type}'
+ project-type: freestyle
+ node: osmocom-gerrit-debian10 || osmocom-gerrit-debian11
+ concurrent: true
+ retry-count: 3 # scm checkout
+ properties:
+ - build-discarder:
+ days-to-keep: 30
+ num-to-keep: 120
+ artifact-days-to-keep: -1
+ artifact-num-to-keep: -1
+ description: |
+ {type} package 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/2385">OS#2385</a>
+
+ parameters:
+ - string:
+ name: BRANCH_CI
+ description: |
+ osmo-ci.git branch
+ default: 'origin/master'
+ - string:
+ name: GERRIT_REPO_URL
+ description: set by gerrit verification pipeline job
+ - string:
+ name: GERRIT_BRANCH
+ description: set by gerrit verification pipeline job
+ - string:
+ name: GERRIT_REFSPEC
+ description: set by gerrit verification pipeline job
+ - string:
+ name: PROJECT_NAME
+ description: project to test, e.g. 'libosmocore' (set by pipeline)
+
+ scm:
+ - git:
+ basedir: 'code-from-gerrit'
+ url: '$GERRIT_REPO_URL'
+ credentials-id: d5eda5e9-b59d-44ba-88d2-43473cb6e42d
+ branches:
+ - $GERRIT_BRANCH
+ refspec: $GERRIT_REFSPEC
+ name:
+ choosing-strategy: gerrit
+ wipe-workspace: true
+ skip-tag: true
+ submodule:
+ recursive: false
+ - git:
+ basedir: 'osmo-ci'
+ url: 'https://gerrit.osmocom.org/osmo-ci'
+ credentials-id: d5eda5e9-b59d-44ba-88d2-43473cb6e42d
+ branches:
+ - '$BRANCH_CI'
+ wipe-workspace: true
+
+ builders:
+ - shell: |-
+ # Skip rpm build if .spec.in file is missing
+ if [ "{type}" = "rpm" ] && [ -z "$(find code-from-gerrit -name '*.spec.in')" ]; then
+ set +x
+ echo
+ echo "No *.spec.in file found, skipping rpm build."
+ echo
+ exit 0
+ fi
+
+ # Get distro from type
+ case "{type}" in
+ deb) distro="debian:11" ;;
+ rpm) distro="almalinux:8" ;;
+ *) echo "unknown package format: '{type}'"; exit 1 ;;
+ esac
+
+ # Move code from gerrit to build_srcpkg.py's git cache
+ cache_dir=osmo-ci/scripts/obs/_cache
+ mkdir -p $cache_dir
+ mv code-from-gerrit "$cache_dir/$PROJECT_NAME"
+
+ # Set a known branch name
+ git -C "$cache_dir/$PROJECT_NAME" checkout -B "origin/gerrit"
+
+ # Build source package
+ cd osmo-ci/scripts/obs/
+ ./build_srcpkg.py \
+ --docker \
+ --feed master \
+ --git-branch gerrit \
+ --git-skip-fetch \
+ "$PROJECT_NAME"
+
+ # Build binary package
+ ./build_binpkg.py \
+ --docker "$distro" \
+ "$PROJECT_NAME"
+ wrappers:
+ - ansicolor:
+ colormap: xterm
+ - ssh-agent-credentials:
+ users:
+ - d5eda5e9-b59d-44ba-88d2-43473cb6e42d
+
+# vim: expandtab tabstop=2 shiftwidth=2