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: 31056 Depends-On: https://review.opendev.org/659073 Change-Id: Iea51da2f0d3c19ffd5b3204d495d01e4c9b31750
This commit is contained in:
		
				
					committed by
					
						
						Dobroslaw Zybort
					
				
			
			
				
	
			
			
			
						parent
						
							eb7083de7b
						
					
				
				
					commit
					d02db953dc
				
			@@ -1,5 +1,5 @@
 | 
				
			|||||||
ARG DOCKER_IMAGE=monasca/client
 | 
					ARG DOCKER_IMAGE=monasca/client
 | 
				
			||||||
ARG APP_REPO=https://git.openstack.org/openstack/python-monascaclient
 | 
					ARG APP_REPO=https://review.opendev.org/openstack/python-monascaclient
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Branch, tag or git hash to build from.
 | 
					# Branch, tag or git hash to build from.
 | 
				
			||||||
ARG REPO_VERSION=master
 | 
					ARG REPO_VERSION=master
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -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,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" \
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user