--- /dev/null
+#!/bin/bash
+
+# Options:
+# -x: Echo commands
+# -e: Fail on errors
+# -o pipefail: Fail on errors in scripts this calls, give stacktrace
+set -ex -o pipefail
+
+env | grep STREAM > env-file
+
+scripts_path=/builder/jjb/packaging
+
+docker_id=$(sudo docker run --env-file env-file --name build_rpm_epel -di --privileged -v /sys/fs/cgroup:/sys/fs/cgroup:ro centos /usr/lib/systemd/systemd)
+
+sudo docker cp "$(pwd)"/packaging/ $docker_id:/packaging
+
+sudo docker exec $docker_id /usr/bin/yum -y install sudo rpmdevtools rpmbuild git python-virtualenv python
+
+sudo docker exec $docker_id git clone https://git.opendaylight.org/gerrit/releng/builder
+
+sudo docker exec $docker_id /bin/bash $scripts_path/build-rpm-snap.sh
latest_snap \
--major "$VERSION_MAJOR"
-# 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"
- cp "/home/$USER/rpmbuild/RPMS/noarch/"*.rpm "$_"
- cp "/home/$USER/rpmbuild/SRPMS/"*.rpm "$_"
-else
- echo "Unknown Jenkins silo: $SILO"
- exit 1
-fi
# Update mirror list to avoid slow/hung one
sudo yum update -y yum-plugin-fastestmirror
+# Use local RPM in build-out dir if URL not passed
+URL=${URL:-"$HOME/rpmbuild/RPMS/noarch/*.rpm"}
+
# Install ODL from RPM path, RPM URL or .repo file url
# NB: Paths must be anchored at root
if [[ $URL == /* ]]; then
# Install nmap to check status of ODL's SSH port
sudo yum install -y expect nmap
- shell: !include-raw: test-rpm-deps.sh
- - shell: !include-raw-escape: install-rpm.sh
+ - shell: !include-raw: install-rpm.sh
- shell: !include-raw: start-odl.sh
- shell: !include-raw: test-ports-nofeature.sh
- - shell: !include-raw: test-karaf.expect
+ - shell: !include-raw: test-karaf-oxygensafe.expect
# Disable this test until ODLPARENT-139 is fixed
# - shell: !include-raw: test-rest-ok.sh
- shell: !include-raw: stop-odl.sh
- job-template:
name: 'packaging-build-rpm-snap-{stream}'
- node: centos7-builder-2c-8g
+ node: centos7-docker-2c-8g
project-type: freestyle
builders:
- inject:
properties-content: 'STREAM={stream}'
- - shell: !include-raw: build-rpm-snap.sh
- - install-test-uninstall-rpm
+ - shell: !include-raw: build-rpm-snap-docker.sh
+ - shell: !include-raw: test-rpm-docker.sh
- lf-infra-deploy-maven-file:
global-settings-file: 'global-settings'
settings-file: 'packaging-settings'
- shell: !include-raw-escape: install-rpm.sh
- shell: !include-raw: start-odl.sh
- shell: !include-raw-escape: test-ports-nofeature.sh
- - shell: !include-raw: test-karaf.expect
+ - shell: !include-raw: test-karaf-oxygensafe.expect
# Disable this test until ODLPARENT-139 is fixed
# - shell: !include-raw-escape: test-rest-ok.sh
- shell: !include-raw: stop-odl.sh
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: test-karaf-oxygensafe.expect
- shell: !include-raw: stop-odl.sh
- shell: !include-raw: test-rpm-upgrade.sh
- shell: !include-raw: start-odl.sh
- - shell: !include-raw: test-karaf.expect
+ - shell: !include-raw: test-karaf-oxygensafe.expect
- shell: !include-raw: stop-odl.sh
- shell: !include-raw: uninstall-rpm.sh
sudo apt-get install -y expect
# Install nmap to check status of ODL's SSH port
sudo apt-get install -y nmap
- - shell: !include-raw: test-karaf.expect
+ - shell: !include-raw: test-karaf-oxygensafe.expect
- shell: !include-raw: stop-odl.sh
publishers:
# Check systemd status of OpenDaylight, will fail if rc is nonzero
sudo systemctl status opendaylight
+# Wait up to 60 seconds for ODL's Java process to start
+for i in $(seq 20); do
+ pgrep java && break || sleep 3
+ echo "Waited $((i * 3)) seconds for ODL Java process to start"
+done
+
# Verify Java process is running, will fail if rc is nonzero
pgrep java
--- /dev/null
+#!/usr/bin/expect
+# This script starts the Karaf shell and sends the password for SSH auth.
+# Further tests in Karaf shell can be done here
+
+# Echo commands
+log_user 1
+
+# Time expect will wait for output
+set timeout 30
+
+# Default password
+set password "karaf"
+# Default prompt
+set prompt "opendaylight-user@root>"
+
+# Wait for Karaf SSH server to come online
+send_user "Waiting on OpenDaylight to start listening for SSH on port 8101\n"
+exec bash -c "while ! nmap -Pn -p8101 localhost | grep -q open; do sleep 0.1; done"
+
+# SSH into Karaf shell
+spawn ssh -p 8101 -o StrictHostKeyChecking=no karaf@127.0.0.1
+
+# Auth to Karaf shell
+expect "Password authentication"
+expect "Password: "
+send "$password\r"
+
+# Show features to make debugging easier
+expect "$prompt"
+send "feature:list\r"
+
+# Verify that a major feature is present
+expect "$prompt"
+send "feature:list | grep odl-netvirt-openstack\r"
+expect {{
+ timeout {{
+ send_user "\nTest feature not found\n"
+ exit 1
+ }}
+ "OpenDaylight :: NetVirt :: OpenStack" {{
+ send_user "\nTest feature available\n"
+ }}
+}}
+
+# Disable this test until ODLPARENT-139 is fixed
+# Install feature
+# expect "$prompt"
+# send "feature:install odl-netvirt-openstack\r"
+# expect {{
+# "Error executing command: Can't install feature" {{
+# send_user "\nFailed to install test feature\n"
+# exit 1
+# }}
+# }}
+
+# Verify installed feature is actually installed
+# expect "$prompt"
+# The -i flag will only show installed features
+# send "feature:list -i | grep odl-netvirt-openstack\r"
+# expect {{
+# timeout {{
+# send_user "\nTest feature not installed\n"
+# exit 1
+# }}
+# "OpenDaylight :: NetVirt :: OpenStack" {{
+# send_user "\nTest feature installed successfully\n"
+# }}
+# }}
}}
}}
-# Disable this test until ODLPARENT-139 is fixed
# Install feature
-# expect "$prompt"
-# send "feature:install odl-netvirt-openstack\r"
-# expect {{
-# "Error executing command: Can't install feature" {{
-# send_user "\nFailed to install test feature\n"
-# exit 1
-# }}
-# }}
+expect "$prompt"
+send "feature:install odl-netvirt-openstack\r"
+expect {{
+ "Error executing command: Can't install feature" {{
+ send_user "\nFailed to install test feature\n"
+ exit 1
+ }}
+}}
# Verify installed feature is actually installed
-# expect "$prompt"
-# The -i flag will only show installed features
-# send "feature:list -i | grep odl-netvirt-openstack\r"
-# expect {{
-# timeout {{
-# send_user "\nTest feature not installed\n"
-# exit 1
-# }}
-# "OpenDaylight :: NetVirt :: OpenStack" {{
-# send_user "\nTest feature installed successfully\n"
-# }}
-# }}
+expect "$prompt"
+# The -i flag will show only installed features
+send "feature:list -i | grep odl-netvirt-openstack\r"
+expect {{
+ timeout {{
+ send_user "\nTest feature not installed\n"
+ exit 1
+ }}
+ "OpenDaylight :: NetVirt :: OpenStack" {{
+ send_user "\nTest feature installed successfully\n"
+ }}
+}}
set -ex -o pipefail
# Verify exactly 1 RPM is in the path we expect
-set -- /home/$USER/rpmbuild/RPMS/noarch/*.rpm
+set -- $HOME/rpmbuild/RPMS/noarch/*.rpm
if [ $# -eq 1 ]; then
echo "Found one RPM in build out dir, as expected"
else
fi
# If path is globbed (/path/to/*.rpm), expand it
-path=$(sudo find / -wholename /home/$USER/rpmbuild/RPMS/noarch/*.rpm)
+path=$(sudo find / -wholename $HOME/rpmbuild/RPMS/noarch/*.rpm)
# If no RPM found, fail clearly
if [ -z $path ]; then
fi
# shellcheck disable=SC2034
-mapfile -t actual_deps < <( rpm -qp /home/$USER/rpmbuild/RPMS/noarch/*.rpm --requires )
+mapfile -t actual_deps < <( rpm -qp $HOME/rpmbuild/RPMS/noarch/*.rpm --requires )
# shellcheck disable=SC2154 disable=SC2145
printf 'Dependency found: %s\n' "${actual_deps[@]}"
--- /dev/null
+#!/bin/bash
+
+# Options:
+# -x: Echo commands
+# -e: Fail on errors
+# -o pipefail: Fail on errors in scripts this calls, give stacktrace
+set -ex -o pipefail
+
+scripts_path=/builder/jjb/packaging
+
+# A docker container must have been created by the build script
+docker_id=$(sudo docker ps -qf name=build_rpm_epel)
+
+sudo docker exec $docker_id /usr/bin/yum -y install curl expect nmap openssh
+
+sudo docker exec $docker_id /bin/bash $scripts_path/test-rpm-deps.sh
+
+sudo docker exec $docker_id /bin/bash $scripts_path/install-rpm.sh
+
+sudo docker exec $docker_id /bin/bash $scripts_path/start-odl.sh
+
+sudo docker exec $docker_id /bin/bash $scripts_path/test-ports-nofeature.sh
+
+# Don't install test feature and check REST for Oxygen, ODLPARENT-139 breaks it
+if [ "$STREAM" == "oxygen" ]; then
+ sudo docker exec $docker_id /usr/bin/expect $scripts_path/test-karaf-oxygensafe.expect
+else
+ sudo docker exec $docker_id /usr/bin/expect $scripts_path/test-karaf.expect
+ sudo docker exec $docker_id /bin/bash $scripts_path/test-rest-ok.sh
+fi
+
+sudo docker exec $docker_id /bin/bash $scripts_path/stop-odl.sh
+
+sudo docker exec $docker_id /bin/bash $scripts_path/uninstall-rpm.sh
+
+if [ "$SILO" == "sandbox" ]; then
+ echo "Not uploading RPMs to Nexus because running in sandbox"
+elif [ "$SILO" == "releng" ]; then
+ RPM_NAME=$(sudo docker exec $docker_id find /root/rpmbuild/RPMS/noarch/ -wholename '*.rpm')
+ SRPM_NAME=$(sudo docker exec $docker_id find /root/rpmbuild/SRPMS/ -wholename '*.rpm')
+ UPLOAD_FILES_PATH="$WORKSPACE/upload_files"
+ mkdir -p "$UPLOAD_FILES_PATH"
+ sudo docker cp $docker_id:$RPM_NAME "$_"
+ sudo docker cp $docker_id:$SRPM_NAME "$_"
+else
+ echo "Unknown Jenkins silo: $SILO"
+ exit 1
+fi