Commit 993cd4d4 authored by nimrod's avatar nimrod
Browse files

CI templates.

- Use the containerfiles templates.
- The repo was renamed as part of a refactor.
parent 8a902ac3
Loading
Loading
Loading
Loading
Loading
+15 −54
Original line number Diff line number Diff line
---
include:
  - project: shore/ci-templates
  - project: shore/ci-stuff
    file: templates/pre-commit.yml
  - project: shore/ci-templates
  - project: shore/ci-stuff
    file: templates/notify.yml

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

# Job templates:

.build:
  stage: build
  variables:
    DOCKER_BUILDKIT: "1"
  tags: &tags [ns4.shore.co.il]
  script:
    - docker build --pull --no-cache --iidfile iid "$CONTEXT"
  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:
        - $CONTEXT/*
        - $CONTEXT/**/*

.push:
  stage: deploy
  tags: *tags
  script:
    - docker tag "$HASH" "registry.shore.co.il/$IMAGE:${TAG:-latest}"
    - docker push "registry.shore.co.il/$IMAGE:${TAG:-latest}"
  rules: *rules
  - project: shore/ci-stuff
    file: templates/containerfiles.yml

# cgit image:

build-cgit:
  extends: .build
  extends: .container-build
  variables:
    CONTEXT: cgit

push-cgit:
  extends: .push
  extends: .container-push
  variables:
    CONTEXT: cgit
    IMAGE: cgit
@@ -65,12 +26,12 @@ push-cgit:
# httpd latest image:

build-httpd:
  extends: .build
  extends: .container-build
  variables:
    CONTEXT: httpd/buster

push-httpd:
  extends: .push
  extends: .container-push
  variables:
    CONTEXT: httpd/buster
    IMAGE: httpd
@@ -81,7 +42,7 @@ push-httpd:
# httpd buster image:

push-httpd-buster:
  extends: .push
  extends: .container-push
  variables:
    CONTEXT: httpd/buster
    IMAGE: httpd
@@ -93,12 +54,12 @@ push-httpd-buster:
# httpd bullseye image:

build-httpd-bullseye:
  extends: .build
  extends: .container-build
  variables:
    CONTEXT: httpd/bullseye

push-httpd-bullseye:
  extends: .push
  extends: .container-push
  variables:
    CONTEXT: httpd/bullseye
    IMAGE: httpd
@@ -110,13 +71,13 @@ push-httpd-bullseye:
# sshd image:

build-sshd:
  extends: .build
  extends: .container-build
  variables:
    CONTEXT: sshd
    DOCKER_BUILDKIT: ""

push-sshd:
  extends: .push
  extends: .container-push
  variables:
    CONTEXT: sshd
    IMAGE: sshd
@@ -127,12 +88,12 @@ push-sshd:
# crond image:

build-crond:
  extends: .build
  extends: .container-build
  variables:
    CONTEXT: crond

push-crond:
  extends: .push
  extends: .container-push
  variables:
    CONTEXT: crond
    IMAGE: cron