Add CI for building dep package 66/1366/2
authorwrider <lji@research.att.com>
Tue, 5 Nov 2019 17:13:28 +0000 (12:13 -0500)
committerLusheng Ji <lji@research.att.com>
Wed, 6 Nov 2019 00:21:02 +0000 (00:21 +0000)
Change-Id: I7f084eae0d3209677503a1afcc77bd04118bed1e
Signed-off-by: wrider <lji@research.att.com>
bin/package-ric-deployment-tools
ci/Dockerfile-package [new file with mode: 0644]
ci/package-tag.yaml [new file with mode: 0644]
ci/publish.sh [new file with mode: 0755]

index d932fb9..30c69bb 100755 (executable)
@@ -112,5 +112,8 @@ EOF
 cd $DIR
 dpkg-buildpackage -us -uc
 
+EXPORT_PATH="${EXPORT_PATH:-/tmp/exported}"
+mkdir -p "${EXPORT_PATH}"
+cp /tmp/ric-deployment-tools_${VERSION}_all.deb "${EXPORT_PATH}"
 
-echo "RIC it/dep repo has been packaged as /tmp/ric-deployment-tools_${VERSION}_all.deb."
+echo "RIC it/dep repo has been packaged as /tmp/ric-deployment-tools_${VERSION}_all.deb."
\ No newline at end of file
diff --git a/ci/Dockerfile-package b/ci/Dockerfile-package
new file mode 100644 (file)
index 0000000..afb8a74
--- /dev/null
@@ -0,0 +1,34 @@
+################################################################################
+#   Copyright (c) 2019 AT&T Intellectual Property.                             #
+#                                                                              #
+#   Licensed under the Apache License, Version 2.0 (the "License");            #
+#   you may not use this file except in compliance with the License.           #
+#   You may obtain a copy of the License at                                    #
+#                                                                              #
+#       http://www.apache.org/licenses/LICENSE-2.0                             #
+#                                                                              #
+#   Unless required by applicable law or agreed to in writing, software        #
+#   distributed under the License is distributed on an "AS IS" BASIS,          #
+#   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.   #
+#   See the License for the specific language governing permissions and        #
+#   limitations under the License.                                             #
+################################################################################
+
+FROM buildpack-deps:stretch
+RUN apt-get update && apt-get -q -y install debhelper dpkg-dev build-essential rsync
+RUN mkdir /tmp/it-dep
+COPY . /tmp/it-dep
+WORKDIR /tmp/it-dep
+
+# building RIC deployment artifacts into a package
+RUN ./bin/package-ric-deployment-tools $(grep tag ./ci/package-tag.yaml | cut -f2 -d':')
+
+# Executing the container "as a binary" will cause the CI publish
+# script to execute.  This will take the simple package list generated
+# by the ci_build script and copy the list of packages to the target
+# directory.  The target directory is /export by default, but can be
+# overridden from the docker run command line. In either case, the
+# assumption is that the target directory is mounted as a volume.
+#
+ENTRYPOINT [ "ci/publish.sh" ]
+
diff --git a/ci/package-tag.yaml b/ci/package-tag.yaml
new file mode 100644 (file)
index 0000000..b795d3b
--- /dev/null
@@ -0,0 +1,17 @@
+---
+################################################################################
+#   Copyright (c) 2019 AT&T Intellectual Property.                             #
+#                                                                              #
+#   Licensed under the Apache License, Version 2.0 (the "License");            #
+#   you may not use this file except in compliance with the License.           #
+#   You may obtain a copy of the License at                                    #
+#                                                                              #
+#       http://www.apache.org/licenses/LICENSE-2.0                             #
+#                                                                              #
+#   Unless required by applicable law or agreed to in writing, software        #
+#   distributed under the License is distributed on an "AS IS" BASIS,          #
+#   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.   #
+#   See the License for the specific language governing permissions and        #
+#   limitations under the License.                                             #
+################################################################################
+tag: 2.0.0
diff --git a/ci/publish.sh b/ci/publish.sh
new file mode 100755 (executable)
index 0000000..c68f457
--- /dev/null
@@ -0,0 +1,68 @@
+#!/usr/bin/env bash
+
+# -----------------------------------------------------------------------------
+#
+# Copyright (C) 2019 AT&T Intellectual Property and Nokia
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+# -----------------------------------------------------------------------------
+
+#      Mnemonic:       publish
+#      Abstract:       Simple script which copies files that the build script left
+#                              for export (packages, but could be anything). This expects
+#                              that all files in /tmp/exportd are to be copied to the 
+#                              export directory /export The export directory is assumed to be
+#                              mounted from the outside world as /export, though we will use $1
+#                              as an override so this can be changed if needed.
+#
+#      Date:           30 July 2019
+#
+# -----------------------------------------------------------------------------
+
+# This file is copied from  ric-plt/lib/rmr ci/publish.sh.
+#
+
+echo "$0 starting" >&2
+argv0=${0##*/}
+
+target=${1:-/export}
+exportd=/tmp/exported          # build script dumps here
+
+if ! cd $target
+then
+       echo "$argv0: abort: cannot find or switch to: $target" >&2
+       exit 1
+fi
+
+if [[ ! -w ./ ]]
+then
+       echo "$argv0: abort: cannot write to target directory: $target"
+       exit 1
+fi
+
+if [[ ! -d $exportd ]]
+then
+       echo "$argv0: abort: unable to find the exported directory: $exportd" >&2
+       exit 1
+fi
+
+errors=0
+echo "$argv0: copy: $exportd/* --> $target" >&2
+if ! cp -v $exportd/* $target/
+then
+       errors=1
+fi
+
+echo "$argv0: finshed, $errors errors"
+exit $errors