From b3fc7f65f255f95eba2fda68f134774ba11f179d Mon Sep 17 00:00:00 2001 From: Luke Robles Date: Mon, 31 Jan 2022 21:34:41 -0800 Subject: [PATCH 1/3] Testing a pipeline that tags build with pipeline ID --- .gitlab-ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 159d8343..8ddceff5 100755 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -12,7 +12,6 @@ stages: - test - deploy - lint_python_on_merge_request: image: python:alpine stage: test @@ -26,7 +25,8 @@ build_and_push_container: - echo "Wait for Docker daemon at tcp://localhost:2375" - while ! nc -z localhost 2375; do sleep 0.1; done # Wait until docker socket is available - docker login -u ldooks -p $DOCKER_ACCESS_TOKEN - - docker build -t ldooks/dragon-bot:latest . + - docker build -t ldooks/dragon-bot:$CI_JOB_ID . + - docker push ldooks/dragon-bot:$CI_JOB_ID - docker push ldooks/dragon-bot:latest only: - master From d72151787f976e04b31b3e572595f79a8fe33b90 Mon Sep 17 00:00:00 2001 From: Luke Robles Date: Mon, 31 Jan 2022 21:36:09 -0800 Subject: [PATCH 2/3] making the lint stage print out the pipeline ID as a test --- .gitlab-ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 8ddceff5..3739518d 100755 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -18,6 +18,7 @@ lint_python_on_merge_request: script: - echo "Linting Python code" - pip install --upgrade -q pip && pip install -q black && black --fast --check . + - echo $CI_JOB_ID build_and_push_container: stage: deploy From 68927d6488b83b1bf8d58e95951e3c388a38e282 Mon Sep 17 00:00:00 2001 From: Luke Robles Date: Mon, 31 Jan 2022 21:39:28 -0800 Subject: [PATCH 3/3] multiple tags and pushes --- .gitlab-ci.yml | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 3739518d..37dab41f 100755 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -18,7 +18,6 @@ lint_python_on_merge_request: script: - echo "Linting Python code" - pip install --upgrade -q pip && pip install -q black && black --fast --check . - - echo $CI_JOB_ID build_and_push_container: stage: deploy @@ -26,8 +25,7 @@ build_and_push_container: - echo "Wait for Docker daemon at tcp://localhost:2375" - while ! nc -z localhost 2375; do sleep 0.1; done # Wait until docker socket is available - docker login -u ldooks -p $DOCKER_ACCESS_TOKEN - - docker build -t ldooks/dragon-bot:$CI_JOB_ID . - - docker push ldooks/dragon-bot:$CI_JOB_ID - - docker push ldooks/dragon-bot:latest + - docker build -t ldooks/dragon-bot:$CI_PIPELINE_ID -t ldooks/dragon-bot:latest . + - docker push ldooks/dragon-bot --all-tags only: - master