.gitlab-ci.yml 1.24 KB
Newer Older
tr's avatar
tr committed
1
---
tr's avatar
tr committed
2
3
4
5
6
7
8
image:
  name: "registry.code.immerda.ch/netlab/apps/base/centos-stream:8"

include:
  - project: 'netlab/apps/base'
    file: '/gitlab-ci.buildah.yml'

tr's avatar
tr committed
9
10
11
12
13
stages:
  - build
  - test
  - deploy

tr's avatar
tr committed
14
Build Image:
tr's avatar
tr committed
15
16
  stage: build
  tags:
tr's avatar
tr committed
17
    - buildah
tr's avatar
tr committed
18
  script:
tr's avatar
tr committed
19
    - buildah bud --isolation=chroot --format docker -f Dockerfile -t "${CI_PROJECT_NAME,,}:$CI_COMMIT_SHORT_SHA"
tr's avatar
tr committed
20
21
22
23
    - skopeo copy
          --authfile ./cred.json
          "containers-storage:localhost/${CI_PROJECT_NAME,,}:$CI_COMMIT_SHORT_SHA"
          "docker://$CI_REGISTRY_IMAGE:$CI_COMMIT_REF_NAME"
tr's avatar
tr committed
24

tr's avatar
tr committed
25
Test Image:
tr's avatar
tr committed
26
27
  stage: test
  tags:
tr's avatar
tr committed
28
    - container
tr's avatar
tr committed
29
30
  image:
    name: "$CI_REGISTRY_IMAGE:$CI_COMMIT_REF_NAME"
tr's avatar
tr committed
31
32
    entrypoint: [""]
  before_script: []
tr's avatar
tr committed
33
  script:
tr's avatar
tr committed
34
    - echo "Image $CI_JOB_IMAGE"
tr's avatar
tr committed
35
    - touch /etc/modsecurity/rules/site-rules.conf
tr's avatar
tr committed
36
37
    - nginx -t 2>&1 | grep ModSecurity-nginx
    - test -x /usr/local/bin/modsec-rules-check
tr's avatar
tr committed
38
    - test -f /etc/modsecurity/coreruleset/crs-setup.conf
tr's avatar
tr committed
39

tr's avatar
tr committed
40
Deploy Image:
tr's avatar
tr committed
41
42
  stage: deploy
  tags:
tr's avatar
tr committed
43
    - container
tr's avatar
tr committed
44
45
46
  rules:
    - if: '$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH'
  script:
tr's avatar
tr committed
47
48
49
50
    - skopeo copy
          --authfile ./cred.json
          "docker://$CI_REGISTRY_IMAGE:$CI_COMMIT_REF_NAME"
          "docker://$CI_REGISTRY_IMAGE:latest"
tr's avatar
tr committed
51
52

# vim: set ts=2 sw=2 :