Commit 9998c489 authored by nimrod's avatar nimrod
Browse files

Refactor .gitlab-ci.yml.

Can't use the "host" variable as the tag. Workaround that with YAML
anchors (ugly but works).
parent 2f93d72f
Loading
Loading
Loading
Loading
Loading
+47 −20
Original line number Diff line number Diff line
@@ -20,35 +20,41 @@ pre-commit:
    paths:
      - .cache/

build:
build-host01:
  stage: build
  tags:
    - "$host"
  variables:
    - host01.shore.co.il
  variables: &build_vars
    COMPOSE_DOCKER_CLI_BUILD: "1"
    DOCKER_BUILDKIT: "1"
  script:
  script: &build_script
    - docker-compose build --no-cache --pull
    - docker-compose pull --quiet
  parallel: &parallel
    matrix:
      - host:
          - host01.shore.co.il

build-kodi:
  stage: build
  tags:
    - kodi.shore.co.il
        REGISTER_RUN_UNTAGGED: "false"
      - host:
  variables: *build_vars
  script: *build_script

build-ns4:
  stage: build
  tags:
    - ns4.shore.co.il
        REGISTER_RUN_UNTAGGED: "true"
  variables: *build_vars
  script: *build_script

run:
run-host01:
  stage: run
  tags:
    - $host
    - host01.shore.co.il
  variables:
    RUNNER_NAME: "$host"
    RUNNER_TAG_LIST: "$host"
    RUNNER_NAME: host01.shore.co.il
    RUNNER_TAG_LIST: host01.shore.co.il
    REGISTER_RUN_UNTAGGED: "false"
  when: manual
  script:
  script: &run-script
    - docker-compose up --detach --remove-orphans
    # yamllint disable rule:line-length
    - |
@@ -58,4 +64,25 @@ run:
            sleep 10
        done
        ! docker container inspect --format '{{ .State.Health.Status }}' $(docker-compose ps -q) | grep -v '^healthy$'
  parallel: *parallel

run-kodi:
  stage: run
  tags:
    - kodi.shore.co.il
  variables:
    RUNNER_NAME: kodi.shore.co.il
    RUNNER_TAG_LIST: kodi.shore.co.il
    REGISTER_RUN_UNTAGGED: "false"
  when: manual
  script: *run-script

run-ns4:
  stage: run
  tags:
    - ns4.shore.co.il
  variables:
    RUNNER_NAME: ns4.shore.co.il
    RUNNER_TAG_LIST: ns4.shore.co.il
    REGISTER_RUN_UNTAGGED: "true"
  when: manual
  script: *run-script