Skip to content
.gitlab-ci.yml 3.24 KiB
Newer Older
nimrod's avatar
nimrod committed
---
include:
nimrod's avatar
nimrod committed
  # Using the local file option parameter is probably better, but it breaks the
  # pre-commit hook. This can also be better if you're working on different
  # branches but want to use the hooks from the master branch.
  # yamllint disable-line rule:line-length
nimrod's avatar
nimrod committed
  - remote: |-
      https://git.shore.co.il/shore/ci-templates/-/raw/master/templates/pre-commit.yml
  - remote: |-
      https://git.shore.co.il/shore/ci-templates/-/raw/master/templates/containerfiles.yml
nimrod's avatar
nimrod committed
  - remote: |-
      https://git.shore.co.il/shore/ci-templates/-/raw/master/templates/notify.yml
nimrod's avatar
nimrod committed

lint templates:
  image: registry.shore.co.il/ci-images:pre-commit
nimrod's avatar
nimrod committed
  stage: test
  before_script:
nimrod's avatar
nimrod committed
    # yamllint disable-line rule:line-length
nimrod's avatar
nimrod committed
    - python3 -m pip install --break-system-packages git+https://gitlab.com/devopshq/gitlab-ci-linter#v1.0.3
    - gitlab-ci-linter --help
nimrod's avatar
nimrod committed
  script:
    # yamllint disable rule:line-length
nimrod's avatar
nimrod committed
    - |
      for template in templates/*.yml
nimrod's avatar
nimrod committed
      do
        echo "Checking $template" >&2
nimrod's avatar
nimrod committed
        gitlab-ci-linter --server "$CI_SERVER_URL" --filename "$template" || EXITCODE=1
nimrod's avatar
nimrod committed
        echo
nimrod's avatar
nimrod committed
      done
      [ -z "${EXITCODE:-}" ]
nimrod's avatar
nimrod committed
    # yamllint enable rule:line-length
  variables:
    XDG_CACHE_HOME: "$CI_PROJECT_DIR/.cache"
nimrod's avatar
nimrod committed
  rules:
    - if: $CI_PIPELINE_SOURCE == "push"
      changes:
        - templates/*
  cache:
    paths:
      - .cache/
nimrod's avatar
nimrod committed

# bats image:

build-bats:
  extends: .container-build
  variables:
    CONTEXT: images/bats

push-bats:
  extends: .container-push
  variables:
nimrod's avatar
nimrod committed
    CONTEXT: images/bats
nimrod's avatar
nimrod committed
    IMAGE: ci-images
    TAG: bats
  needs:
    - job: build-bats
      artifacts: true
nimrod's avatar
nimrod committed

# docker image:

build-docker:
  extends: .container-build
  variables:
    CONTEXT: images/docker

push-docker:
  extends: .container-push
  variables:
    CONTEXT: images/docker
    IMAGE: ci-images
    TAG: docker
  needs:
    - job: build-docker
      artifacts: true
nimrod's avatar
nimrod committed

# hugo image:

build-hugo:
  extends: .container-build
  variables:
    CONTEXT: images/hugo

push-hugo:
  extends: .container-push
  variables:
    CONTEXT: images/hugo
    IMAGE: ci-images
    TAG: hugo
  needs:
    - job: build-hugo
      artifacts: true
nimrod's avatar
nimrod committed

# k8s image:

build-k8s:
  extends: .container-build
  variables:
    CONTEXT: images/k8s

push-k8s:
  extends: .container-push
  variables:
    CONTEXT: images/k8s
    IMAGE: ci-images
    TAG: k8s
  needs:
    - job: build-k8s
      artifacts: true
nimrod's avatar
nimrod committed

# pre-commit image:

build-pre-commit:
  extends: .container-build
  variables:
    CONTEXT: images/pre-commit

push-pre-commit:
  extends: .container-push
  variables:
    CONTEXT: images/pre-commit
    IMAGE: ci-images
    TAG: pre-commit
  needs:
    - job: build-pre-commit
      artifacts: true
nimrod's avatar
nimrod committed

# python3 image:

build-python3:
  extends: .container-build
  variables:
    CONTEXT: images/python3

push-python3:
  extends: .container-push
  variables:
    CONTEXT: images/python3
    IMAGE: ci-images
    TAG: python3
  needs:
    - job: build-python3
      artifacts: true
nimrod's avatar
nimrod committed

# python3-build image:

build-python3-build:
  extends: .container-build
  variables:
    CONTEXT: images/python3-build

push-python3-build:
  extends: .container-push
  variables:
    CONTEXT: images/python3-build
    IMAGE: ci-images
    TAG: python3-build
  needs:
    - job: build-python3-build
      artifacts: true