From fcd7f5f95eb69612c82499a2f1e78a4b0d7a9b37 Mon Sep 17 00:00:00 2001 From: bacon Date: Wed, 29 May 2024 22:16:54 +0300 Subject: [PATCH] testing registry --- .gitlab-ci.yml | 56 +++++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 51 insertions(+), 5 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 5d7fce6..2b48f3f 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -6,10 +6,7 @@ stages: pytest: stage: 'test' - image: python - only: - - test - - tags + image: python:3.12.2-slim-bookworm cache: paths: - $CI_PROJECT_DIR/venv/ @@ -37,6 +34,19 @@ make_image: needs: - pytest image: docker:26.1.3 + only: + # We want this job to be run on tags only. + refs: + - tags + - push + changes: + - ^README.md + - ^CHANGELOG + - ^.gitattribute + - ^.gitignore + - ^.gitlab-ci.yml + - src/**/* + - requirements.txt services: - docker:26.1.3-dind @@ -65,11 +75,21 @@ make_image: # Here, the goal is to tag the "master" branch as "latest" Push latest: + needs: make_image variables: # We are just playing with Docker here. # We do not need GitLab to clone the source code. GIT_STRATEGY: none stage: push + only: + changes: + - ^README.md + - ^CHANGELOG + - ^.gitattribute + - ^.gitignore + - ^.gitlab-ci.yml + - src/**/* + - requirements.txt before_script: - docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY script: @@ -84,10 +104,26 @@ Push latest: # Finally, the goal here is to Docker tag any Git tag # GitLab will start a new pipeline everytime a Git tag is created, which is pretty awesome Push commit: + needs: make_image variables: # Again, we do not need the source code here. Just playing with Docker. GIT_STRATEGY: none stage: push + only: + # We want this job to be run on tags only. + refs: + - ^tags + - push + changes: + - ^README.md + - ^CHANGELOG + - ^.gitattribute + - ^.gitignore + - ^.gitlab-ci.yml + - src/**/* + - requirements.txt + + before_script: - docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY script: @@ -96,13 +132,23 @@ Push commit: - docker push $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_NAME Push tag: + needs: make_image variables: # Again, we do not need the source code here. Just playing with Docker. GIT_STRATEGY: none stage: push only: # We want this job to be run on tags only. - - tags + refs: + - tags + changes: + - ^README.md + - ^CHANGELOG + - ^.gitattribute + - ^.gitignore + - ^.gitlab-ci.yml + - src/**/* + - requirements.txt before_script: - docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY script: