Add PyPI templates for RMR python binding 29/1029/8
authorLott, Christopher (cl778h) <cl778h@att.com>
Fri, 27 Sep 2019 10:01:54 +0000 (06:01 -0400)
committerLott, Christopher (cl778h) <cl778h@att.com>
Mon, 30 Sep 2019 22:20:42 +0000 (18:20 -0400)
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) <cl778h@att.com>
Change-Id: Ie4b20163260179bff58ad958a7e8b87bbb9c02d2

jjb/ric-plt-lib-rmr/ric-plt-lib-rmr.yaml
jjb/shell/install-deb-nng-rmr.sh
jjb/shell/install-rpm-nng-rmr.sh

index 951211c..934823f 100644 (file)
     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
       - 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'
index 17b237c..c242a23 100644 (file)
 # 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"
index 146df4d..af7d05a 100644 (file)
@@ -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"