From 557b88a5631820d0b09d20d993778d802cc5005b Mon Sep 17 00:00:00 2001 From: "Lott, Christopher (cl778h)" Date: Fri, 27 Sep 2019 06:01:54 -0400 Subject: [PATCH] Add PyPI templates for RMR python binding Add triggers to limit library, binding builds appropriately. Clone NNG using a git commit SHA code, a version that fixes a bug. Extend pre-build scripts to get RMR version string from repo file. Signed-off-by: Lott, Christopher (cl778h) Change-Id: Ie4b20163260179bff58ad958a7e8b87bbb9c02d2 --- jjb/ric-plt-lib-rmr/ric-plt-lib-rmr.yaml | 45 ++++++++++++++++++-------------- jjb/shell/install-deb-nng-rmr.sh | 43 +++++++++++++++++++++++------- jjb/shell/install-rpm-nng-rmr.sh | 40 +++++++++++++++++++++++----- 3 files changed, 92 insertions(+), 36 deletions(-) diff --git a/jjb/ric-plt-lib-rmr/ric-plt-lib-rmr.yaml b/jjb/ric-plt-lib-rmr/ric-plt-lib-rmr.yaml index 951211c3..934823fb 100644 --- a/jjb/ric-plt-lib-rmr/ric-plt-lib-rmr.yaml +++ b/jjb/ric-plt-lib-rmr/ric-plt-lib-rmr.yaml @@ -13,25 +13,29 @@ jobs: - gerrit-info-yaml-verify -- rmr_docker_common: &rmr_docker_common - # values apply to all RMR docker projects - name: rmr-docker-common +- rmr_common: &rmr_common + name: rmr-common # git repo project: ric-plt/lib/rmr # jenkins job name prefix project-name: ric-plt-lib-rmr - # maven settings file has docker credentials + # maven settings file has credentials mvn-settings: ric-plt-lib-rmr-settings +# build and publish packages to PackageCloud.io - project: - <<: *rmr_docker_common + <<: *rmr_common name: ric-plt-lib-rmr + # image is not pushed, use trivial tag + container-tag-method: latest # image name docker-name: '{name}' - # use host network to use network resources + # use host network for network resources docker-build-args: '--network=host -f ci/Dockerfile' - # image tag; use a fixed value - container-tag-method: latest + # exclude changes in the bindings subdirectory + gerrit_trigger_file_paths: + - compare-type: REG_EXP + pattern: '^((?!src/bindings|\/COMMIT_MSG).)*$' jobs: - gerrit-docker-verify - oran-gerrit-docker-ci-pc-merge @@ -39,21 +43,22 @@ - master: branch: master -# runs tox tests on verify only +# build and publish distributions to PyPI - project: - <<: *rmr_docker_common - name: ric-plt-lib-rmr-python-test + <<: *rmr_common + name: ric-plt-lib-rmr-python project-name: '{name}' - # image name, but is never pushed - docker-name: '{name}' - # source of docker tag - container-tag-method: latest - # subdirectory - docker-root: src/bindings/rmr-python - # use host network to use network resources - docker-build-args: '--network=host -f Dockerfile-Unit-Test' + # sigul requires centos + build-node: centos7-builder-1c-1g + # install prereqs + pre-build-script: !include-raw-escape: ../shell/install-rpm-nng-rmr.sh + # bindings live in a subdirectory + gerrit_trigger_file_paths: + - compare-type: REG_EXP + pattern: 'src/bindings/rmr-python/.*' + tox-dir: src/bindings/rmr-python stream: - master: branch: master jobs: - - gerrit-docker-verify + - '{project-name}-gerrit-pypi-jobs' diff --git a/jjb/shell/install-deb-nng-rmr.sh b/jjb/shell/install-deb-nng-rmr.sh index 17b237c2..c242a23f 100644 --- a/jjb/shell/install-deb-nng-rmr.sh +++ b/jjb/shell/install-deb-nng-rmr.sh @@ -16,29 +16,54 @@ # See the License for the specific language governing permissions and # limitations under the License. -# Installs NNG from source and RMR from PackageCloud on Ubuntu +# Installs NNG from source and RMR from PackageCloud on Ubuntu18.04 +# Reads RMR version number from repo file rmr-version.yaml echo "---> install-deb-nng-rmr.sh" set -eu echo "Install packages" -sudo apt-get update -sudo apt-get install -y \ +sudo apt-get update && \ + sudo apt-get install -y \ cmake \ ninja-build +echo "INFO: cd to tox-dir $TOX_DIR" +cd "$WORKSPACE/$TOX_DIR" + +version_file=rmr-version.yaml +if [[ -f $version_file ]]; then + # pipeline is less elegant than yq but that requires venv and pip install + ver=$(grep "^version:" "$version_file" | cut -d: -f2 | xargs ) +else + echo "File $version_file not found." + exit 1 +fi +if [[ -z $ver ]]; then + echo "Failed to get RMR version string from file $version_file" + exit 1 +else + echo "RMR version string is ${ver}" +fi + +# NNG repo is not frequently tagged so it's pinned to a commit hash. +# This commit provides fix to the proxy-reconnect +# bug that we identified: https://github.com/nanomsg/nng/issues/970 echo "Clone and build NNG" -git clone --branch v1.1.1 https://github.com/nanomsg/nng.git +git clone https://github.com/nanomsg/nng.git (cd nng \ + && git checkout e618abf8f3db2a94269a79c8901a51148d48fcc2 \ && mkdir build \ && cd build \ && cmake -DBUILD_SHARED_LIBS=1 -G Ninja .. \ && ninja \ && sudo ninja install) -ver="1.4.0" -echo "Download RMR library ${ver}" -wget --content-disposition https://packagecloud.io/o-ran-sc/staging/packages/debian/stretch/rmr_${ver}_amd64.deb/download.deb -echo "Install RMR library ${ver}" -sudo dpkg -i rmr_${ver}_amd64.deb +deb="rmr_${ver}_amd64.deb" +echo "Download RMR library ${ver} as file ${deb}" +wget --content-disposition https://packagecloud.io/o-ran-sc/staging/packages/debian/stretch/${deb}/download.deb +echo "Install RMR library file ${deb}" +sudo dpkg -i ${deb} + +echo "---> install-deb-nng-rmr.sh ends" diff --git a/jjb/shell/install-rpm-nng-rmr.sh b/jjb/shell/install-rpm-nng-rmr.sh index 146df4d7..af7d05a0 100644 --- a/jjb/shell/install-rpm-nng-rmr.sh +++ b/jjb/shell/install-rpm-nng-rmr.sh @@ -16,7 +16,8 @@ # See the License for the specific language governing permissions and # limitations under the License. -# Installs NNG from source and RMR from PackageCloud on CentOS +# Installs NNG from source and RMR from PackageCloud on CentOS7 +# Reads RMR version number from repo file rmr-version.yaml echo "---> install-rpm-nng-rmr.sh" @@ -27,17 +28,42 @@ sudo yum install -y \ cmake3 \ ninja-build +echo "INFO: cd to tox-dir $TOX_DIR" +cd "$WORKSPACE/$TOX_DIR" + +version_file=rmr-version.yaml +if [[ -f $version_file ]]; then + # pipeline is less elegant than yq but that requires venv and pip install + ver=$(grep "^version:" "$version_file" | cut -d: -f2 | xargs ) +else + echo "File $version_file not found." + exit 1 +fi +if [[ -z $ver ]]; then + echo "Failed to get RMR version string from file $version_file" + exit 1 +else + echo "RMR version string is ${ver}" +fi + +# NNG repo is not frequently tagged so it's pinned to a commit hash. +# This commit provides fix to the proxy-reconnect +# bug that we identified: https://github.com/nanomsg/nng/issues/970 echo "Clone and build NNG" -git clone --branch v1.1.1 https://github.com/nanomsg/nng.git +git clone https://github.com/nanomsg/nng.git (cd nng \ + && git checkout e618abf8f3db2a94269a79c8901a51148d48fcc2 \ && mkdir build \ && cd build \ && cmake3 -DBUILD_SHARED_LIBS=1 -G Ninja .. \ && ninja-build \ && sudo ninja-build install) -ver="1.4.0-1" -echo "Download RMR library ${ver}" -wget --content-disposition https://packagecloud.io/o-ran-sc/staging/packages/el/5/rmr-${ver}.x86_64.rpm/download.rpm -echo "Install RMR library ${ver}" -sudo rpm -vi rmr-${ver}.x86_64.rpm +# RPM packager adds suffix "-1" to version +rpm="rmr-${ver}-1.x86_64.rpm" +echo "Download RMR library ${ver} as file ${rpm}" +wget --content-disposition https://packagecloud.io/o-ran-sc/staging/packages/el/5/${rpm}/download.rpm +echo "Install RMR library file ${rpm}" +sudo rpm -iv ${rpm} + +echo "---> install-rpm-nng-rmr.sh ends" -- 2.16.6