From: "Alexander V. Tikhonov" <avtikhon@tarantool.org>
To: Alexander Turenko <alexander.turenko@tarantool.org>
Cc: tarantool-patches@dev.tarantool.org
Subject: [Tarantool-patches] [PATCH docker v1 1/5] Add into Gitlab-CI testing
Date: Mon, 13 Jan 2020 14:48:35 +0300 [thread overview]
Message-ID: <a8c874ff112f7f156937e89eabecfb74f14bcca0.1578916023.git.avtikhon@tarantool.org> (raw)
In-Reply-To: <cover.1578916023.git.avtikhon@tarantool.org>
In-Reply-To: <cover.1578916023.git.avtikhon@tarantool.org>
Refactored the Gitlab-CI testing script. Made
available images rebuild only for the changed
appropriate directories/files. Reused the
previously set images repository:
registry.gitlab.com/tarantool/docker
---
.gitlab-ci.yml | 60 ++++++++++++++++++++++++++++++--------------------
.gitlab.mk | 7 ++++++
2 files changed, 43 insertions(+), 24 deletions(-)
create mode 100644 .gitlab.mk
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index e815c21..508e250 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -1,35 +1,47 @@
stages:
- - build
- - release
+ - build
variables:
REGISTRY: registry.gitlab.com
IMAGE: ${REGISTRY}/${CI_PROJECT_NAMESPACE}/${CI_PROJECT_NAME}
before_script:
- # Enable GitLab registry
- - docker login -u gitlab-ci-token -p ${CI_BUILD_TOKEN} ${REGISTRY}
+ # Enable GitLab registry
+ - docker login -u gitlab-ci-token -p ${CI_BUILD_TOKEN} ${REGISTRY}
-#
-# Build Docker image and publish as IMAGE:BRANCH
-#
-docker-build:
+.build_template: &build_definition
stage: build
- variables:
- TAG: 1.7-centos7
script:
- - docker build -t ${IMAGE}:${TAG}-${CI_COMMIT_REF_SLUG} ${TAG}/
- - docker push ${IMAGE}:${TAG}-${CI_COMMIT_REF_SLUG}
-
-#
-# Tag IMAGE:BRANCH as image:latest for release branches (master)
-#
-docker-tag:
- stage: release
+ - >
+ if git diff origin/master --name-only | grep "^${DIR}/" ; then
+ make -f .gitlab.mk build
+ fi;
+
+'1.x':
+ <<: *build_definition
variables:
- TAG: 1.7-centos7
- script:
- - docker tag ${IMAGE}:${TAG}-${CI_COMMIT_REF_SLUG} ${IMAGE}:${TAG}
- - docker push ${IMAGE}:${TAG}
- only:
- - master
+ TAG: '1'
+ DIR: '1.x'
+ PORT: 3301
+
+'2.x':
+ <<: *build_definition
+ variables:
+ TAG: '2'
+ DIR: '2.x'
+ PORT: 3302
+
+'2.1':
+ <<: *build_definition
+ variables:
+ TAG: '2.1'
+ DIR: '2.1'
+ PORT: 3321
+
+'2.2':
+ <<: *build_definition
+ variables:
+ TAG: '2.2'
+ DIR: '2.2'
+ PORT: 3322
+
diff --git a/.gitlab.mk b/.gitlab.mk
new file mode 100644
index 0000000..5589177
--- /dev/null
+++ b/.gitlab.mk
@@ -0,0 +1,7 @@
+build:
+ docker build --network=host -t ${IMAGE}:${TAG} ${DIR}/
+ docker run --rm --name tarantool_${TAG} -p ${PORT}:${PORT} -d ${IMAGE}:${TAG}
+ docker exec -t tarantool_${TAG} tarantool_is_up
+ docker stop tarantool_${TAG}
+ docker push ${IMAGE}:${TAG}
+
--
2.17.1
next prev parent reply other threads:[~2020-01-13 11:48 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-01-13 11:48 [Tarantool-patches] [PATCH docker v1 0/4] Implement gitlab-ci testing and reorganize repository files structure Alexander V. Tikhonov
2020-01-13 11:48 ` Alexander V. Tikhonov [this message]
2020-01-13 11:48 ` [Tarantool-patches] [PATCH docker v1 2/5] Merge files in repository Alexander V. Tikhonov
2020-01-13 11:48 ` [Tarantool-patches] [PATCH docker v1 3/5] Move tagged versions into master Alexander V. Tikhonov
2020-01-13 11:48 ` [Tarantool-patches] [PATCH docker v1 4/5] Change keyserver to be easy accessed Alexander V. Tikhonov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=a8c874ff112f7f156937e89eabecfb74f14bcca0.1578916023.git.avtikhon@tarantool.org \
--to=avtikhon@tarantool.org \
--cc=alexander.turenko@tarantool.org \
--cc=tarantool-patches@dev.tarantool.org \
--subject='Re: [Tarantool-patches] [PATCH docker v1 1/5] Add into Gitlab-CI testing' \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox