From fa88f0a905fc109430b2d93c7642a1ba5006573c Mon Sep 17 00:00:00 2001 From: Victor Moura Date: Thu, 29 Aug 2019 11:07:48 -0300 Subject: [PATCH 1/3] Reinserts test stage and optimizes image building stages --- .gitlab-ci.yml | 43 +++++++++++++++++++++++++++++-------------- 1 file changed, 29 insertions(+), 14 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 4a33841a..c9b0dbc7 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,10 +1,15 @@ image: python:3.6-slim +variables: + COACH_TEMP_IMAGE: $CI_REGISTRY_IMAGE/ci/coach:$CI_COMMIT_SHORT_SHA + BOT_TEMP_IMAGE: $CI_REGISTRY_IMAGE/ci/bot:$CI_COMMIT_SHORT_SHA + + stages: - test style - validate format - # - test stories - build requirements + - test stories - build coach - build - deploy @@ -29,17 +34,21 @@ run dataset validator: - cd coach/ - make run-validator -#test stories: -# stage: test stories -# image: docker -# tags: -# - docker -# services: -# - docker:dind -# script: -# - docker build . -f docker/bot/coach.Dockerfile -t lappis/coach:latest > /dev/null 2>&1 -# - docker build -f docker/bot/bot.Dockerfile -t lappis/bot:latest . -# - docker run --rm lappis/bot:latest make test-stories +test stories: + stage: test stories + image: docker + tags: + - docker + services: + - docker:dind + script: + - docker build . -f docker/bot/coach.Dockerfile -t $COACH_TEMP_IMAGE > /dev/null 2>&1 + - docker build -f docker/bot/bot.Dockerfile -t $COACH_BOT_IMAGE . + - docker run --rm $BOT_TEMP_IMAGE make test-stories + - docker login -u "gitlab-ci-token" -p "$CI_JOB_TOKEN" $CI_REGISTRY + - docker push $COACH_TEMP_IMAGE + - docker push $BOT_TEMP_IMAGE + build requirements: stage: build requirements @@ -68,10 +77,13 @@ build coach: - docker:dind script: - docker login -u $DOCKERHUB_USER -p $DOCKERHUB_PASSWORD - - docker build . -f docker/bot/coach.Dockerfile -t lappis/coach:latest > /dev/null 2>&1 + # - docker build . -f docker/bot/coach.Dockerfile -t lappis/coach:latest > /dev/null 2>&1 + - docker pull $COACH_TEMP_IMAGE + - docker tag $COACH_TEMP_IMAGE lappis/coach:latest - docker push lappis/coach:latest only: - master + - gitlabci_optimization environment: homolog build bot: @@ -83,10 +95,13 @@ build bot: - docker:dind script: - docker login -u $DOCKERHUB_USER -p $DOCKERHUB_PASSWORD - - docker build -f docker/bot/bot.Dockerfile -t lappis/bot:latest . + # - docker build -f docker/bot/bot.Dockerfile -t lappis/bot:latest . + - docker pull $BOT_TEMP_IMAGE + - docker tag $BOT_TEMP_IMAGE lappis/bot:latest - docker push lappis/bot:latest only: - master + - gitlabci_optimization environment: homolog build web: From 58e89c321579605f1cd634e160ca1bcadac11981 Mon Sep 17 00:00:00 2001 From: Victor Moura Date: Thu, 29 Aug 2019 11:26:07 -0300 Subject: [PATCH 2/3] Fixes typo in gitlabci.yml --- .gitlab-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index c9b0dbc7..692776b7 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -43,7 +43,7 @@ test stories: - docker:dind script: - docker build . -f docker/bot/coach.Dockerfile -t $COACH_TEMP_IMAGE > /dev/null 2>&1 - - docker build -f docker/bot/bot.Dockerfile -t $COACH_BOT_IMAGE . + - docker build -f docker/bot/bot.Dockerfile -t $BOT_TEMP_IMAGE . - docker run --rm $BOT_TEMP_IMAGE make test-stories - docker login -u "gitlab-ci-token" -p "$CI_JOB_TOKEN" $CI_REGISTRY - docker push $COACH_TEMP_IMAGE From f66de0d01b2c86c15dcc711ea061fb87b8135897 Mon Sep 17 00:00:00 2001 From: Victor Moura Date: Thu, 29 Aug 2019 11:55:25 -0300 Subject: [PATCH 3/3] Removes testing branch conditionals and adds comments --- .gitlab-ci.yml | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 692776b7..77c7dfec 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -42,11 +42,12 @@ test stories: services: - docker:dind script: - - docker build . -f docker/bot/coach.Dockerfile -t $COACH_TEMP_IMAGE > /dev/null 2>&1 - - docker build -f docker/bot/bot.Dockerfile -t $BOT_TEMP_IMAGE . + - docker build . -f docker/bot/coach.Dockerfile -t lappis/coach:latest > /dev/null 2>&1 # Builds lappis/coach:latest + - docker build -f docker/bot/bot.Dockerfile -t $BOT_TEMP_IMAGE . # It uses lappis/coach:latest built locally - docker run --rm $BOT_TEMP_IMAGE make test-stories - docker login -u "gitlab-ci-token" -p "$CI_JOB_TOKEN" $CI_REGISTRY - - docker push $COACH_TEMP_IMAGE + - docker tag lappis/coach:latest $COACH_TEMP_IMAGE # Retags lappis/coach:latest to temp image + - docker push $COACH_TEMP_IMAGE # Pushes temp image to the gitlab registry (it will be pulled from gitlab and pushed to Dockerhub later) - docker push $BOT_TEMP_IMAGE @@ -77,13 +78,11 @@ build coach: - docker:dind script: - docker login -u $DOCKERHUB_USER -p $DOCKERHUB_PASSWORD - # - docker build . -f docker/bot/coach.Dockerfile -t lappis/coach:latest > /dev/null 2>&1 - docker pull $COACH_TEMP_IMAGE - docker tag $COACH_TEMP_IMAGE lappis/coach:latest - docker push lappis/coach:latest only: - master - - gitlabci_optimization environment: homolog build bot: @@ -95,13 +94,11 @@ build bot: - docker:dind script: - docker login -u $DOCKERHUB_USER -p $DOCKERHUB_PASSWORD - # - docker build -f docker/bot/bot.Dockerfile -t lappis/bot:latest . - docker pull $BOT_TEMP_IMAGE - docker tag $BOT_TEMP_IMAGE lappis/bot:latest - docker push lappis/bot:latest only: - master - - gitlabci_optimization environment: homolog build web: