From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtpng1.m.smailru.net (smtpng1.m.smailru.net [94.100.181.251]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dev.tarantool.org (Postfix) with ESMTPS id 4116F46970E for ; Mon, 13 Jan 2020 14:48:41 +0300 (MSK) From: "Alexander V. Tikhonov" Date: Mon, 13 Jan 2020 14:48:35 +0300 Message-Id: In-Reply-To: References: In-Reply-To: References: Subject: [Tarantool-patches] [PATCH docker v1 1/5] Add into Gitlab-CI testing List-Id: Tarantool development patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Alexander Turenko Cc: tarantool-patches@dev.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