Don't try/fail to push pkgs sandbox->Nexus 34/62734/1
authorDaniel Farrell <dfarrell@redhat.com>
Tue, 5 Sep 2017 22:56:22 +0000 (18:56 -0400)
committerDaniel Farrell <dfarrell@redhat.com>
Tue, 5 Sep 2017 22:56:22 +0000 (18:56 -0400)
The sandbox Jenkins silo doesn't have permission to push to Nexus, so
jobs that would push packages try to do so and fail, marking the entire
job as a failure. This checks if in sandbox and doesn't try if so,
preventing false negatives.

Ideally we'd also host the packages on sandbox Jenkins, but I haven't
figured out how to do so.

Change-Id: If1d660e8462c2e459a8d2aa69c6ce99af387b293
Signed-off-by: Daniel Farrell <dfarrell@redhat.com>
jjb/packaging/build-deb.sh
jjb/packaging/build-rpm-snap.sh
jjb/packaging/build-rpm.sh

index 4ccffa201fdde4fac94c75eb21f59a087f34d803..608f3bc79e826e05de3177acbc614165e1779b2f 100644 (file)
@@ -21,9 +21,19 @@ $PYTHON -m pip install -r "$WORKSPACE/packaging/packages/requirements.txt"
                                          direct \
                                          --download_url "$DOWNLOAD_URL"
 
-# Copy the debs to be upload
-UPLOAD_FILES_PATH="$WORKSPACE/upload_files"
-mkdir -p "$UPLOAD_FILES_PATH"
-# Note: no source packages are available, since the debs are not built
-# from the actual source
-mv "$WORKSPACE/packaging/packages/deb/opendaylight/"*.deb "$_"
+# Publish debs to Nexus if in production Jenkins, else host on sandbox Jenkins
+if [ "$SILO" == "sandbox" ]; then
+  # TODO: Host debs on Jenkins temporarily
+  echo "Not uploading debs to Nexus because running in sandbox"
+elif  [ "$SILO" == "releng" ]; then
+  # Copy the debs to be upload
+  # Move debs to dir of files that will be uploaded to Nexus
+  UPLOAD_FILES_PATH="$WORKSPACE/upload_files"
+  mkdir -p "$UPLOAD_FILES_PATH"
+  # Note: no source packages are available, since the debs are not built
+  # from the actual source
+  mv "$WORKSPACE/packaging/packages/deb/opendaylight/"*.deb "$_"
+else
+  echo "Unknown Jenkins silo: $SILO"
+  exit 1
+fi
index ebecea802b8a61d68591de7e4f0112b7dc9dae7c..b981c707b5ce9d5175b5723b8cdc0b79d4d2c92c 100644 (file)
@@ -39,8 +39,17 @@ fi
                                          latest_snap \
                                          --major "$VERSION_MAJOR"
 
-# Copy the rpm to be upload
-UPLOAD_FILES_PATH="$WORKSPACE/upload_files"
-mkdir -p "$UPLOAD_FILES_PATH"
-mv "/home/$USER/rpmbuild/RPMS/noarch/"*.rpm "$_"
-mv "/home/$USER/rpmbuild/SRPMS/"*.rpm "$_"
+# Publish RPMs to Nexus if in production Jenkins, else host on sandbox Jenkins
+if [ "$SILO" == "sandbox" ]; then
+  # TODO: Host RPMs on Jenkins temporarily
+  echo "Not uploading RPMs to Nexus because running in sandbox"
+elif  [ "$SILO" == "releng" ]; then
+  # Move RPMs (SRPM and noarch) to dir of files that will be uploaded to Nexus
+  UPLOAD_FILES_PATH="$WORKSPACE/upload_files"
+  mkdir -p "$UPLOAD_FILES_PATH"
+  mv "/home/$USER/rpmbuild/RPMS/noarch/"*.rpm "$_"
+  mv "/home/$USER/rpmbuild/SRPMS/"*.rpm "$_"
+else
+  echo "Unknown Jenkins silo: $SILO"
+  exit 1
+fi
index 4d411ff35003ad6813d12d8108a5e03e911afb57..73d6c198cf25ee81afd621a70a707e499167d188 100644 (file)
@@ -36,8 +36,17 @@ fi
                                          direct \
                                          --download_url "$DOWNLOAD_URL"
 
-# Move RPMs (SRPM and noarch) to dir of files that will be uploaded to Nexus
-UPLOAD_FILES_PATH="$WORKSPACE/upload_files"
-mkdir -p "$UPLOAD_FILES_PATH"
-mv "/home/$USER/rpmbuild/RPMS/noarch/"*.rpm "$_"
-mv "/home/$USER/rpmbuild/SRPMS/"*.rpm "$_"
+# Publish RPMs to Nexus if in production Jenkins, else host on sandbox Jenkins
+if [ "$SILO" == "sandbox" ]; then
+  # TODO: Host RPMs on Jenkins temporarily
+  echo "Not uploading RPMs to Nexus because running in sandbox"
+elif  [ "$SILO" == "releng" ]; then
+  # Move RPMs (SRPM and noarch) to dir of files that will be uploaded to Nexus
+  UPLOAD_FILES_PATH="$WORKSPACE/upload_files"
+  mkdir -p "$UPLOAD_FILES_PATH"
+  mv "/home/$USER/rpmbuild/RPMS/noarch/"*.rpm "$_"
+  mv "/home/$USER/rpmbuild/SRPMS/"*.rpm "$_"
+else
+  echo "Unknown Jenkins silo: $SILO"
+  exit 1
+fi