diff --git a/buildkite/common b/buildkite/common index ab65773d1..fc74d4790 100755 --- a/buildkite/common +++ b/buildkite/common @@ -14,4 +14,3 @@ else fi BUILD_ENV_TAG=$ORG/montagu-portal-shared-build-env:$GIT_SHA -BUILD_ENV_NAME=montagu-portal-shared-build-env diff --git a/buildkite/make-integration-tests-image.sh b/buildkite/make-integration-tests-image.sh index c0208f705..cecc2c197 100755 --- a/buildkite/make-integration-tests-image.sh +++ b/buildkite/make-integration-tests-image.sh @@ -11,11 +11,11 @@ TAG_BRANCH=$NAME:$GIT_BRANCH # In case we switch agents between steps [ ! -z $(docker images -q $BUILD_ENV_TAG) ] || docker pull $BUILD_ENV_TAG -# We build a docker image that inherits from the latest build env image -# so here tag the image with the name used in the dockerfile -docker tag $BUILD_ENV_TAG $BUILD_ENV_NAME +docker build -f ./docker/integration-tests.dockerfile \ + -t $TAG_SHA \ + --build-arg MONTAGU_GIT_ID=$GIT_SHA \ + . -docker build -f ./docker/integration-tests.dockerfile -t $TAG_SHA . docker tag $TAG_SHA $TAG_BRANCH docker push $TAG_SHA docker push $TAG_BRANCH diff --git a/buildkite/pipeline.yml b/buildkite/pipeline.yml index 11b09b64f..305d55862 100644 --- a/buildkite/pipeline.yml +++ b/buildkite/pipeline.yml @@ -9,3 +9,9 @@ steps: - label: ":construction_worker: Build and push integration test image" command: buildkite/make-integration-tests-image.sh + + - wait + + - label: ":hammer: Stop dependencies" + command: app/scripts/clear-docker.sh + allow_dependency_failure: true diff --git a/buildkite/run-build.sh b/buildkite/run-build.sh index 15b21a4c4..5404e2cff 100755 --- a/buildkite/run-build.sh +++ b/buildkite/run-build.sh @@ -3,7 +3,7 @@ set -ex HERE=$(dirname $0) . $HERE/common -PORTAL_BUILD_ENV=montagu-portal-build-env +PORTAL_BUILD_ENV=montagu-portal-build-env:$GIT_SHA ./$HERE/../app/scripts/run-dependencies.sh ./$HERE/../app/scripts/add-test-accounts-for-integration-tests.sh @@ -11,13 +11,9 @@ PORTAL_BUILD_ENV=montagu-portal-build-env # In case we switch agents between steps [ ! -z $(docker images -q $BUILD_ENV_TAG) ] || docker pull $BUILD_ENV_TAG -# We build a docker image that inherits from the latest build env image -# so here tag the image with the name used in the dockerfile -docker tag $BUILD_ENV_TAG $BUILD_ENV_NAME - # The main build env which builds and tests below docker build -f ./docker/build.dockerfile \ - -t $PORTAL_BUILD_ENV:$GIT_SHA \ + -t $PORTAL_BUILD_ENV \ --build-arg MONTAGU_GIT_ID=$GIT_SHA \ --build-arg MONTAGU_GIT_BRANCH=$GIT_BRANCH \ . @@ -30,4 +26,4 @@ docker run \ -v $docker_auth_path:/root/.docker/config.json \ -v /var/run/docker.sock:/var/run/docker.sock \ --network=host \ - $PORTAL_BUILD_ENV:$GIT_SHA + $PORTAL_BUILD_ENV diff --git a/docker/build-images.sh b/docker/build-images.sh index 48d7f9138..7df696049 100755 --- a/docker/build-images.sh +++ b/docker/build-images.sh @@ -3,7 +3,7 @@ set -e git_branch=$1 git_id=$2 -registry=docker.montagu.dide.ic.ac.uk:5000 +org=vimc contrib_name=montagu-contrib-portal admin_name=montagu-admin-portal @@ -26,8 +26,8 @@ function build { app_name=$2 echo "Building $app_name portal image" docker build -f docker/run.dockerfile \ - -t $registry/$image_name:$git_id \ - -t $registry/$image_name:$git_branch \ + -t $org/$image_name:$git_id \ + -t $org/$image_name:$git_branch \ --build-arg APP_NAME=$app_name \ . } @@ -41,7 +41,7 @@ function push { docker push $id } -push $registry/$contrib_name:$git_id -push $registry/$contrib_name:$git_branch -push $registry/$admin_name:$git_id -push $registry/$admin_name:$git_branch +push $org/$contrib_name:$git_id +push $org/$contrib_name:$git_branch +push $org/$admin_name:$git_id +push $org/$admin_name:$git_branch diff --git a/docker/build.dockerfile b/docker/build.dockerfile index fbccaaed3..680a84a61 100644 --- a/docker/build.dockerfile +++ b/docker/build.dockerfile @@ -1,4 +1,5 @@ -FROM montagu-portal-shared-build-env +ARG MONTAGU_GIT_ID="UNKNOWN" +FROM vimc/montagu-portal-shared-build-env:$MONTAGU_GIT_ID ARG MONTAGU_GIT_ID="UNKNOWN" ARG MONTAGU_GIT_BRANCH="UNKNOWN" diff --git a/docker/integration-tests.dockerfile b/docker/integration-tests.dockerfile index 6570da60c..24efe3507 100644 --- a/docker/integration-tests.dockerfile +++ b/docker/integration-tests.dockerfile @@ -1,3 +1,5 @@ -FROM montagu-portal-shared-build-env +ARG MONTAGU_GIT_ID="UNKNOWN" + +FROM vimc/montagu-portal-shared-build-env:$MONTAGU_GIT_ID ENTRYPOINT ["./scripts/run-integration-tests-in-container.sh"]