diff --git a/.travis.yml b/.travis.yml index b4323f079057669c1f4dc1027b558542c84b5385..656d85fc1977cf58fa1492507e8a502c39152b8a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -35,6 +35,8 @@ env: before_install: - echo $TRAVIS_COMMIT_RANGE - export HOST_WORKDIR=`pwd` + - export GITHUB_REPO=pmem/pmdk + - export DOCKERHUB_REPO=pmem/pmdk - cd utils/docker - ./pull-or-rebuild-image.sh - if [[ -f push_image_to_repo_flag ]]; then PUSH_THE_IMAGE=1; fi diff --git a/utils/check-commit.sh b/utils/check-commit.sh index dc270370075bb7cc42619f89b2878815d7e0ed5c..278687795c7ddde277e23817a7dcc4a03e0d6156 100755 --- a/utils/check-commit.sh +++ b/utils/check-commit.sh @@ -1,6 +1,6 @@ #!/usr/bin/env bash # -# Copyright 2016-2018, Intel Corporation +# Copyright 2016-2019, Intel Corporation # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions @@ -38,10 +38,10 @@ # usage: ./check-commit.sh # -if [[ $TRAVIS_REPO_SLUG != "pmem/pmdk" \ +if [[ $TRAVIS_REPO_SLUG != "$GITHUB_REPO" \ || $TRAVIS_EVENT_TYPE != "pull_request" ]]; then - echo "SKIP: $0 can only be executed for pull requests to pmem/pmdk" + echo "SKIP: $0 can only be executed for pull requests to $GITHUB_REPO" exit 0 fi diff --git a/utils/check-doc.sh b/utils/check-doc.sh index fe63774831558cde3ad7e8bd2061129596728d14..423654dd003dd9e1cc508e65c075e70c2471335a 100755 --- a/utils/check-doc.sh +++ b/utils/check-doc.sh @@ -1,6 +1,6 @@ #!/usr/bin/env bash # -# Copyright 2016-2017, Intel Corporation +# Copyright 2016-2019, Intel Corporation # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions @@ -46,10 +46,10 @@ if [[ -z "$TRAVIS" ]]; then exit 1 fi -if [[ $TRAVIS_REPO_SLUG != "pmem/pmdk" \ +if [[ $TRAVIS_REPO_SLUG != "$GITHUB_REPO" \ || $TRAVIS_EVENT_TYPE != "pull_request" ]]; then - echo "SKIP: $0 can only be executed for pull requests to pmem/pmdk" + echo "SKIP: $0 can only be executed for pull requests to ${GITHUB_REPO}" exit 0 fi diff --git a/utils/docker/build-local.sh b/utils/docker/build-local.sh index 9a4d1c49f247fc6c32b54c4a0a25b0220e95e32b..fd9ad12616c8aef8c859309f983592102634c7fe 100755 --- a/utils/docker/build-local.sh +++ b/utils/docker/build-local.sh @@ -62,7 +62,8 @@ export PMDK_CC=${PMDK_CC:-gcc} export PMDK_CXX=${PMDK_CXX:-g++} export EXPERIMENTAL=${EXPERIMENTAL:-n} export VALGRIND=${VALGRIND:-1} - +export DOCKERHUB_REPO=${DOCKERHUB_REPO:-pmem/pmdk} +export GITHUB_REPO=${GITHUB_REPO:-pmem/pmdk} if [[ -z "$OS" || -z "$OS_VER" ]]; then echo "ERROR: The variables OS and OS_VER have to be set " \ @@ -78,7 +79,7 @@ if [[ "$KEEP_CONTAINER" != "1" ]]; then RM_SETTING=" --rm" fi -imageName=pmem/pmdk:1.5-${OS}-${OS_VER} +imageName=${DOCKERHUB_REPO}:1.5-${OS}-${OS_VER} containerName=pmdk-${OS}-${OS_VER} if [[ $MAKE_PKG -eq 1 ]] ; then diff --git a/utils/docker/build-travis.sh b/utils/docker/build-travis.sh index 1ea5778a352ae149aaf56ee9d0026decfdd5c2cc..9c26c9605d6d582feceddeff09878117a5e51a83 100755 --- a/utils/docker/build-travis.sh +++ b/utils/docker/build-travis.sh @@ -69,7 +69,7 @@ if [[ -z "$TEST_BUILD" ]]; then TEST_BUILD=all fi -imageName=pmem/pmdk:1.5-${OS}-${OS_VER} +imageName=${DOCKERHUB_REPO}:1.5-${OS}-${OS_VER} containerName=pmdk-${OS}-${OS_VER} if [[ $MAKE_PKG -eq 0 ]] ; then command="./run-build.sh"; fi @@ -116,6 +116,7 @@ docker run --rm --privileged=true --name=$containerName -ti \ --env TRAVIS_EVENT_TYPE=$TRAVIS_EVENT_TYPE \ --env COVERITY_SCAN_TOKEN=$COVERITY_SCAN_TOKEN \ --env COVERITY_SCAN_NOTIFICATION_EMAIL=$COVERITY_SCAN_NOTIFICATION_EMAIL \ + --env GITHUB_REPO=$GITHUB_REPO \ $ndctl_enable \ -v $HOST_WORKDIR:$WORKDIR \ -v /etc/localtime:/etc/localtime \ diff --git a/utils/docker/images/build-image.sh b/utils/docker/images/build-image.sh index 418a902a1715c21b17b2849ff98459b076f4c77e..b8a0557bdf5566018d75a7e241f9dda1afe7b577 100755 --- a/utils/docker/images/build-image.sh +++ b/utils/docker/images/build-image.sh @@ -1,6 +1,6 @@ #!/usr/bin/env bash # -# Copyright 2016-2018, Intel Corporation +# Copyright 2016-2019, Intel Corporation # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions @@ -62,8 +62,13 @@ if [[ ! -f "Dockerfile.$1" ]]; then exit 1 fi -# Build a Docker image tagged with pmem/pmdk:OS-VER -tag=pmem/pmdk:1.5-$1 +if [[ -z "${DOCKERHUB_REPO}" ]]; then + echo "DOCKERHUB_REPO environment variable is not set" + exit 1 +fi + +# Build a Docker image tagged with ${DOCKERHUB_REPO}:OS-VER +tag=${DOCKERHUB_REPO}:1.5-$1 docker build -t $tag \ --build-arg http_proxy=$http_proxy \ --build-arg https_proxy=$https_proxy \ diff --git a/utils/docker/images/push-image.sh b/utils/docker/images/push-image.sh index a0c88147d215baf9cca6fe798b39c2fef15f2ede..af75af60c9c5e910387dba2f79a548960c1b3009 100755 --- a/utils/docker/images/push-image.sh +++ b/utils/docker/images/push-image.sh @@ -1,6 +1,6 @@ #!/usr/bin/env bash # -# Copyright 2016-2018, Intel Corporation +# Copyright 2016-2019, Intel Corporation # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions @@ -45,7 +45,7 @@ function usage { echo "Usage:" echo " push-image.sh <OS-VER>" echo "where <OS-VER>, for example, can be 'ubuntu-16.04', provided " \ - "a Docker image tagged with pmem/pmdk:ubuntu-16.04 exists " \ + "a Docker image tagged with ${DOCKERHUB_REPO}:ubuntu-16.04 exists " \ "locally." } @@ -55,8 +55,13 @@ if [[ -z "$1" ]]; then exit 1 fi +if [[ -z "${DOCKERHUB_REPO}" ]]; then + echo "DOCKERHUB_REPO environment variable is not set" + exit 1 +fi + # Check if the image tagged with pmdk/OS-VER exists locally -if [[ ! $(docker images -a | awk -v pattern="^pmem/pmdk:1.5-$1\$" \ +if [[ ! $(docker images -a | awk -v pattern="^${DOCKERHUB_REPO}:1.5-$1\$" \ '$1":"$2 ~ pattern') ]] then echo "ERROR: wrong argument." @@ -68,4 +73,4 @@ fi docker login -u="$DOCKER_USER" -p="$DOCKER_PASSWORD" # Push the image to the repository -docker push pmem/pmdk:1.5-$1 +docker push ${DOCKERHUB_REPO}:1.5-$1 diff --git a/utils/docker/pull-or-rebuild-image.sh b/utils/docker/pull-or-rebuild-image.sh index 8aa184dd503a77c8398e22ba6f327a8d0d0c9e0f..dfcee4f91ed59438c9252b6de86d4a52efceab45 100755 --- a/utils/docker/pull-or-rebuild-image.sh +++ b/utils/docker/pull-or-rebuild-image.sh @@ -1,6 +1,6 @@ #!/usr/bin/env bash # -# Copyright 2016-2018, Intel Corporation +# Copyright 2016-2019, Intel Corporation # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions @@ -77,7 +77,7 @@ fi # TRAVIS_COMMIT_RANGE is usually invalid for force pushes - ignore such values # when used with non-upstream repository -if [ -n "$TRAVIS_COMMIT_RANGE" -a $TRAVIS_REPO_SLUG != "pmem/pmdk" ]; then +if [ -n "$TRAVIS_COMMIT_RANGE" -a $TRAVIS_REPO_SLUG != "$GITHUB_REPO" ]; then if ! git rev-list $TRAVIS_COMMIT_RANGE; then TRAVIS_COMMIT_RANGE= fi @@ -115,11 +115,11 @@ for file in $files; do popd # Check if the image has to be pushed to Docker Hub - # (i.e. the build is triggered by commits to the pmem/pmdk + # (i.e. the build is triggered by commits to the $GITHUB_REPO # repository's stable-1.5 branch, and the Travis build is not # of the "pull_request" type). In that case, create the empty # file. - if [[ $TRAVIS_REPO_SLUG == "pmem/pmdk" \ + if [[ $TRAVIS_REPO_SLUG == "$GITHUB_REPO" \ && $TRAVIS_BRANCH == "stable-1.5" \ && $TRAVIS_EVENT_TYPE != "pull_request" && $PUSH_IMAGE == "1" ]] @@ -141,4 +141,4 @@ done # Getting here means rebuilding the Docker image is not required. # Pull the image from Docker Hub. -docker pull pmem/pmdk:1.5-${OS}-${OS_VER} +docker pull ${DOCKERHUB_REPO}:1.5-${OS}-${OS_VER}