Skip to content
.gitlab-ci.yml 1.37 KiB
Newer Older
nimrod's avatar
nimrod committed
---
include:
  - project: shore/ci-templates
    file: templates/pre-commit.yml
nimrod's avatar
nimrod committed

stages:
  - test
  - build
  - deploy

# One day I may want to start tagging release and for that the TAG variable is
# needed, but that would mean releasing ALL of the images when tagging (sort of
# a periodic release). The images are not really related so for now TAG is
# hard-coded to latest.
variables:
  TAG: latest

nimrod's avatar
nimrod committed
# Job templates:

nimrod's avatar
nimrod committed
.build:
  stage: build
  variables:
    DOCKER_BUILDKIT: "1"
  tags: &tags [ns4.shore.co.il]
  script:
    - docker build --pull --no-cache --iidfile iid "$IMAGE"
  after_script:
    - echo "HASH=$(cat iid)" > dot.env
  artifacts:
    reports:
      dotenv: dot.env
  rules: &rules
    - if: $CI_PIPELINE_SOURCE == "schedule"
    - if: $CI_PIPELINE_SOURCE == "push"
      changes:
        - $IMAGE/*
        - $IMAGE/**/*

.push:
  stage: deploy
  tags: *tags
  script:
    - docker tag "$HASH" "registry.shore.co.il/$IMAGE:$TAG"
    - docker push "registry.shore.co.il/$IMAGE:$TAG"
  rules: *rules

nimrod's avatar
nimrod committed
# cgit image:

nimrod's avatar
nimrod committed
build-cgit:
  extends: .build
  variables:
    IMAGE: cgit

push-cgit:
  extends: .push
  variables:
    IMAGE: cgit
  needs:
    - job: build-cgit
      artifacts: true
nimrod's avatar
nimrod committed

# httpd image:

build-httpd:
  extends: .build
  variables:
    IMAGE: httpd

push-httpd:
  extends: .push
  variables:
    IMAGE: httpd
  needs:
    - job: build-httpd
      artifacts: true