Commit f114819f authored by nimrod's avatar nimrod
Browse files

GitLab CI.

parent 36ca9436
Loading
Loading
Loading
Loading
Loading

.gitlab-ci.yml

0 → 100644
+50 −0
Original line number Diff line number Diff line
---
image: adarnimrod/ci-images:docker

stages:
  - test
  - build
  - run

pre-commit:
  stage: test
  image: adarnimrod/ci-images:pre-commit
  variables:
    XDG_CACHE_HOME: "$CI_PROJECT_DIR/.cache"
    # Disabled until https://github.com/pre-commit/pre-commit/issues/1387 is
    # resolved.
    SKIP: "hadolint,docker-compose"
  script:
    - pre-commit run --all-files
  cache:
    paths:
      - .cache/

build:
  stage: build
  tags: ["host01.shore.co.il"]
  variables:
    COMPOSE_DOCKER_CLI_BUILD: "1"
    DOCKER_BUILDKIT: "1"
  # Fix the permissions because of
  # https://gitlab.com/gitlab-org/gitlab-runner/-/issues/1736.
  before_script:
    - chmod 644 exim4/exim4.conf
  script:
    - docker-compose build --no-cache --pull
    - docker-compose pull --quiet

run:
  stage: run
  tags: ["host01.shore.co.il"]
  when: manual
  script:
    - docker-compose up --detach --remove-orphans
    # yamllint disable rule:line-length
    - |
        for i in $(seq 12)
        do
            docker container inspect --format '{{ .State.Health.Status }}' $(docker-compose ps -q) | grep -v '^healthy$' || break
            sleep 10
        done
        ! docker container inspect --format '{{ .State.Health.Status }}' $(docker-compose ps -q) | grep -v '^healthy$'
+7 −1
Original line number Diff line number Diff line
@@ -5,6 +5,7 @@ repos:
    rev: v2.3.0
    hooks:
      - id: check-added-large-files
      - id: check-executables-have-shebangs
      - id: check-merge-conflict
      - id: detect-private-key
      - id: trailing-whitespace
@@ -19,7 +20,7 @@ repos:
      - id: proselint
        types: [plain-text]
        exclude: LICENSE
  - repo: https://www.shore.co.il/git/docker-pre-commit
  - repo: https://git.shore.co.il/nimrod/docker-pre-commit.git/
    rev: v0.3.0
    hooks:
      - id: docker-compose
@@ -29,3 +30,8 @@ repos:
    hooks:
      - id: detect-secrets
        exclude: \.diff$
  - repo: https://git.shore.co.il/nimrod/shell-pre-commit.git
    rev: v0.6.0
    hooks:
      - id: shell-lint
      - id: shellcheck
+1 −1
Original line number Diff line number Diff line
@@ -16,4 +16,4 @@ This software is licensed under the MIT license (see `LICENSE.txt`).
Nimrod Adar, [contact me](mailto:nimrod@shore.co.il) or visit my [website](
https://www.shore.co.il/). Patches are welcome via [`git send-email`](
http://git-scm.com/book/en/v2/Git-Commands-Email). The repository is located
at: <https://www.shore.co.il/git/>.
at: <https://git.shore.co.il/shore/>.
+2 −2
Original line number Diff line number Diff line
@@ -25,8 +25,8 @@ RUN apt-get update && \
    rm -rf /tmp/* /var/tmp/* /var/lib/apt/lists/* /var/cache/apt/archives/*
COPY --chown=root:root entrypoint /usr/local/bin/
COPY --chown=Debian-exim:Debian-exim aliases /etc/aliases
COPY exim4.conf /etc/exim4/exim4.conf
RUN exim4 -bV
COPY --chown=root:root exim4.conf /etc/exim4/exim4.conf
RUN ls -l /etc/exim4/exim4.conf && exim4 -bV
#USER Debian-exim
WORKDIR /var/spool/exim4
ENTRYPOINT ["entrypoint"]