summaryrefslogtreecommitdiffstats
path: root/build
diff options
context:
space:
mode:
authorBartek Grzybowski <b.grzybowski@partner.samsung.com>2020-10-21 13:58:05 +0200
committerBartek Grzybowski <b.grzybowski@partner.samsung.com>2020-10-26 10:21:23 +0000
commit8583bf98b526c23d487f0159401a65400fb044fa (patch)
tree48dbc175e5951fe39ff11e1d55a3eeda1eb389bf /build
parentb09b6ba6ba216111f41f72f4fb18e7ebb4bfe261 (diff)
Support setting custom Nexus container name
Change-Id: I41098413b96ac08fe479167aa0f5d0c4a699ef33 Issue-ID: OOM-2605 Signed-off-by: Bartek Grzybowski <b.grzybowski@partner.samsung.com>
Diffstat (limited to 'build')
-rwxr-xr-xbuild/build_nexus_blob.sh26
1 files changed, 21 insertions, 5 deletions
diff --git a/build/build_nexus_blob.sh b/build/build_nexus_blob.sh
index 688410ef..b41d6cab 100755
--- a/build/build_nexus_blob.sh
+++ b/build/build_nexus_blob.sh
@@ -2,7 +2,7 @@
# COPYRIGHT NOTICE STARTS HERE
#
-# Copyright 2018-2019 © Samsung Electronics Co., Ltd.
+# Copyright 2018-2020© Samsung Electronics Co., Ltd.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -35,13 +35,10 @@ SCRIPT_LOG="/tmp/$(basename $0)_$(eval ${TIMESTAMP}).log"
# Log everything
exec &> >(tee -a "${SCRIPT_LOG}")
-# Nexus repository location
+# Nexus repository properties
NEXUS_DOMAIN="nexus"
NEXUS_PORT="8081"
NEXUS_DOCKER_PORT="8082"
-NPM_REGISTRY="http://${NEXUS_DOMAIN}:${NEXUS_PORT}/repository/npm-private/"
-PYPI_REGISTRY="http://${NEXUS_DOMAIN}:${NEXUS_PORT}/repository/pypi-private/"
-DOCKER_REGISTRY="${NEXUS_DOMAIN}:${NEXUS_DOCKER_PORT}"
DEFAULT_REGISTRY="docker.io"
# Nexus repository credentials
@@ -97,6 +94,7 @@ usage () {
-o | --output-directory use specific directory for the target blob
-p | --pypi use specific list of pypi packages to be pushed into Nexus
-rl | --resource-list-directory use specific directory with docker, pypi and npm lists
+ -c | --container-name use specific Nexus docker container name
"
exit 1
}
@@ -209,6 +207,15 @@ push_docker () {
done
}
+validate_container_name () {
+ # Verify $1 is a valid hostname
+ if ! echo "${1}" | egrep -q "^(([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\-]*[a-zA-Z0-9])\.)*([A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9\-]*[A-Za-z0-9])$";
+ then
+ echo "ERROR: ${1} is not a valid name!"
+ exit 1;
+ fi
+}
+
while [ "${1}" != "" ]; do
case ${1} in
-d | --docker ) shift
@@ -224,6 +231,10 @@ while [ "${1}" != "" ]; do
shift
NXS_NPM_LISTS+=("$(realpath ${1})")
;;
+ -c | --container-name ) shift
+ validate_container_name "${1}"
+ NEXUS_DOMAIN="${1}"
+ ;;
-o | --output-directory ) shift
NEXUS_DATA_DIR="$(realpath ${1})"
;;
@@ -256,6 +267,11 @@ if [ ${#FAILED_COMMANDS[*]} -gt 0 ]; then
exit 1
fi
+# Nexus repository locations
+NPM_REGISTRY="http://${NEXUS_DOMAIN}:${NEXUS_PORT}/repository/npm-private/"
+PYPI_REGISTRY="http://${NEXUS_DOMAIN}:${NEXUS_PORT}/repository/pypi-private/"
+DOCKER_REGISTRY="${NEXUS_DOMAIN}:${NEXUS_DOCKER_PORT}"
+
# Setup directories with resources for docker, npm and pypi
NXS_SRC_DOCKER_IMG_DIR="${DATA_DIR}/offline_data/docker_images_for_nexus"
NXS_SRC_NPM_DIR="${DATA_DIR}/offline_data/npm_tar"