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: pytest:
stage: 'test' stage: 'test'
image: python image: python:3.12.2-slim-bookworm
only:
- test
- tags
cache: cache:
paths: paths:
- $CI_PROJECT_DIR/venv/ - $CI_PROJECT_DIR/venv/
@@ -37,6 +34,19 @@ make_image:
needs: needs:
- pytest - pytest
image: docker:26.1.3 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: services:
- docker:26.1.3-dind - docker:26.1.3-dind
@@ -65,11 +75,21 @@ make_image:
# Here, the goal is to tag the "master" branch as "latest" # Here, the goal is to tag the "master" branch as "latest"
Push latest: Push latest:
needs: make_image
variables: variables:
# We are just playing with Docker here. # We are just playing with Docker here.
# We do not need GitLab to clone the source code. # We do not need GitLab to clone the source code.
GIT_STRATEGY: none GIT_STRATEGY: none
stage: push stage: push
only:
changes:
- ^README.md
- ^CHANGELOG
- ^.gitattribute
- ^.gitignore
- ^.gitlab-ci.yml
- src/**/*
- requirements.txt
before_script: before_script:
- docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY - docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY
script: script:
@@ -84,10 +104,26 @@ Push latest:
# Finally, the goal here is to Docker tag any Git tag # 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 # GitLab will start a new pipeline everytime a Git tag is created, which is pretty awesome
Push commit: Push commit:
needs: make_image
variables: variables:
# Again, we do not need the source code here. Just playing with Docker. # Again, we do not need the source code here. Just playing with Docker.
GIT_STRATEGY: none GIT_STRATEGY: none
stage: push 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: before_script:
- docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY - docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY
script: script:
@@ -96,13 +132,23 @@ Push commit:
- docker push $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_NAME - docker push $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_NAME
Push tag: Push tag:
needs: make_image
variables: variables:
# Again, we do not need the source code here. Just playing with Docker. # Again, we do not need the source code here. Just playing with Docker.
GIT_STRATEGY: none GIT_STRATEGY: none
stage: push stage: push
only: only:
# We want this job to be run on tags only. # We want this job to be run on tags only.
refs:
- tags - tags
changes:
- ^README.md
- ^CHANGELOG
- ^.gitattribute
- ^.gitignore
- ^.gitlab-ci.yml
- src/**/*
- requirements.txt
before_script: before_script:
- docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY - docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY
script: script: