summaryrefslogtreecommitdiff
path: root/.gitlab-ci.yml
blob: f652404b503f7cc223579616a6c6a785ab6b065a (plain)
1
2
3
4
5
6
7
8
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
image: docker:19.03.12

stages:
  - build-stage1
  - build-stage2

variables:
  BASE_IMAGE_FOR_DUE: $CI_REGISTRY_IMAGE:base_image_for_due
  DUE_IMAGE_FOR_ONIE: $CI_REGISTRY_IMAGE:due_image_for_onie
  DOCKER_HOST: unix:///run/docker.sock

before_script:
  - env | sort
  - docker info
  - docker login -u gitlab-ci-token -p $CI_JOB_TOKEN $CI_REGISTRY

base_image_for_due:
  stage: build-stage1
  script:
    - docker build -f Dockerfile -t $BASE_IMAGE_FOR_DUE .
    - docker push $BASE_IMAGE_FOR_DUE
  tags:
    - internal-runner

due_image_for_onie:
  image: $BASE_IMAGE_FOR_DUE
  stage: build-stage2
  script:
    - tar -zxvf /tmp/DUE-4.0.1.tar.gz -C /root/
    - :> /root/DUE-4.0.1/templates/onie/filesystem/etc/apt/sources.list.d/stretch-backports.list
    - cd /root/DUE-4.0.1/ && ./due --create --clean
    - cd /root/DUE-4.0.1/ && ./due --create --platform linux/amd64 --name onie-build-debian-10 --prompt ONIE-10 --tag onie --use-template onie --from debian:10 --description "ONIE Build Debian 10"
    - docker images -a
    - docker tag due-onie-build-debian-10:onie git.mesalab.cn:7443/mesa_platform/build-env:due_image_for_onie
    - docker push git.mesalab.cn:7443/mesa_platform/build-env:due_image_for_onie
  tags:
    - internal-runner