Commit a12dd6ba authored by Thomas Boni's avatar Thomas Boni
Browse files

Resolve "[job][lighthouse] image version isn't fixed"

parent e5e57ba4
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -5,3 +5,4 @@ docs/images/jobs
**/.DS_Store
.idea
default_logfile.log
log
+2 −2
Original line number Diff line number Diff line
@@ -10,7 +10,7 @@ include:
  - remote: 'https://jobs.r2devops.io/0.1.0/spell_check.yml?scope=0.yml'
  - remote: 'https://jobs.r2devops.io/1.4.0/mkdocs.yml?scope=0.yml'
  - remote: 'https://jobs.r2devops.io/0.3.0/pages.yml?scope=0.yml'
    #  - remote: 'https://jobs.r2devops.io/lighthouse.yml?scope=0.yml'
  - remote: 'https://jobs.r2devops.io/lighthouse.yml?scope=0.yml'

ci_linter:
  stage: static_tests
@@ -194,7 +194,7 @@ mkdocs:
  artifacts:
    paths:
      - "${JOB_LOGFILE}"
      - "$MKDOCS_OUTPUT_PATH"
      - "website_build/"

# See https://docs.gitlab.com/ee/api/releases/
# We can only control the link to the hub, the release is still storing the source code
+2 −2
Original line number Diff line number Diff line
@@ -5,9 +5,9 @@ icon: 🗽
maintainer: Protocole
license: MIT
images:
  "justinribeiro/lighthouse": "latest"
  "justinribeiro/lighthouse": "@sha256:4a9673d77d8480f2d641b8e4e5845897ea1f9b368eb92862321cafcc7f897c82"
tools:
  "lighthouse": "latest"
  "lighthouse": ""
labels:
  - GitLab
  - Testing
+12 −13
Original line number Diff line number Diff line
@@ -2,7 +2,7 @@ stages:
  - dynamic_tests

lighthouse:
  image: justinribeiro/lighthouse
  image: justinribeiro/lighthouse@sha256:4a9673d77d8480f2d641b8e4e5845897ea1f9b368eb92862321cafcc7f897c82
  stage: dynamic_tests
  variables:
    LIGHTHOUSE_TARGET: ""
@@ -11,22 +11,21 @@ lighthouse:
    OUTPUT_LOCALE: "en"
    ADDITIONAL_OPTIONS: ""
    PAGES_PATH: "website_build/"
    SERVE_VERSION: "11.3.2"
  script:
    # Put in full lowercase OUTPUT_FORMAT to avoid problems
    - export OUTPUT_FORMAT=$(echo ${OUTPUT_FORMAT} | tr '[:upper:]' '[:lower:]')
    - export ADDITIONAL_OPTIONS="--output ${OUTPUT_FORMAT} --output-path ${OUTPUT_NAME}.${OUTPUT_FORMAT} ${ADDITIONAL_OPTIONS}"
    - export ADDITIONAL_OPTIONS="--locale ${OUTPUT_LOCALE} ${ADDITIONAL_OPTIONS}"
    - |
      if [ -z ${LIGHTHOUSE_TARGET} ]; then
        if [ ! -d ${PAGES_PATH} ]; then
          echo "[ERROR] Variable LIGHTHOUSE_TARGET must be filled, see https://r2devops.io/jobs/dynamic_tests/lighthouse/"
          exit 1
        fi

        npm install serve
        npx serve ${PAGES_PATH} &
        export LIGHTHOUSE_TARGET="http://localhost:5000"
      fi
    - if [ -z ${LIGHTHOUSE_TARGET} ]; then
    -   if [ ! -d ${PAGES_PATH} ]; then
    -     echo "[ERROR] Variable LIGHTHOUSE_TARGET must be filled, see https://r2devops.io/jobs/dynamic_tests/lighthouse/"
    -     exit 1
    -   fi
    -   npm install serve@${SERVE_VERSION}
    -   npx serve ${PAGES_PATH} &
    -   export LIGHTHOUSE_TARGET="http://localhost:5000"
    - fi
    - lighthouse ${ADDITIONAL_OPTIONS} --chrome-flags="--headless --disable-gpu" ${LIGHTHOUSE_TARGET}
  artifacts:
    paths:
+2 −0
Original line number Diff line number Diff line
* Set a fixed version for docker image
* Set a fixed version for `serve` tool installed in plug-and-play part of the job
Loading