From 921da1fe4f05d51b81f2f241e01aeb94b1791337 Mon Sep 17 00:00:00 2001 From: Daniel Farrell Date: Tue, 12 Dec 2017 16:36:04 -0500 Subject: [PATCH] Do RPM tests in RPM build job to gate publish We currently only run our RPM tests after the RPM build job finishes. This isn't good because by the time we've tested the RPM it has already been pushed to Nexus and is being consumed by downstreams. Instead we should fail the RPM build job if the tests fail and not publish. Change-Id: I215de288923a308b95ebd242578d2a90d0b8e6ec Fixes: INTPAK-115 Signed-off-by: Daniel Farrell --- jjb/packaging/install-rpm.sh | 13 ++++++++----- jjb/packaging/packaging.yaml | 11 +++++++++++ 2 files changed, 19 insertions(+), 5 deletions(-) diff --git a/jjb/packaging/install-rpm.sh b/jjb/packaging/install-rpm.sh index 7f72f0683a..2ccc50078f 100644 --- a/jjb/packaging/install-rpm.sh +++ b/jjb/packaging/install-rpm.sh @@ -9,12 +9,15 @@ set -ex -o pipefail # Update mirror list to avoid slow/hung one sudo yum update -y yum-plugin-fastestmirror -# Install ODL from .rpm link or .repo url -if [[ $URL == *.rpm ]] -then +# Install ODL from RPM path, RPM URL or .repo file url +# NB: Paths must be anchored at root +if [[ $URL == /* ]]; then + # If path is globbed (/path/to/*.rpm), expand it + path=$(sudo find / -wholename $URL) + sudo yum install -y "$path" +elif [[ $URL == *.rpm ]]; then sudo yum install -y "$URL" -elif [[ $URL == *.repo ]] -then +elif [[ $URL == *.repo ]]; then # shellcheck disable=SC2154 repo_file="${{URL##*/}}" sudo curl --silent -o /etc/yum.repos.d/"$repo_file" "$URL" diff --git a/jjb/packaging/packaging.yaml b/jjb/packaging/packaging.yaml index ec22006832..2362190448 100644 --- a/jjb/packaging/packaging.yaml +++ b/jjb/packaging/packaging.yaml @@ -81,6 +81,17 @@ builders: - shell: !include-raw: build-rpm.sh - shell: !include-raw: test-rpm-deps.sh + - inject: + properties-content: 'URL=/home/$USER/rpmbuild/RPMS/noarch/*.rpm' + - shell: !include-raw: install-rpm.sh + - shell: !include-raw: start-odl.sh + - shell: | + # Install expect to interact with Karaf shell + sudo yum install -y expect + # Install nmap to check status of ODL's SSH port + sudo yum install -y nmap + - shell: !include-raw: test-karaf.expect + - shell: !include-raw: stop-odl.sh - lf-infra-deploy-maven-file: global-settings-file: 'global-settings' settings-file: 'packaging-settings' -- 2.36.6