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: 30968
Change-Id: I57c09bb50138bf829f39d4034bbc78356e34f3a6
This commit is contained in:
Arseni Lipinski 2019-05-13 10:53:41 +02:00
parent ea120a1bab
commit 4628c5f5ed
4 changed files with 12 additions and 12 deletions

View File

@ -1,5 +1,5 @@
ARG DOCKER_IMAGE=monasca/agent-collector ARG DOCKER_IMAGE=monasca/agent-collector
ARG APP_REPO=https://git.openstack.org/openstack/monasca-agent ARG APP_REPO=https://review.opendev.org/openstack/monasca-agent
# 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")/../collector/"
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,7 +93,7 @@ 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
@ -143,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" \

View File

@ -1,5 +1,5 @@
ARG DOCKER_IMAGE=monasca/agent-forwarder ARG DOCKER_IMAGE=monasca/agent-forwarder
ARG APP_REPO=https://git.openstack.org/openstack/monasca-agent ARG APP_REPO=https://review.opendev.org/openstack/monasca-agent
# 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")/../forwarder/"
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,7 +93,7 @@ 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
@ -143,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" \