Poetry not working with alpine
Describe the bug
The template does not work with poetry and python-alpine image.
Expected behavior
Jobs works like with a debian image.
Actual behavior
All commands launched with _run function does not use poetry run.
Logs and/or screenshots
Using PYTHON_IMAGE: "dockerproxy.repos.tech.orange/python:3.12.6-alpine" and latest version of the tempalte, I add a small job in my pipeline :
py-debug:
extends: .python-base
stage: build
script:
- install_requirements
- echo $PYTHON_BUILD_SYSTEM
- |
if [[ "$PYTHON_BUILD_SYSTEM" == poetry* ]]
then
log_info "--- poetry"
else
log_info "--- Without poetry"
fi
- |
if [[ "$PYTHON_BUILD_SYSTEM" =~ ^poetry.* ]]
then
log_info "--- poetry2"
else
log_info "--- Without poetry2"
fi
- _run --version
The first if is the condition used in _run fonction
The second one is the condition used in maybe_install_poetry function
The result log is :
$ echo $PYTHON_BUILD_SYSTEM
poetry
$ if [[ "$PYTHON_BUILD_SYSTEM" == poetry* ]]
then
log_info "--- poetry"
else
log_info "--- Without poetry"
fi
[INFO] --- Without poetry
$ if [[ "$PYTHON_BUILD_SYSTEM" =~ ^poetry.* ]]
then
log_info "--- poetry2"
else
log_info "--- Without poetry2"
fi
[INFO] --- poetry2
$ _run --version
[INFO] --- Without poetry run "--version"
The first condition does not permit to detect poetry.
Context & Configuration
Link to a project, pipeline or job facing the bug: https://gitlab.com/sthiriet/test-tbc-python/-/jobs/7907900287
The issue was reproduced using:
- Version of the template: latest
- GitLab server(s): A self-managed server : CE : v16.11.10
- GitLab runner(s): Kubernetes runner.
Here is the .gitlab-ci.yml file:
# included templates
include:
- project: "to-be-continuous/python"
ref: "7.1.0"
file: "templates/gitlab-ci-python.yml"
# variables
variables:
PYTHON_PROJECT_DIR: "test-tbc"
PYTHON_BUILD_SYSTEM: poetry
PYTHON_IMAGE: "python:3.12.6-alpine"
PYLINT_ENABLED: "true"
PYLINT_ARGS: "--ignore-path tests"
PYLINT_FILES: "test-tbc"
PYTEST_ENABLED: "true"
BANDIT_ENABLED: "true"
BANDIT_ARGS: "--recursive oo_swarm_operator"
PYTHON_SBOM_OPTS: "--select-catalogers python"
# Release
PYTHON_RELEASE_ENABLED: "false"
PYTHON_RELEASE_NEXT: "patch"
py-debug:
extends: .python-base
stage: build
script:
- install_requirements
- echo $PYTHON_BUILD_SYSTEM
- |
if [[ "$PYTHON_BUILD_SYSTEM" == poetry* ]]
then
log_info "--- poetry"
else
log_info "--- Without poetry"
fi
- |
if [[ "$PYTHON_BUILD_SYSTEM" =~ ^poetry.* ]]
then
log_info "--- poetry2"
else
log_info "--- Without poetry2"
fi
- _run --version
(If useful, list configured GitLab CI project and/or group variables.)
Configured GitLab CI project or group variables:
- N/A
(Finally add any possible additional useful context info here.)