testing registry

This commit is contained in:
2024-05-29 22:16:54 +03:00
parent bb2966a867
commit fcd7f5f95e

View File

@@ -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.
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: