aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOliver Smith <osmith@sysmocom.de>2021-04-27 14:15:54 +0200
committerOliver Smith <osmith@sysmocom.de>2021-04-29 16:04:00 +0200
commite660339f2e62efd5021df4e89bebf03dd7f238ce (patch)
tree27d2eaedfbf623ca4a109c4667e2293aeef80d4c
parent3c31513bccb687108423913d0c8bc320d8f21c70 (diff)
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
-rw-r--r--jobs/osmocom-obs.yml3
-rw-r--r--scripts/common-obs.sh4
-rwxr-xr-xscripts/osmocom-latest-packages.sh5
-rwxr-xr-xscripts/osmocom-nightly-packages.sh25
4 files changed, 15 insertions, 22 deletions
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 @@ osmo_cmd_require \
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 @@ set -x
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 @@ build_osmocom() {
post
}
-parse_feed_proj
build_osmocom