Pour tout problème contactez-nous par mail : support@froggit.fr | La FAQ :grey_question: | Rejoignez-nous sur le Chat :speech_balloon:

Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • swepy/cicd-templates/pypi-to-docker-missing-version
1 result
Show changes
Commits on Source (2)
......@@ -9,6 +9,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
[![Pipeline](https://lab.frogg.it/swepy/cicd-templates/pypi-to-docker-missing-version/badges/trunk/pipeline.svg)](https://lab.frogg.it/swepy/cicd-templates/pypi-to-docker-missing-version/-/pipelines?ref=trunk)
### Changed
* Job now always create a `version.txt` with the last version released on pypi if
no version is missing in the registry
## [0.3.0] - 2024-07-16
[![Pipeline](https://lab.frogg.it/swepy/cicd-templates/pypi-to-docker-missing-version/badges/0.3.0/pipeline.svg)](https://lab.frogg.it/swepy/cicd-templates/pypi-to-docker-missing-version/-/pipelines?ref=0.3.0)
......
......@@ -5,10 +5,10 @@
## Objective
This template is used to retrieve all versions of a package from PyPI and compare it to
the version of the image in the registry. If the version of the image is missing, the
job will create an artefact with the lowest version of the package missing in the
registry, ready to be used for other jobs to build the image.
Used to retrieve all versions of a package from PyPI and compare it to the version of
the image in the registry. If the version of the image is missing, the job will create
an artefact with the lowest version of the package missing in the registry, ready to be
used for other jobs to build the image.
## How to use it
......@@ -16,32 +16,47 @@ registry, ready to be used for other jobs to build the image.
Add the following to your `.gitlab-ci.yml` file.
#### As a Local component
As a local Template (if the template is local to the instance):
Recommended if the component is local to the instance:
```yaml
include:
- project: 'swepy/cicd-templates/pypi-to-docker-missing-version'
ref: '0.3.0'
file: 'templates/pypi-to-docker-missing-version.yml'
- component: $CI_SERVER_FQDN/swepy/cicd-templates/pypi-to-docker-missing-version/pypi-to-docker-missing-version@0.3.0
```
As a Component ([beta](https://gitlab.com/gitlab-org/gitlab/-/issues/407556) and if the
component is local to the instance):
If your GitLab instance version is lower than `16.10`, use `$CI_SERVER_HOST` instead
of `$CI_SERVER_FQDN`. Don't forget to add the port if necessary.
#### As a Remote template
Recommended if the template is not local to the instance:
##### Source: lab.frogg.it
```yaml
include:
- component: $CI_SERVER_FQDN/swepy/cicd-templates/pypi-to-docker-missing-version/pypi-to-docker-missing-version@0.3.0
- remote: 'https://lab.frogg.it/swepy/cicd-templates/pypi-to-docker-missing-version/-/raw/0.3.0/templates/pypi-to-docker-missing-version.yml'
```
As a remote Template (recommended):
##### Mirror: GitLab.com
```yaml
include:
- remote: 'https://gitlab.com/swepy/cicd-templates/pypi-to-docker-missing-version/-/raw/0.3.0/templates/pypi-to-docker-missing-version.yml'
```
#### As a Local template
If the template is local to the instance:
```yaml
include:
- project: 'swepy/cicd-templates/pypi-to-docker-missing-version'
ref: '0.3.0'
file: 'templates/pypi-to-docker-missing-version.yml'
```
### Customize job
You can customize the job by overriding specific keys. For example:
......
......@@ -54,14 +54,16 @@ pypi-to-docker-missing-version:
- version_to_publish=$(echo $sorted_releases | awk '{print $1}')
- 'echo "Version to publish: $version_to_publish"'
- echo "$version_to_publish" > version.txt
- cat version.txt
- if [ -n "$version_to_publish" ]; then
- exit 0
- echo "Version to publish=$version_to_publish"
- else
- exit 1
- version_to_publish=$(echo $releases | awk '{print $NF}')
- echo "Version to publish=$version_to_publish"
- fi
- echo "$version_to_publish" > version.txt
- cat version.txt
artifacts:
name: "version"
paths:
......