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
Commit 2358c4e7 authored by Dorian Turba's avatar Dorian Turba
Browse files

chore: changed naming convention to dash separated words

parent c88fe500
No related branches found
No related tags found
1 merge request!1Bump version: 0.4.1 → 0.4.2
Pipeline #63418 passed
...@@ -4,6 +4,6 @@ include: ...@@ -4,6 +4,6 @@ include:
ref: $CI_COMMIT_SHA ref: $CI_COMMIT_SHA
file: 'templates/pypi-to-docker-missing-version.yml' file: 'templates/pypi-to-docker-missing-version.yml'
inputs: inputs:
image_name: swepy/ruff image-name: swepy/ruff
package_name: ruff package-name: ruff
stage: test stage: test
...@@ -17,18 +17,20 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ...@@ -17,18 +17,20 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Changed ### Changed
* Variable `REPOSITORIES_API_URL` renamed `CONTAINER_REGISTRY_API_URL` * Variable rename:
* `REPOSITORIES_API_URL` renamed `CONTAINER_REGISTRY_API_URL`
* `TAGS` renamed `TAG_EXCLUDE`
### Added ### Added
* Support [inputs](https://docs.gitlab.com/ci/yaml/inputs/): * Support [inputs](https://docs.gitlab.com/ci/yaml/inputs/):
* blocking: When no new version to publish, job fails, otherwise consider last release. * blocking: When no new version to publish, job fails, otherwise consider last release.
* container_registry_api_url: URL of the API to retrieve the container registry. * container-registry-api-url: URL of the API to retrieve the container registry.
* image_name: Image name on Container Registry. Should be "<org|user>/<repo>". * image-name: Image name on Container Registry. Should be "<org|user>/<repo>".
* package_index_api_url: URL of the API to retrieve the package index. * package-index-api-url: URL of the API to retrieve the package index.
* package_name: Name of the package on Package Registry. * package-name: Name of the package on Package Registry.
* stage: Stage of the job. * stage: Stage of the job.
* tags: Image Tags to consider as already built. Used to exclude specific versions. * tag-exclude: Image Tags to consider as already built. Used to exclude specific versions.
* Variable `BLOCKING` * Variable `BLOCKING`
## [0.4.1] - 2024-07-16 ## [0.4.1] - 2024-07-16
......
...@@ -21,29 +21,29 @@ include: ...@@ -21,29 +21,29 @@ include:
### Inputs ### Inputs
You can customize the job by overriding specific inputs. You can customize the job through [inputs](https://docs.gitlab.com/ci/components/#use-a-component).
| Name | Description | Default | | Name | Description | Default |
|------------------------------|----------------------------------------------------------------------------------|---------------------------------------------------| |------------------------------|---------------------------------------------------------------------------------|---------------------------------------------------|
| `blocking` | When no new version to publish, job fails, otherwise consider last release. | `false` | | `blocking` | When no new version to publish, job fails, otherwise consider last release. | `false` |
| `container_registry_api_url` | URL of the API to retrieve the container registry. | `https://registry.hub.docker.com/v2/repositories` | | `container_registry_api_url` | URL of the API to retrieve the container registry. | `https://registry.hub.docker.com/v2/repositories` |
| `image_name` | **Mandatory** Image name on Container Registry. Should be "<org\|user>/\<repo>". | `""` | | `image_name` | **Mandatory** Image name on Container Registry. https://regex101.com/r/f0jdQS/1 | `""` |
| `package_index_api_url` | URL of the API to retrieve the package index. | `https://pypi.org/pypi` | | `package_index_api_url` | URL of the API to retrieve the package index. | `https://pypi.org/pypi` |
| `package_name` | Name of the package on Package Registry. | `$CI_PROJECT_NAME` | | `package_name` | Name of the package on Package Registry. | `$CI_PROJECT_NAME` |
| `sort_cmd` | The command to sort the versions. | `sort -V` | | `sort_cmd` | Command to sort versions. | `sort -V` |
| `stage` | Stage of the job. | `build` | | `stage` | Stage of the job. | `build` |
| `tags` | Image tags to consider as already built. Used to exclude specific versions. | `""` | | `tag-exclude` | Image tags to consider as already built. Used to exclude specific versions. | `""` |
## Variables ## Variables
You can further customize the job by overriding the following variables: You can further customize the job by overriding the following variables:
| Name | Description | Default | | Name | Description | Default |
|------------------------------|----------------------------------------------------------------------------------|---------------------------------------------------| |------------------------------|---------------------------------------------------------------------------------|--------------------------------------------|
| `BLOCKING` | When no new version to publish, job fails, otherwise consider last release. | `false` | | `BLOCKING` | When no new version to publish, job fails, otherwise consider last release. | `$[[ inputs.blocking ]]` |
| `CONTAINER_REGISTRY_API_URL` | URL of the API to retrieve the container registry. | `https://registry.hub.docker.com/v2/repositories` | | `CONTAINER_REGISTRY_API_URL` | URL of the API to retrieve the container registry. | `$[[ inputs.container-registry-api-url ]]` |
| `IMAGE_NAME` | **Mandatory** Image name on Container Registry. Should be "<org\|user>/\<repo>". | `$[[ inputs.image_name ]]` | | `IMAGE_NAME` | **Mandatory** Image name on Container Registry. https://regex101.com/r/f0jdQS/1 | `$[[ inputs.image-name ]]` |
| `PACKAGE_INDEX_API_URL` | URL of the API to retrieve the package index. | `$[[ inputs.package_index_api_url ]]` | | `PACKAGE_INDEX_API_URL` | URL of the API to retrieve the package index. | `$[[ inputs.package-index-api-url ]]` |
| `PACKAGE_NAME` | Name of the package on Package Registry. | `$[[ inputs.package_name ]]` | | `PACKAGE_NAME` | Name of the package on Package Registry. | `$[[ inputs.package-name ]]` |
| `SORT_CMD` | The command to sort the versions. | `sort -V` | | `SORT_CMD` | The command to sort the versions. | `$[[ inputs.sort-cmd ]]` |
| `TAGS` | Image tags to consider as already built. Used to exclude specific versions. | `""` | | `TAG_EXCLUDE` | Image tags to consider as already built. Used to exclude specific versions. | `$[[ inputs.tags ]]` |
...@@ -4,21 +4,25 @@ spec: ...@@ -4,21 +4,25 @@ spec:
description: When no new version to publish, job fails, otherwise consider last release. description: When no new version to publish, job fails, otherwise consider last release.
type: boolean type: boolean
default: false default: false
container_registry_api_url: container-registry-api-url:
description: URL of the API to retrieve the container registry. description: URL of the API to retrieve the container registry.
default: https://registry.hub.docker.com/v2/repositories default: https://registry.hub.docker.com/v2/repositories
image_name: image-name:
description: Image name on Container Registry. Should be "<org|user>/<repo>". description: Image name on Container Registry. Should be "<org|user>/<repo>".
package_index_api_url: regex: ^(?<image>[a-z0-9.\-_]+(?:/[a-z0-9.\-_]+|))(:(?<tag>[\w.\-_]{1,127})|)$
package-index-api-url:
description: URL of the API to retrieve the package index. description: URL of the API to retrieve the package index.
default: https://pypi.org/pypi default: https://pypi.org/pypi
package_name: package-name:
description: Name of the package on Package Registry. description: Name of the package on Package Registry.
default: $CI_PROJECT_NAME default: $CI_PROJECT_NAME
sort-cmd:
description: Command to sort versions.
default: sort -V
stage: stage:
description: Stage of the job. description: Stage of the job.
default: build default: build
tags: tag-exclude:
description: Image Tags to consider as already built. Used to exclude specific versions. description: Image Tags to consider as already built. Used to exclude specific versions.
default: "" default: ""
...@@ -28,12 +32,12 @@ pypi-to-docker-missing-version: ...@@ -28,12 +32,12 @@ pypi-to-docker-missing-version:
image: alpine:3.21.3 image: alpine:3.21.3
variables: variables:
BLOCKING: $[[ inputs.blocking ]] BLOCKING: $[[ inputs.blocking ]]
CONTAINER_REGISTRY_API_URL: $[[ inputs.container_registry_api_url ]] CONTAINER_REGISTRY_API_URL: $[[ inputs.container-registry-api-url ]]
IMAGE_NAME: $[[ inputs.image_name ]] IMAGE_NAME: $[[ inputs.image-name ]]
PACKAGE_INDEX_API_URL: $[[ inputs.package_index_api_url ]] PACKAGE_INDEX_API_URL: $[[ inputs.package-index-api-url ]]
PACKAGE_NAME: $[[ inputs.package_name ]] PACKAGE_NAME: $[[ inputs.package-name ]]
SORT_CMD: sort -V SORT_CMD: $[[ inputs.sort-cmd ]]
TAGS: $[[ inputs.tags ]] TAG_EXCLUDE: $[[ inputs.tag-exclude ]]
script: script:
#!/bin/bash #!/bin/bash
- apk update - apk update
...@@ -49,13 +53,13 @@ pypi-to-docker-missing-version: ...@@ -49,13 +53,13 @@ pypi-to-docker-missing-version:
- if [ "$(echo "$docker_response" | jq -r '.results | length')" -eq 0 ]; then - if [ "$(echo "$docker_response" | jq -r '.results | length')" -eq 0 ]; then
- break - break
- fi - fi
- TAGS="$TAGS $(echo "$docker_response" | jq -r '.results[].name')" - TAG_EXCLUDE="$TAG_EXCLUDE $(echo "$docker_response" | jq -r '.results[].name')"
- docker_url=$(echo "$docker_response" | jq -r '.next') - docker_url=$(echo "$docker_response" | jq -r '.next')
- if [ "$docker_url" = "null" ]; then - if [ "$docker_url" = "null" ]; then
- docker_url="" - docker_url=""
- fi - fi
- done - done
- echo "tags on docker=$TAGS" - echo "tags on docker=$TAG_EXCLUDE"
# pypi # pypi
- pypi_url="$PACKAGE_INDEX_API_URL/$PACKAGE_NAME/json" - pypi_url="$PACKAGE_INDEX_API_URL/$PACKAGE_NAME/json"
...@@ -68,7 +72,7 @@ pypi-to-docker-missing-version: ...@@ -68,7 +72,7 @@ pypi-to-docker-missing-version:
# find missing releases # find missing releases
- missing_releases="" - missing_releases=""
- eval 'for release in $pypi_releases; do found=0; for tag in $TAGS; do if [ "$release" = "$tag" ]; then found=1; break; fi; done; if [ $found -eq 0 ]; then missing_releases="$missing_releases $release"; fi; done' - eval 'for release in $pypi_releases; do found=0; for tag in $TAG_EXCLUDE; do if [ "$release" = "$tag" ]; then found=1; break; fi; done; if [ $found -eq 0 ]; then missing_releases="$missing_releases $release"; fi; done'
- missing_releases=$(echo $missing_releases) - missing_releases=$(echo $missing_releases)
- echo "missing tags=$missing_releases" - echo "missing tags=$missing_releases"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment