Loading project-automation/readme.md +18 −0 Original line number Diff line number Diff line Loading @@ -30,3 +30,21 @@ variables: VARIABLE_KEY=VARIABLE_VALUE VARIABLE_KEY2=VARIABLE_VALUE2 ``` ## Version pin check To ensure versions are pinned using variables, you can extend the `.version-pinning` job to check if a variable is set. For example: ```yaml include: - remote: https://jobs.just-ci.dev/v6.28.4/project-automation/version-pin-check.yml PIN-VERSION:PYVERSION: extends: .version-pin-check rules: - if: '$I_DONT_PIN_MY_VERSIONS == null && $PYVERSION !~ /^3\.[0-9]{1,2}.*$/' ``` > Ensure the job name has the variable name after the first `:` for the message > to be correct. project-automation/version-pin-check.yml 0 → 100644 +14 −0 Original line number Diff line number Diff line --- .version-pin-check: image: docker.io/bash:latest stage: .pre variables: GIT_STRATEGY: none script: - | VAR_NAME=$(echo "${CI_JOB_NAME}" | cut -d':' -f2-) if [ "${VAR_NAME}" != "" ]; then echo "${VAR_NAME} is not pinned (correctly) and is currently set to ${!VAR_NAME}." fi - exit 1 allow_failure: true python/generic.yml +6 −16 Original line number Diff line number Diff line --- include: - local: project-automation/version-pin-check.yml variables: PYVERSION: slim PYTHON_EXCLUDE_PATHS: tests,setup.py,migrations Loading Loading @@ -47,20 +50,7 @@ image: - pip-log.txt when: always python:PIN-VERSION: image: docker.io/alpine:latest stage: .pre variables: GIT_STRATEGY: none script: - | echo "PYVERSION is set to '${PYVERSION}'. You should pin your python version for these jobs based on the python version chosen for your package." echo "For example 'PYVERSION: 3.10-slim'" echo "You can disable this warning by setting the variable I_DONT_PIN_MY_VERSIONS." - exit 1 allow_failure: true PIN-VERSION:PYVERSION: extends: .version-pin-check rules: - if: '$I_DONT_PIN_MY_VERSIONS == null && $PYVERSION !~ /^3\.[0-9]{1,2}.*$/' - if: $PYVERSION !~ /^3\.[0-9]{1,2}.*$/ Loading
project-automation/readme.md +18 −0 Original line number Diff line number Diff line Loading @@ -30,3 +30,21 @@ variables: VARIABLE_KEY=VARIABLE_VALUE VARIABLE_KEY2=VARIABLE_VALUE2 ``` ## Version pin check To ensure versions are pinned using variables, you can extend the `.version-pinning` job to check if a variable is set. For example: ```yaml include: - remote: https://jobs.just-ci.dev/v6.28.4/project-automation/version-pin-check.yml PIN-VERSION:PYVERSION: extends: .version-pin-check rules: - if: '$I_DONT_PIN_MY_VERSIONS == null && $PYVERSION !~ /^3\.[0-9]{1,2}.*$/' ``` > Ensure the job name has the variable name after the first `:` for the message > to be correct.
project-automation/version-pin-check.yml 0 → 100644 +14 −0 Original line number Diff line number Diff line --- .version-pin-check: image: docker.io/bash:latest stage: .pre variables: GIT_STRATEGY: none script: - | VAR_NAME=$(echo "${CI_JOB_NAME}" | cut -d':' -f2-) if [ "${VAR_NAME}" != "" ]; then echo "${VAR_NAME} is not pinned (correctly) and is currently set to ${!VAR_NAME}." fi - exit 1 allow_failure: true
python/generic.yml +6 −16 Original line number Diff line number Diff line --- include: - local: project-automation/version-pin-check.yml variables: PYVERSION: slim PYTHON_EXCLUDE_PATHS: tests,setup.py,migrations Loading Loading @@ -47,20 +50,7 @@ image: - pip-log.txt when: always python:PIN-VERSION: image: docker.io/alpine:latest stage: .pre variables: GIT_STRATEGY: none script: - | echo "PYVERSION is set to '${PYVERSION}'. You should pin your python version for these jobs based on the python version chosen for your package." echo "For example 'PYVERSION: 3.10-slim'" echo "You can disable this warning by setting the variable I_DONT_PIN_MY_VERSIONS." - exit 1 allow_failure: true PIN-VERSION:PYVERSION: extends: .version-pin-check rules: - if: '$I_DONT_PIN_MY_VERSIONS == null && $PYVERSION !~ /^3\.[0-9]{1,2}.*$/' - if: $PYVERSION !~ /^3\.[0-9]{1,2}.*$/