From 9fd455de28e24e56ba017e932cbc3ca895008068 Mon Sep 17 00:00:00 2001 From: Antoine Legrand <2t.antoine@gmail.com> Date: Thu, 27 Jul 2017 11:53:23 +0200 Subject: [PATCH] show migration head --- .gitlab-ci.jsonnet | 6 +++++- .gitlab-ci.yml | 6 +++++- .gitlab-ci/vars.libsonnet | 3 ++- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/.gitlab-ci.jsonnet b/.gitlab-ci.jsonnet index bfd95815d..0eacc9358 100644 --- a/.gitlab-ci.jsonnet +++ b/.gitlab-ci.jsonnet @@ -34,7 +34,7 @@ local jobs = { // Update the base container stage: stages.docker_base, script: [ - 'docker build --cache-from quay.io/quay/quay-base:latest' + + 'docker build --no-cache' + ' -t %s -f quay-base.dockerfile .' % images.base.name, 'docker push %s' % images.base.name, ], @@ -46,6 +46,10 @@ local jobs = { stage: stages.docker_build, script: [ 'docker build -t %s -f Dockerfile .' % images.quayci.name, + 'docker run --rm %s cat ALEMBIC_HEAD > /tmp/ALEMBIC_HEAD' % images.quayci.name, + 'export MIGRATION_HEAD=`cat /tmp/ALEMBIC_HEAD | cut -d" " -f1`', + 'echo $MIGRATION_HEAD', + 'docker build --label db-schema-head=$MIGRATION_HEAD -t %s -f Dockerfile .' % images.quayci.name, 'docker push %s' % images.quayci.name], }, diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 85e544f0a..384d5b62f 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -9,7 +9,7 @@ container-base-build: - master - tags script: - - docker build --cache-from quay.io/quay/quay-base:latest -t quay.io/quay/quay-base:latest -f quay-base.dockerfile . + - docker build --no-cache -t quay.io/quay/quay-base:latest -f quay-base.dockerfile . - docker push quay.io/quay/quay-base:latest stage: docker_base tags: @@ -23,6 +23,10 @@ container-build: image: docker:git script: - docker build -t quay.io/quay/quay-ci:${CI_COMMIT_REF_SLUG} -f Dockerfile . + - docker run --rm quay.io/quay/quay-ci:${CI_COMMIT_REF_SLUG} cat ALEMBIC_HEAD > /tmp/ALEMBIC_HEAD + - export MIGRATION_HEAD=`cat /tmp/ALEMBIC_HEAD | cut -d" " -f1` + - echo $MIGRATION_HEAD + - docker build --label db-schema-head=$MIGRATION_HEAD -t quay.io/quay/quay-ci:${CI_COMMIT_REF_SLUG} -f Dockerfile . - docker push quay.io/quay/quay-ci:${CI_COMMIT_REF_SLUG} stage: docker_build tags: diff --git a/.gitlab-ci/vars.libsonnet b/.gitlab-ci/vars.libsonnet index dcbeef1ff..7d4a3b2d6 100644 --- a/.gitlab-ci/vars.libsonnet +++ b/.gitlab-ci/vars.libsonnet @@ -19,7 +19,8 @@ local utils = import "utils.libsonnet"; name: utils.containerName(self.repo, self.tag), }, - quayci: { repo: "quay.io/quay/quay-ci", tag: "${CI_COMMIT_REF_SLUG}", + quayci: { repo: "quay.io/quay/quay-ci", + tag: "${CI_COMMIT_REF_SLUG}", name: utils.containerName(self.repo, self.tag), },