.gitlab-ci.yml 4.51 KB
Newer Older
1 2 3 4 5 6 7 8
# vim: set expandtab shiftwidth=2 tabstop=8 textwidth=0:

# We can not do multi-level includes, so we need to manually include all of
# our templates here
include:
  # projects using these templates should not need to pull the bootstrap
  - local: '/bootstrap/bootstrap.yml'

9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38
  # Alpine container builder template
  # projects using this should reference this with the following:
  #
  # - project: 'wayland/ci-templates'
  #   ref: master # or git sha, see https://docs.gitlab.com/ee/ci/yaml/#includefile
  #   file: '/templates/alpine.yml'
  #
  - local: '/templates/alpine.yml'
  - local: '/alpine-ci.yml'

  # Arch container builder template
  # projects using this should reference this with the following:
  #
  # - project: 'wayland/ci-templates'
  #   ref: master # or git sha, see https://docs.gitlab.com/ee/ci/yaml/#includefile
  #   file: '/templates/arch.yml'
  #
  - local: '/templates/arch.yml'
  - local: '/arch-ci.yml'

  # Centos container builder template
  # projects using this should reference this with the following:
  #
  # - project: 'wayland/ci-templates'
  #   ref: master # or git sha, see https://docs.gitlab.com/ee/ci/yaml/#includefile
  #   file: '/templates/centos.yml'
  #
  - local: '/templates/centos.yml'
  - local: '/centos-ci.yml'

39 40 41
  # Debian container builder template
  # projects using this should reference this with the following:
  #
42
  # - project: 'wayland/ci-templates'
43 44 45 46
  #   ref: master # or git sha, see https://docs.gitlab.com/ee/ci/yaml/#includefile
  #   file: '/templates/debian.yml'
  #
  - local: '/templates/debian.yml'
47
  - local: '/debian-ci.yml'
48 49

  # Fedora container builder template
50 51 52 53 54 55
  # projects using this should reference this with the following:
  #
  # - project: 'wayland/ci-templates'
  #   ref: master # or git sha, see https://docs.gitlab.com/ee/ci/yaml/#includefile
  #   file: '/templates/fedora.yml'
  #
56
  - local: '/templates/fedora.yml'
57
  - local: '/fedora-ci.yml'
58

Benjamin Tissoires's avatar
Benjamin Tissoires committed
59
  # Ubuntu container builder template
60 61 62 63 64 65
  # projects using this should reference this with the following:
  #
  # - project: 'wayland/ci-templates'
  #   ref: master # or git sha, see https://docs.gitlab.com/ee/ci/yaml/#includefile
  #   file: '/templates/ubuntu.yml'
  #
Benjamin Tissoires's avatar
Benjamin Tissoires committed
66
  - local: '/templates/ubuntu.yml'
67
  - local: '/ubuntu-ci.yml'
Benjamin Tissoires's avatar
Benjamin Tissoires committed
68

69
variables:
70
  BOOTSTRAP_TAG: '2019-12-02'
71 72 73


stages:
74
  - sanity check
75
  - bootstrapping
76 77
  - alpine_container_build
  - alpine_check
Benjamin Tissoires's avatar
Benjamin Tissoires committed
78 79
  - arch_container_build
  - arch_check
80 81
  - centos_container_build
  - centos_check
82 83 84 85
  - debian_container_build
  - debian_check
  - fedora_container_build
  - fedora_check
86 87
  - ubuntu_container_build
  - ubuntu_check
88 89 90
  - container_push


91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108
#
# We want those to fail as early as possible, so we are reusing the current
# wayland/ci-templates/buildah:latest image
#
sanity check:
  stage: sanity check
  image: $CI_REGISTRY/wayland/ci-templates/buildah:latest
  script:
    - pip3 install --user jinja2 PyYAML
    - python3 ./src/generate_templates.py

    - git diff --exit-code && exit 0 || true

    - echo "some files were not generated through 'src/generate_templates.py' or
      have not been committed. Please edit the files under 'src', run
      'src/generate_template.py' and then commit the result"
    - exit 1

109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124

check commits:
  image: $CI_REGISTRY/wayland/ci-templates/buildah:latest
  stage: sanity check
  script:
    - pip3 install GitPython
    - pip3 install pytest
    - |
      pytest --junitxml=results.xml \
             --tb=line \
             --assert=plain \
             ./.gitlab-ci/check-commit.py
  except:
    - master@wayland/ci-templates
  variables:
    GIT_DEPTH: 100
125
    GIT_STRATEGY: clone
126 127 128 129 130
  artifacts:
    reports:
      junit: results.xml


131 132 133 134
bootstrap:
  extends: .bootstrap


135 136 137 138
bootstrap@arm64v8:
  extends: .bootstrap@arm64v8


139 140 141 142 143 144 145 146 147 148 149 150
#
# Everything went fine if this is run, we can promote the latest bootstrap
# tag as latest
#
bootstrap-push@push:
  stage: container_push
  image: $CI_REGISTRY_IMAGE/buildah:$BOOTSTRAP_TAG
  script:
    # log in to the registry
    - podman login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY

    # push the container image to the registry
Benjamin Tissoires's avatar
Benjamin Tissoires committed
151 152 153
    - skopeo copy --dest-creds $CI_REGISTRY_USER:$CI_REGISTRY_PASSWORD
                  docker://$CI_REGISTRY_IMAGE/${ARCH}buildah:$BOOTSTRAP_TAG
                  docker://$CI_REGISTRY_IMAGE/${ARCH}buildah:latest
154 155
  variables:
    GIT_STRATEGY: none
156 157 158
  only:
    refs:
      - master
159 160 161 162 163 164 165 166 167


bootstrap-push@arm64v8:
  extends: bootstrap-push@push
  image: $CI_REGISTRY_IMAGE/arm64v8/buildah:$BOOTSTRAP_TAG
  before_script:
    - export ARCH="arm64v8/"
  tags:
    - aarch64
168 169
  only:
    refs:
170
      - master