Commit 94b947f3 authored by nimrod's avatar nimrod
Browse files

Replace ci-fairy with gitlab-ci-linter.

parent cd80d3c4
Loading
Loading
Loading
Loading
+16 −13
Original line number Diff line number Diff line
---
include:
  - local: templates/pre-commit.yml
  # yamllint disable-line rule:line-length
  - remote: https://gitlab.freedesktop.org/freedesktop/ci-templates/-/raw/master/templates/ci-fairy.yml

ci-fairy:
  extends: .fdo.ci-fairy
lint templates:
  image: registry.shore.co.il/ci-images:pre-commit
  stage: test
  before_script:
    - python3 -m pip install git+https://gitlab.com/devopshq/gitlab-ci-linter#master
    - gitlab-ci-linter --help
  script:
    # ci-fairy doesn't fail on errors, so I workaround that.
    - ./test.py
    - echo "${CI_JOB_TOKEN:-not defined}" | head -c4; echo
    - AUTHFILE="$(mktemp)"
    - echo "$CI_JOB_TOKEN" > "$AUTHFILE"
    - logfile="$(mktemp)"
    # yamllint disable rule:line-length
    - |
      for template in templates/*.yml
      for template in .gitlab-ci.yml templates/*.yml
      do
        echo "Checking $template" >&2
        ci-fairy -vvv --authfile "$AUTHFILE" lint --filename "$template" 2>&1 | tee -a "$logfile"
        gitlab-ci-linter --server "$CI_SERVER_URL" --filename "$template" || EXITCODE=1
      done
    - '! grep -q ERROR "$logfile"'
    # yamllint enable rule:line-length
    - |
      [ -z "${EXITCODE:-}" ]
  variables:
    XDG_CACHE_HOME: "$CI_PROJECT_DIR/.cache"
  cache:
    paths:
      - .cache/