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)
+if [ "$DISTRO" == "epel-7" ]; then
+ 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 exec $docker_id /usr/bin/yum -y install sudo rpmdevtools rpmbuild git python-virtualenv python
+elif [ "$DISTRO" == "opensuse-42" ]; then
+ docker_id=$(sudo docker run --env-file env-file --name build_rpm_suse -di --privileged -v /sys/fs/cgroup:/sys/fs/cgroup:ro opensuse /usr/lib/systemd/systemd)
+ sudo docker exec $docker_id /usr/bin/zypper -n install sudo rpmdevtools rpmbuild git python-virtualenv python
+fi
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 git -C /builder fetch https://git.opendaylight.org/gerrit/releng/builder refs/changes/01/68201/38
+sudo docker exec $docker_id git -C /builder checkout FETCH_HEAD
+
sudo docker exec $docker_id /bin/bash $scripts_path/build-rpm-snap.sh
# 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 "$_"
+ cp "$HOME/rpmbuild/RPMS/noarch/"*.rpm "$_"
+ cp "$HOME/rpmbuild/SRPMS/"*.rpm "$_"
else
echo "Unknown Jenkins silo: $SILO"
exit 1
# -o pipefail: Fail on errors in scripts this calls, give stacktrace
set -ex -o pipefail
-# 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
- # 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
- # shellcheck disable=SC2154
- repo_file="${URL##*/}"
- sudo curl --silent -o /etc/yum.repos.d/"$repo_file" "$URL"
- sudo yum install -y opendaylight
+if [ -f /usr/bin/yum ]; then
+ # Update mirror list to avoid slow/hung one
+ sudo yum update -y yum-plugin-fastestmirror
+
+ # 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
+ # shellcheck disable=SC2154
+ repo_file="${URL##*/}"
+ sudo curl --silent -o /etc/yum.repos.d/"$repo_file" "$URL"
+ sudo yum install -y opendaylight
+ else
+ echo "URL is not a link to .rpm or .repo"
+ exit 1
+ fi
+elif [ -f /usr/bin/zypper ]; 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 /root -wholename $URL)
+ sudo zypper -n --no-gpg-checks install "$path"
+ elif [[ $URL == *.rpm ]]; then
+ sudo zypper -n --no-gpg-checks install "$URL"
+ elif [[ $URL == *.repo ]]; then
+ # shellcheck disable=SC2154
+ repo_file="${URL##*/}"
+ sudo curl --silent -o /etc/zypp/repos.d/"$repo_file" "$URL"
+ sudo zypper -n --no-gpg-checks install opendaylight
+ else
+ echo "URL is not a link to .rpm or .repo"
+ exit 1
+ fi
else
- echo "URL is not a link to .rpm or .repo"
+ echo "The package manager is not supported (not yum or zypper)"
exit 1
fi
- shell: !include-raw: uninstall-rpm.sh
- shell: |
# Remove old host key so future installs don't fail to SSH
- rm /home/jenkins/.ssh/known_hosts
+ rm /home/jenkins/.ssh/known_hosts || echo "No known_hosts file"
jobs:
- 'packaging-build-rpm-{stream}'
- - 'packaging-build-rpm-snap-{stream}'
+ - 'packaging-build-rpm-{distro}-snap-{stream}'
- 'packaging-build-deb-{stream}'
- 'packaging-verify-full-rpm-master'
- 'packaging-verify-rpm-master'
- carbon
- nitrogen
- oxygen
+ distro:
+ - opensuse-42
+ - epel-7
branch: 'master'
# common parameters required for 'lf-infra-deploy-maven-file' builder
- job-template:
- name: 'packaging-build-rpm-snap-{stream}'
+ name: 'packaging-build-rpm-{distro}-snap-{stream}'
node: centos7-docker-2c-8g
builders:
- inject:
- properties-content: 'STREAM={stream}'
+ properties-content: |
+ STREAM={stream}
+ DISTRO={distro}
- 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'
mvn-version: '{mvn-version}'
- repo-id: 'opendaylight-{stream}-epel-7-x86_64-devel'
+ repo-id: 'opendaylight-{stream}-{distro}-x86_64-devel'
group-id: '{group-id}'
upload-files-dir: '{upload-files-dir}'
maven-repo-url: '{maven-repo-url}'
exit 1
fi
-# Requirements for package where SRPM was built into noarch on CentOS CBS
-# rpm -qp opendaylight-8.0.0-0.1.20171125rel2049.el7.noarch.rpm --requires
-# shellcheck disable=SC2034
-declare -a expected_deps=( "/bin/bash"
- "/bin/sh"
- "java >= 1:1.8.0"
- "rpmlib(CompressedFileNames) <= 3.0.4-1"
- "rpmlib(FileDigests) <= 4.6.0-1"
- "rpmlib(PartialHardlinkSets) <= 4.0.4-1"
- "rpmlib(PayloadFilesHavePrefix) <= 4.0-1"
- "shadow-utils"
- "rpmlib(PayloadIsXz) <= 5.2-1" )
+
+if [ -f /usr/bin/yum ]; then
+ # Requirements for package where SRPM was built into noarch on CentOS CBS
+ # rpm -qp opendaylight-8.0.0-0.1.20171125rel2049.el7.noarch.rpm --requires
+ # shellcheck disable=SC2034
+ declare -a expected_deps=( "/bin/bash"
+ "/bin/sh"
+ "java >= 1:1.8.0"
+ "rpmlib(CompressedFileNames) <= 3.0.4-1"
+ "rpmlib(FileDigests) <= 4.6.0-1"
+ "rpmlib(PartialHardlinkSets) <= 4.0.4-1"
+ "rpmlib(PayloadFilesHavePrefix) <= 4.0-1"
+ "shadow-utils"
+ "rpmlib(PayloadIsXz) <= 5.2-1" )
+
+elif [ -f /usr/bin/zypper ]; then
+ declare -a expected_deps=( "/bin/bash"
+ "/bin/sh"
+ "java >= 1.8.0"
+ "rpmlib(CompressedFileNames) <= 3.0.4-1"
+ "rpmlib(PayloadFilesHavePrefix) <= 4.0-1"
+ "shadow"
+ "rpmlib(PayloadIsLzma) <= 4.4.6-1" )
+
+fi
# Karaf 4 distros also have a /usr/bin/env requirement INTPAK-120
if [[ ! $path == *opendaylight-6* ]]; then
# shellcheck disable=SC2154,SC2145,SC2034,SC2207
diff_deps=(`echo "${expected_deps[@]}" "${actual_deps[@]}" | tr ' ' '\n' | sort | uniq -u`)
+
# shellcheck disable=SC2154 disable=SC2145 disable=SC2068 disable=SC2170 disable=SC1083
if [ ${#diff_deps[*]} -eq 0 ]; then
echo "RPM requirements are as expected"
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
+if [ "$DISTRO" == "epel-7" ]; then
+ docker_id=$(sudo docker ps -qf name=build_rpm_epel)
+ sudo docker exec $docker_id /usr/bin/yum -y install curl expect nmap openssh
+elif [ "$DISTRO" == "opensuse-42" ]; then
+ docker_id=$(sudo docker ps -qf name=build_rpm_suse)
+ sudo docker exec $docker_id /usr/bin/zypper -n install curl expect nmap openssh
+fi
sudo docker exec $docker_id /bin/bash $scripts_path/test-rpm-deps.sh
# -o pipefail: Fail on errors in scripts this calls, give stacktrace
set -ex -o pipefail
-# Uninstall ODL
-sudo yum remove -y opendaylight
+if [ -f /usr/bin/yum ]; then
+ # Uninstall ODL
+ sudo yum remove -y opendaylight
-# Verify ODL not installed
-if yum list installed opendaylight; then
- # Fail if exit code 0, ie ODL is still installed
- echo "OpenDaylight unexpectedly still installed"
- exit 1
+ # Verify ODL not installed
+ if yum list installed opendaylight; then
+ # Fail if exit code 0, ie ODL is still installed
+ echo "OpenDaylight unexpectedly still installed"
+ exit 1
+ else
+ echo "OpenDaylight not installed, as expected"
+ fi
+elif [ -f /usr/bin/zypper ]; then
+ # Uninstall ODL
+ sudo zypper -n remove opendaylight
+
+ # Verify ODL not installed
+ if zypper search --installed-only opendaylight; then
+ # Fail if exit code 0, ie ODL is still installed
+ echo "OpenDaylight unexpectedly still installed"
+ exit 1
+ else
+ echo "OpenDaylight not installed, as expected"
+ fi
else
- echo "OpenDaylight not installed, as expected"
+ echo "The package manager is not supported (not yum or zypper)"
+ exit 1
fi