Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c35a16e317 | ||
| 3f2d6093d0 | |||
| fcd7f5f95e |
@@ -1,30 +1,8 @@
|
|||||||
|
|
||||||
stages:
|
stages:
|
||||||
- 'test'
|
|
||||||
- 'build'
|
- 'build'
|
||||||
- 'push'
|
- 'push'
|
||||||
|
|
||||||
pytest:
|
|
||||||
stage: 'test'
|
|
||||||
image: python
|
|
||||||
only:
|
|
||||||
- test
|
|
||||||
- tags
|
|
||||||
cache:
|
|
||||||
paths:
|
|
||||||
- $CI_PROJECT_DIR/venv/
|
|
||||||
before_script:
|
|
||||||
- cd $CI_PROJECT_DIR
|
|
||||||
- python -m venv venv
|
|
||||||
- chmod u+x venv/bin/activate
|
|
||||||
- source venv/bin/activate
|
|
||||||
- pip install --upgrade --quiet pip
|
|
||||||
- pip install --quiet -U -r requirements.txt
|
|
||||||
- pip install --quiet -U -r tests/requirements.txt
|
|
||||||
script:
|
|
||||||
- pytest -v
|
|
||||||
|
|
||||||
|
|
||||||
variables:
|
variables:
|
||||||
# DOCKER_HOST: tcp://docker:2375
|
# DOCKER_HOST: tcp://docker:2375
|
||||||
# fill those if you have a proxy in your environment
|
# fill those if you have a proxy in your environment
|
||||||
@@ -34,9 +12,20 @@ variables:
|
|||||||
|
|
||||||
make_image:
|
make_image:
|
||||||
stage: build
|
stage: build
|
||||||
needs:
|
|
||||||
- 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 +54,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 +83,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 +111,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.
|
||||||
- tags
|
refs:
|
||||||
|
- 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:
|
||||||
|
|||||||
Reference in New Issue
Block a user