Commit 838c640c authored by Ruben ten Hove's avatar Ruben ten Hove
Browse files

Merge branch 'fail-on-installation-failure' into 'main'

feat: do not allow failing python package installation by default

See merge request just-ci/templates!223
parents d112e6de 04aafd80
Loading
Loading
Loading
Loading
+13 −0
Original line number Diff line number Diff line
@@ -91,6 +91,7 @@ jobs:python:
        - python/**/*
        - pipelines/python.yml
        - tests/**/*python*.yml
        - tests/**/python/**/*

jobs:python:no-exclude:
  stage: test
@@ -117,6 +118,18 @@ jobs:python:old:
    - if: $CI_COMMIT_BRANCH != $CI_DEFAULT_BRANCH
      changes: *python_changes

jobs:python:alpine:
  stage: test
  variables:
    PYVERSION: alpine
  trigger:
    include:
      - local: tests/jobs/python.yml
    strategy: depend
  rules:
    - if: $CI_COMMIT_BRANCH != $CI_DEFAULT_BRANCH
      changes: *python_changes

jobs:python:custom-image:
  stage: test
  trigger:
+15 −5
Original line number Diff line number Diff line
@@ -8,7 +8,8 @@ variables:
  PYTHON_EXCLUDE_REGEX: (tests|setup.py|migrations)
  PIP_DISABLE_PIP_VERSION_CHECK: "true"
  PIP_ROOT_USER_ACTION: ignore
  PIP_PACKAGE_INSTALL_DEFAULT_ARGS: --no-input -qqq
  PIP_PACKAGE_INSTALL_DEFAULT_ARGS:
    --no-input -qqq --log=${CI_PROJECT_DIR}/pip-log.txt
  PIP_PACKAGE_INSTALL_EXTRA_ARGS: ""

image:
@@ -40,11 +41,20 @@ image:
  stage: test
  script:
    - |
      echo "[*] Installing your package using these arguments: ${PIP_PACKAGE_INSTALL_DEFAULT_ARGS} ${PIP_PACKAGE_INSTALL_EXTRA_ARGS}."
      pip3 --version
      pip3 install ${PIP_PACKAGE_INSTALL_DEFAULT_ARGS} ${PIP_PACKAGE_INSTALL_EXTRA_ARGS} --log=${CI_PROJECT_DIR}/pip-log.txt . || \
        (echo "[-] Failed to install your package. Will continue without installation. This may omit test results which require installation." && \
        echo "[-] To debug you can check 'pip-log.txt' in the job artifacts.")
      echo "[*] Installing your package using these arguments: ${PIP_PACKAGE_INSTALL_DEFAULT_ARGS} ${PIP_PACKAGE_INSTALL_EXTRA_ARGS}"

    - |
      pip3 install ${PIP_PACKAGE_INSTALL_DEFAULT_ARGS} ${PIP_PACKAGE_INSTALL_EXTRA_ARGS} . || \
        {
          printf "[-] Install failed. Check 'pip-log.txt' in the job artifacts for details. ";
          if [ "${PIP_ALLOW_INSTALL_FAILURE}" != "" ]; then
            echo "PIP_ALLOW_INSTALL_FAILURE is set, so we continue. This may omit test results."
          else
            echo "To continue despite failure, set PIP_ALLOW_INSTALL_FAILURE. This may omit test results."
            exit 1
          fi
        }
  artifacts:
    paths:
      - pip-log.txt
+1 −5
Original line number Diff line number Diff line
@@ -30,8 +30,4 @@ build-backend = "poetry.core.masonry.api"
version_variable = "pyproject.toml:version"

[tool.pylic]
safe_licenses = [
    "Apache Software License",
    "MIT License",
    "BSD License"
]
safe_licenses = ["Apache Software License", "MIT License", "BSD License"]