# variables in the GitLab CI/CD variables:
  #   GITLAB_TOKEN to support the semantic-release
  #   DOCKER_AUTH_CONFIG to support the usage of private docker images as job docker image
  #   TMPL_RELEASE_ENABLED to enable the semantic-release job
  #   TBC_NAMESPACE: smartdatalab/public/ci-cd-components

include:
  - component: $CI_SERVER_FQDN/$TBC_NAMESPACE/gitlab-ci/extract@master
    inputs:
      extract-script-job-tags: ["docker"]
  - component: $CI_SERVER_FQDN/$TBC_NAMESPACE/gitlab-ci/validation@master
    inputs:
      check-links-job-tags: ["docker"]
      tbc-check-job-tags: ["docker"]
      tbc-check-image: cicd-docker-dev.artifact.tecnalia.dev/tbc-check:master
      gitlab-ci-lint-job-tags: ["docker"]
  - component: $CI_SERVER_FQDN/$TBC_NAMESPACE/kicker/validation@master
    inputs:
      kicker-validation-job-tags: ["docker"]
      schema-base-url: "https://git.code.tecnalia.dev/api/v4/projects/smartdatalab%2Fpublic%2Fci-cd-components%2Fkicker/repository/files"
  - component: $CI_SERVER_FQDN/$TBC_NAMESPACE/bash/gitlab-ci-bash@master
    inputs:
      bash-shellcheck-job-tags: ["docker"]
      shellcheck-files: "*.sh"
  - component: $CI_SERVER_FQDN/$TBC_NAMESPACE/gitleaks/gitlab-ci-gitleaks@master
    inputs:
      gitleaks-job-tags: ["docker"]
  - local: "templates/gitlab-ci-semrel.yml"

variables:
  GITLAB_CI_FILES: "templates/gitlab-ci-semrel.yml"
  GIT_STRATEGY: clone

semantic-release:
  rules:
    # on production branch(es): auto if SEMREL_AUTO_RELEASE_ENABLED
    - if: '$TMPL_RELEASE_ENABLED == "true" && $CI_COMMIT_REF_NAME =~ $PROD_REF'
  tags: ["docker"]