Skip to content
Snippets Groups Projects
.gitlab-ci.yml 10.71 KiB
workflow:
  rules:
    - if: $CI_PIPELINE_SOURCE == "merge_request_event"
    - if: $CI_PIPELINE_SOURCE == "schedule"
    - if: $CI_COMMIT_TAG
    - if: $CI_COMMIT_REF_PROTECTED == "true"

include:
  - local: opentofu_versions.yaml
  - local: tests/unit.gitlab-ci.yml
    rules:
      - if: $SKIP_TESTS == "true"
        when: never
      - changes:
          - src/gitlab-tofu.sh
          - opentofu_versions.yaml
          - Dockerfile.*
          - .dockerignore
          - .gitlab-ci.yml
          - tests/unit.gitlab-ci.yml
          - tests/unit/*
      - if: $CI_COMMIT_TAG
  - local: tests/integration.gitlab-ci.yml
    rules:
      - if: $SKIP_TESTS == "true"
        when: never
      - changes:
          - src/gitlab-tofu.sh
          - opentofu_versions.yaml
          - Dockerfile.*
          - .dockerignore
          - .gitlab-ci.yml
          - templates/*.yml
          - tests/integration.gitlab-ci.yml
          - tests/integration-tests/*.yml
          - tests/iac/**.tf
      - if: $CI_COMMIT_TAG
  # FIXME: we cannot make this work for all use cases because of the following:
  # - cannot pass parallel.matrix to the component, thus we need to extend it
  # - that leads to a problem that when this component is ruled out, the extended job fails,
  #   because it doesn't have a script or trigger.
  #   Additionally, when this project is mirrored into another instance the component reference fails.
  #   This may be solved with https://gitlab.com/gitlab-org/gitlab/-/issues/434260#note_1776822074

  # - component: $CI_SERVER_FQDN/components/container-scanning/container-scanning@3.0
  #   inputs:
  #     stage: quality
  #     cs_image: $GITLAB_OPENTOFU_IMAGE_NAME
  #     git_strategy: fetch

stages:
  - build
  - test
  - test-integration
  - quality
  - deploy
  - sign
  - verify
  - release
  - cleanup

.image-matrix:build:
  parallel:
    matrix:
      - OPENTOFU_VERSION: !reference [.data, supported_versions]
        GITLAB_OPENTOFU_BASE_IMAGE_OS:
          - 'alpine'
          - 'debian'

.image-matrix:deploy: