Merge "Allow creation of Dockerfile.aarch64 through patch"
authorFatih Degirmenci <fatih.degirmenci@ericsson.com>
Wed, 15 Mar 2017 09:30:26 +0000 (09:30 +0000)
committerGerrit Code Review <gerrit@opnfv.org>
Wed, 15 Mar 2017 09:30:26 +0000 (09:30 +0000)
1  2 
jjb/releng/opnfv-docker.sh

@@@ -53,9 -53,19 +53,19 @@@ if [[ -n "$(docker images | grep $DOCKE
  fi
  
  cd $WORKSPACE/docker
- if [ ! -f ${DOCKERFILE} ]; then
-     echo "ERROR: Dockerfile not found."
-     exit 1
+ HOST_ARCH=$(uname -m)
+ if [ ! -f "${DOCKERFILE}" ]; then
+     # If this is expected to be a Dockerfile for other arch than x86
+     # and it does not exist, but there is a patch for the said arch,
+     # then apply the patch and create the Dockerfile.${HOST_ARCH} file
+     if [[ "${DOCKERFILE}" == *"${HOST_ARCH}" && \
+           -f "Dockerfile.${HOST_ARCH}.patch" ]]; then
+         patch -o Dockerfile."${HOST_ARCH}" Dockerfile \
+         Dockerfile."${HOST_ARCH}".patch
+     else
+         echo "ERROR: No Dockerfile or ${HOST_ARCH} patch found."
+         exit 1
+     fi
  fi
  
  # Get tag version
@@@ -64,7 -74,7 +74,7 @@@ echo "Current branch: $BRANCH
  if [[ "$BRANCH" == "master" ]]; then
      DOCKER_TAG="latest"
  else
 -    if [[ "$RELEASE_VERSION" != "" ]]; then
 +    if [[ -n "${RELEASE_VERSION-}" ]]; then
          release=${BRANCH##*/}
          DOCKER_TAG=${release}.${RELEASE_VERSION}
          # e.g. colorado.1.0, colorado.2.0, colorado.3.0