Skip to content
Snippets Groups Projects
Forked from stackspin / stackspin
4651 commits behind the upstream repository.
.gitlab-ci.yml 18.59 KiB
---
include:
  - /.gitlab/ci_templates/kaniko.yml
  - /.gitlab/ci_templates/ssh_setup.yml
  - template: 'Workflows/MergeRequest-Pipelines.gitlab-ci.yml'

# Global templates and YAML anchors
# =================================
#
# Used in various stages/job definitions

# We don't use a `before_script` definition here because `extend` doesn't merge
# `before_script` but rather overwrites it.
# So we rather use [yaml anchors](https://docs.gitlab.com/ce/ci/yaml/README.html#anchors)
# here. Unfortunatly, anchors can't get included from files so we need to
# define them here.
.debug_information: &debug_information
  - |
    echo "Env vars:"
    echo
    echo "HOSTNAME:                  $HOSTNAME"
    echo "IP_ADDRESS:                $IP_ADDRESS"
    echo "Uptime:                    $(uptime)"
    echo "ANSIBLE_HOST_KEY_CHECKING: $ANSIBLE_HOST_KEY_CHECKING"
    echo "KANIKO_BUILD_IMAGENAME:    $KANIKO_BUILD_IMAGENAME"
    echo "KANIKO build image ref:    ${CI_REGISTRY_IMAGE}/${KANIKO_BUILD_IMAGENAME}:${CI_CONTAINER_TAG}"
    echo "SSH_KEY_ID:                $SSH_KEY_ID"
    echo "SHELL                      $SHELL"
    echo "CI_PROJECT_DIR:            $CI_PROJECT_DIR"

# The dotenv report requires us to report the artifacts in every job that is
# required with a `needs:` from another job.
.report_artifacts:
  artifacts:
    paths:
      - clusters
    expire_in: 1 month
    when: always
    reports:
      dotenv:
        $CLUSTER_DIR/.cluster.env

# Rules that enable the cluster to be built and are applied to most steps
# (except for application-specific steps)
.general_rules:
  rules:
    - changes:
      - .gitlab-ci.yml
      - .gitlab/ci_scripts/*
      - Dockerfile
      - ansible/**/*
      - flux/**/*
      - flux2/**/*
      - install/**/*
      - test/**/*
      - stackspin/**/*
      - requirements.txt
    - if: '$TRIGGER_JOBS =~ /enable-.*/'
    - if: '$CI_COMMIT_MESSAGE =~ /TRIGGER_JOBS=.*enable-/'
    - if: '$CI_COMMIT_BRANCH == "master"'

# app rules
#
# Define the rules when/if app specific jobs are run.
# Just add the variable RESOURCE to the job like this:
#   variables:
#     RESOURCE: "eventrouter"
# and import the templates with i.e.
#   extends: .eventrouter_rules
# .eventrouter_rules will ensure that the job is only executed: