Change repository links usage in Dockerfile and build image

Used to be: git.openstack.org/openstack/monasca-persister?h=stable/pike
Now : opendev.org/openstack/monasca-persister/src/branch/stable/pike

Since the way links to specific branches changed, usage of
those links has to be changed as well.
CONSTRAINTS_BRANCH variable was removed because CONSTRAINTS_FILE
contains link to the upper-requirements file with specified branch.

Story: 2005666
Task: 30970
Change-Id: I704cd025d6ccf7e9769a276d6094c4e2f3fb69ef
This commit is contained in:
Arseni Lipinski 2019-05-13 11:10:53 +02:00 committed by Dobroslaw Zybort
parent 36bf8595c4
commit f708d32bf1
2 changed files with 6 additions and 7 deletions

View File

@ -1,5 +1,5 @@
ARG DOCKER_IMAGE=monasca/notification ARG DOCKER_IMAGE=monasca/notification
ARG APP_REPO=https://git.openstack.org/openstack/monasca-notification ARG APP_REPO=https://review.opendev.org/openstack/monasca-notification
# Branch, tag or git hash to build from. # Branch, tag or git hash to build from.
ARG REPO_VERSION=master ARG REPO_VERSION=master

View File

@ -59,12 +59,12 @@ cd "$(dirname "$REAL_PATH")/../docker/"
REPO_VERSION_CLEAN=$(echo "$REPO_VERSION" | sed 's|/|-|g') REPO_VERSION_CLEAN=$(echo "$REPO_VERSION" | sed 's|/|-|g')
[ -z "$APP_REPO" ] && APP_REPO=$(\grep APP_REPO Dockerfile | cut -f2 -d"=") [ -z "$APP_REPO" ] && APP_REPO=$(\grep APP_REPO Dockerfile | cut -f2 -d"=")
GITHUB_REPO=$(echo "$APP_REPO" | sed 's/git.openstack.org/github.com/' | \ GITHUB_REPO=$(echo "$APP_REPO" | sed 's/review.opendev.org/github.com/' | \
sed 's/ssh:/https:/') sed 's/ssh:/https:/')
if [ -z "$CONSTRAINTS_FILE" ]; then if [ -z "$CONSTRAINTS_FILE" ]; then
CONSTRAINTS_FILE=$(\grep CONSTRAINTS_FILE Dockerfile | cut -f2 -d"=") || true CONSTRAINTS_FILE=$(\grep CONSTRAINTS_FILE Dockerfile | cut -f2 -d"=") || true
: "${CONSTRAINTS_FILE:=http://git.openstack.org/cgit/openstack/requirements/plain/upper-constraints.txt}" : "${CONSTRAINTS_FILE:=https://opendev.org/openstack/requirements/raw/branch/master/upper-constraints.txt}"
fi fi
: "${CONSTRAINTS_BRANCH:=$2}" : "${CONSTRAINTS_BRANCH:=$2}"
@ -75,10 +75,11 @@ fi
case "$REPO_VERSION" in case "$REPO_VERSION" in
*stable*) *stable*)
CONSTRAINTS_BRANCH_CLEAN="$REPO_VERSION" CONSTRAINTS_BRANCH_CLEAN="$REPO_VERSION"
CONSTRAINTS_FILE=${CONSTRAINTS_FILE/master/$CONSTRAINTS_BRANCH_CLEAN}
# Get monasca-common version from stable upper constraints file. # Get monasca-common version from stable upper constraints file.
CONSTRAINTS_TMP_FILE=$(mktemp) CONSTRAINTS_TMP_FILE=$(mktemp)
wget --output-document "$CONSTRAINTS_TMP_FILE" \ wget --output-document "$CONSTRAINTS_TMP_FILE" \
"$CONSTRAINTS_FILE"?h="$CONSTRAINTS_BRANCH_CLEAN" $CONSTRAINTS_FILE
UPPER_COMMON=$(\grep 'monasca-common' "$CONSTRAINTS_TMP_FILE") UPPER_COMMON=$(\grep 'monasca-common' "$CONSTRAINTS_TMP_FILE")
# Get only version part from monasca-common. # Get only version part from monasca-common.
UPPER_COMMON_VERSION="${UPPER_COMMON##*===}" UPPER_COMMON_VERSION="${UPPER_COMMON##*===}"
@ -92,9 +93,8 @@ esac
# Monasca-common variables. # Monasca-common variables.
if [ -z "$COMMON_REPO" ]; then if [ -z "$COMMON_REPO" ]; then
COMMON_REPO=$(\grep COMMON_REPO Dockerfile | cut -f2 -d"=") || true COMMON_REPO=$(\grep COMMON_REPO Dockerfile | cut -f2 -d"=") || true
: "${COMMON_REPO:=https://git.openstack.org/openstack/monasca-common}" : "${COMMON_REPO:=https://review.opendev.org/openstack/monasca-common}"
fi fi
: "${COMMON_VERSION:=$3}" : "${COMMON_VERSION:=$3}"
if [ -z "$COMMON_VERSION" ]; then if [ -z "$COMMON_VERSION" ]; then
COMMON_VERSION=$(\grep COMMON_VERSION Dockerfile | cut -f2 -d"=") || true COMMON_VERSION=$(\grep COMMON_VERSION Dockerfile | cut -f2 -d"=") || true
@ -144,7 +144,6 @@ docker build --no-cache \
--build-arg REPO_VERSION="$REPO_VERSION" \ --build-arg REPO_VERSION="$REPO_VERSION" \
--build-arg GIT_COMMIT="$GIT_COMMIT" \ --build-arg GIT_COMMIT="$GIT_COMMIT" \
--build-arg CONSTRAINTS_FILE="$CONSTRAINTS_FILE" \ --build-arg CONSTRAINTS_FILE="$CONSTRAINTS_FILE" \
--build-arg CONSTRAINTS_BRANCH="$CONSTRAINTS_BRANCH_CLEAN" \
--build-arg COMMON_REPO="$COMMON_REPO" \ --build-arg COMMON_REPO="$COMMON_REPO" \
--build-arg COMMON_VERSION="$COMMON_VERSION" \ --build-arg COMMON_VERSION="$COMMON_VERSION" \
--build-arg COMMON_GIT_COMMIT="$COMMON_GIT_COMMIT" \ --build-arg COMMON_GIT_COMMIT="$COMMON_GIT_COMMIT" \