Commit 0ef14ef4 authored by Elisabetta Giani's avatar Elisabetta Giani
Browse files

Split CI/CD pipeline linting stage for branches and tags.

parent 9cb52326
Loading
Loading
Loading
Loading
Loading
+38 −2
Original line number Diff line number Diff line
@@ -98,7 +98,8 @@ integration:csp-lmc-mid:
    - pwd
    - make uninstall-chart

# linting stage
#
# linting stage for branches
#
linting:csp-lmc-mid:
  image: nexus.engageska-portugal.pt/ska-docker/ska-python-buildenv:latest
@@ -109,20 +110,55 @@ linting:csp-lmc-mid:
    paths:
      - ./$BUILD_PATH/build/
  dependencies: []
  before_script:
  - cd $COMMON_PATH
  - export COMMON_VER=$(python3 setup.py --version)
  - echo $COMMON_VER
  - cd ..
  script:
    - apt-get -y update
    - apt-get install -y python3-pip python3-setuptools python3-wheel --no-install-recommends
    - python3 -m  pip install pylint2junit
    - cd $BUILD_PATH  
    - python3 -m pip install --extra-index-url https://nexus.engageska-portugal.pt/repository/pypi/simple -r requirements.txt
    - python3 -m pip install -r requirements-gitlab.txt
    - python3 -m pip install -U --index-url https://gitlab.com/api/v4/projects/${CI_PROJECT_ID}/packages/pypi/simple csp-lmc-common=="$COMMON_VER+dev.$CI_COMMIT_SHORT_SHA"
    - mkdir -p build/reports
    - pylint --output-format=parseable csp_lmc_mid | tee ./build/csp_lmc_mid-code-analysis.stdout
    - pylint --output-format=pylint2junit.JunitReporter csp_lmc_mid > ./build/reports/csp-lmc-mid-linting.xml
    - ls -alR
  variables:
    BUILD_PATH: csp-lmc-mid
    COMMON_PATH: csp-lmc-common

#
# Linting stage executed only for tags.
# It uses the csp-lmc-common package published on Nexus
#
linting:csp-lmc-mid:
  image: nexus.engageska-portugal.pt/ska-docker/ska-python-buildenv:latest
  stage: linting
  tags:
    - k8srunner
  artifacts:
    paths:
      - ./$BUILD_PATH/build/
  dependencies: []
  script:
    - apt-get -y update
    - apt-get install -y python3-pip python3-setuptools python3-wheel --no-install-recommends
    - python3 -m  pip install pylint2junit
    - cd $BUILD_PATH  
    - python3 -m pip install --extra-index-url https://nexus.engageska-portugal.pt/repository/pypi/simple -r requirements.txt
    - mkdir -p build/reports
    - pylint --output-format=parseable csp_lmc_mid | tee ./build/csp_lmc_mid-code-analysis.stdout
    - pylint --output-format=pylint2junit.JunitReporter csp_lmc_mid > ./build/reports/csp-lmc-mid-linting.xml
    - ls -alR
  variables:
    BUILD_PATH: csp-lmc-mid
  only: 
    refs:
      - tags
#
# Publish csp-lmc-mid python package
# This stage runs only for tags.
#