Change in osmo-ci[master]: OBS: require PROJ environment variable to be set

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

osmith gerrit-no-reply at lists.osmocom.org
Thu Apr 29 14:08:38 UTC 2021


osmith has submitted this change. ( https://gerrit.osmocom.org/c/osmo-ci/+/23949 )

Change subject: OBS: require PROJ environment variable to be set
......................................................................

OBS: require PROJ environment variable to be set

Uploading to network:osmocom:* should only be done when these scripts
are running in the Osmocom jenkins. Remove the default and require users
of the script to explicitly set PROJ.

Related: SYS#5370
Change-Id: If49ce217e77716b63dfde9139e869672a54b66a2
---
M jobs/osmocom-obs.yml
M scripts/common-obs.sh
M scripts/osmocom-latest-packages.sh
M scripts/osmocom-nightly-packages.sh
4 files changed, 15 insertions(+), 22 deletions(-)

Approvals:
  osmith: Looks good to me, approved; Verified



diff --git a/jobs/osmocom-obs.yml b/jobs/osmocom-obs.yml
index 4d165d6..9bdadeb 100644
--- a/jobs/osmocom-obs.yml
+++ b/jobs/osmocom-obs.yml
@@ -26,7 +26,8 @@
           description: osmo-ci.git branch
           default: 'refs/remotes/origin/master'
     builders:
-      - shell:
+      - shell: |
+          export PROJ=network:osmocom:{type}
           ./scripts/osmocom-{type}-packages.sh
     scm:
       - git:
diff --git a/scripts/common-obs.sh b/scripts/common-obs.sh
index 38719c8..c5b03f9 100644
--- a/scripts/common-obs.sh
+++ b/scripts/common-obs.sh
@@ -15,6 +15,10 @@
 	sed \
 	wget
 
+if [ -z "$PROJ" ]; then
+	echo "PROJ environment variable is not set"
+	exit 1
+fi
 
 # Add dependency to all (sub)packages in debian/control and commit the change.
 # $1: path to debian/control file
diff --git a/scripts/osmocom-latest-packages.sh b/scripts/osmocom-latest-packages.sh
index 8c979ef..a4a1aa9 100755
--- a/scripts/osmocom-latest-packages.sh
+++ b/scripts/osmocom-latest-packages.sh
@@ -1,14 +1,13 @@
 #!/bin/sh
 # Generate source packages and upload them to OBS, for the latest feed.
+# Environment variables:
+# * PROJ: the OBS namespace to upload to (e.g. "network:osmocom:latest")
 . "$(dirname "$0")/common.sh"
 . "$(dirname "$0")/common-obs.sh"
 
 set -e
 set -x
 
-# OBS project name
-PROJ=network:osmocom:latest
-
 DT=$(date +%Y%m%d%H%M)
 TOP=$(pwd)
 DEBSRCDIR="$TOP/debsrc"
diff --git a/scripts/osmocom-nightly-packages.sh b/scripts/osmocom-nightly-packages.sh
index 86f406e..5490e58 100755
--- a/scripts/osmocom-nightly-packages.sh
+++ b/scripts/osmocom-nightly-packages.sh
@@ -1,7 +1,8 @@
 #!/bin/bash
 # Generate source packages and upload them to OBS, for the nightly or next feed.
 # Environment variables:
-# * FEED: the binary package feed to upload to, this also controls the source branch that is used:
+# * PROJ: the OBS namespace to upload to (e.g. "network:osmocom:nightly")
+# * FEED: controls the source branch that is used:
 #   * "nightly": use "master" branch (default)
 #   * "next": use "next" branch if it exists, otherwise use "master" branch
 . "$(dirname "$0")/common.sh"
@@ -13,23 +14,12 @@
 DT=$(date +%Y%m%d%H%M)
 OSMO_OBS_CONFLICT_PKGVER="$OSMO_OBS_CONFLICT_PKGVER.$DT"
 TOP=$(pwd)/$(mktemp -d nightly-3g_XXXXXX)
+FEED="${FEED:-nightly}"
 
-# Set FEED and PROJ, based on the FEED env var
-parse_feed_proj() {
-  FEED="${FEED:-nightly}"
-  case "$FEED" in
-  nightly)
-    PROJ=network:osmocom:nightly
-    ;;
-  next)
-    PROJ=network:osmocom:next
-    ;;
-  *)
-    echo "unsupported feed: $FEED"
-    exit 1
-    ;;
-  esac
-}
+if [ "$FEED" != "nightly" ] && [ "$FEED" != "next" ]; then
+  echo "unsupported feed: $FEED"
+  exit 1
+fi
 
 ### OBS build
 prepare() {
@@ -286,5 +276,4 @@
   post
 }
 
-parse_feed_proj
 build_osmocom

-- 
To view, visit https://gerrit.osmocom.org/c/osmo-ci/+/23949
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-ci
Gerrit-Branch: master
Gerrit-Change-Id: If49ce217e77716b63dfde9139e869672a54b66a2
Gerrit-Change-Number: 23949
Gerrit-PatchSet: 4
Gerrit-Owner: osmith <osmith at sysmocom.de>
Gerrit-Reviewer: laforge <laforge at osmocom.org>
Gerrit-Reviewer: osmith <osmith at sysmocom.de>
Gerrit-Reviewer: pespin <pespin at sysmocom.de>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20210429/f21e9ed5/attachment.htm>


More information about the gerrit-log mailing list