Commit 036af50f authored by Thomas Boni's avatar Thomas Boni
Browse files

ci(conf): add new pipeline from r2devops playground

parent a78c2579
Loading
Loading
Loading
Loading
+66 −63
Original line number Diff line number Diff line
include:
  - project: r2devops/hub
    ref: template_release@0.4.0
    file: jobs/template_release/template_release.yml
  - project: r2devops/hub
    ref: codespell@0.2.2
    file: jobs/codespell/codespell.yml
  - project: r2devops/hub
    ref: links_checker@2.1.2
    file: jobs/links_checker/links_checker.yml

stages:
  - static_tests
  - tests
  - merge_tests
  - project_setup
  - deploy
  - .after-deploy

include:
  - remote: 'https://api.r2devops.io/job/r/gitlab/r2devops/hub/links_checker@0.2.0.yml?ignore=true.yml'
  - remote: 'https://api.r2devops.io/job/r/gitlab/r2devops/hub/codespell@0.2.1.yml?ignore=true.yml'
  - remote: 'https://api.r2devops.io/job/r/gitlab/r2devops/hub/template_release@0.2.0.yaml?ignore=true.yml'

variables:
  IMAGE_TAG_PYTHON_ALPINE: "alpine3.16"
  IMAGE_TAG_HTTPIE_ALPINE: "3.2.1"
@@ -21,7 +27,7 @@ workflow:
    - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH

ci_linter:
  stage: static_tests
  stage: tests
  image:
    name: alpine/httpie:${IMAGE_TAG_HTTPIE_ALPINE}
    entrypoint: [ "" ]
@@ -41,8 +47,7 @@ ci_linter:
    - continue
    - fi
    - echo "Start checking ${JOB_PATH} using Gitlab CI linter API"
    -   JOB=$(basename ${JOB_PATH})
      # Loop over all GitLab CI linter API URLs until one of them is working
    - JOB=$(basename ${JOB_PATH}) # Loop over all GitLab CI linter API URLs until one of them is working
    - for CI_URL in ${GITLAB_CI_LINT_URLS}; do
    - GITLAB_CI_LINT_URL="${CI_URL}${GITLAB_API_POSTFIX}"
    - if jq --null-input --arg yaml "$(cat ${JOB_PATH})" '.content=$yaml' | http --print 'b' --check-status "$GITLAB_CI_LINT_URL" Content-Type:"application/json" > ci_linter_reports/${JOB}.json; then
@@ -52,8 +57,7 @@ ci_linter:
    - echo "👎 job ${JOB_PATH} is invalid"
    - jq '.' ci_linter_reports/${JOB}.json
    - exit 1
    -       fi
          # If the API URL is working, stop the loop
    - fi # If the API URL is working, stop the loop
    - break
    - fi
    - done
@@ -71,7 +75,7 @@ ci_linter:

.job_image_scan:
  image: docker:20.10
  stage: static_tests
  stage: tests
  services:
    - name: docker:20.10-dind
      entrypoint: [ "env", "-u", "DOCKER_HOST" ]
@@ -152,7 +156,6 @@ ci_linter:
    paths:
      - "$TRIVY_CACHE_DIR"


# Extends the job_image_scan job to scan all images
# Is triggered only by the schedule
job_image_scan_schedule:
@@ -197,7 +200,7 @@ links_checker:
  allow_failure: true

codespell:
  stage: static_tests
  stage: tests
  variables:
    CODESPELL_DICTIONARY: ".codespell/dictionary.txt"
    #separate each file to ignore with a space
@@ -238,7 +241,7 @@ discord_notifier:

refresh_job_av_database:
  image: python:${IMAGE_TAG_PYTHON_ALPINE}
  stage: static_tests
  stage: tests
  variables:
    PIPENV_PIPFILE: tools/job_av/Pipfile
    PYTHONPATH: "./:${PYTHONPATH}"
@@ -264,7 +267,7 @@ refresh_job_av_database:

generate_job_av:
  image: python:${IMAGE_TAG_PYTHON_ALPINE}
  stage: static_tests
  stage: tests
  dependencies:
    - refresh_job_av_database
  variables: