aboutsummaryrefslogtreecommitdiff
path: root/ci-dockerfiles-base.yaml
blob: ab481e76f11778a2341138858efc3234bdf94c4a (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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
- job:
    name: ci-dockerfiles-base
    project-type: freestyle
    defaults: global
    properties:
        - authorization:
            anonymous:
                - job-discover
            linaro:
                - job-read
                - job-extended-read
        - build-discarder:
            days-to-keep: 90
            num-to-keep: 200
    disabled: false
    node: build-arm64
    display-name: 'CI Dockerfiles build/publish base images'
    scm:
        - git:
            url: https://git.linaro.org/ci/dockerfiles.git
            refspec: +refs/heads/master:refs/remotes/origin/master
            name: origin
            branches:
                - refs/heads/master
            skip-tag: true
            shallow-clone: true
            wipe-workspace: false
    wrappers:
        - timestamps
        - build-name:
            name: '#${BUILD_NUMBER}-${GIT_REVISION,length=8}'
        - copy-to-slave:
            includes:
                - config.json
            relative-to: 'somewhereElse'
        - credentials-binding:
            - text:
                credential-id: DOCKER_AUTH
                variable: DOCKER_AUTH
    builders:
        - shell: |
            #!/bin/bash

            set -e

            trap cleanup_exit INT TERM EXIT

            cleanup_exit()
            {
                rm -rf ${HOME}/.docker
            }

            mkdir -p ${HOME}/.docker
            sed -e "s|\${DOCKER_AUTH}|${DOCKER_AUTH}|" < ${WORKSPACE}/config.json > ${HOME}/.docker/config.json
            chmod 0600 ${HOME}/.docker/config.json

            # FIXME: include all the variants (centos, fedora, etc...)
            for arch in arm64 armhf; do
              for distro in debian ubuntu; do
                if [ "${distro}" == "debian" ]; then
                  suite=stretch
                  mirror=http://deb.debian.org/debian
                fi
                if [ "${distro}" == "ubuntu" ]; then
                  suite=xenial
                  mirror=http://ports.ubuntu.com
                fi
                sudo debootstrap --arch=${arch} --variant=minbase ${suite} base-${arch}-${distro}-${suite} ${mirror}
                sudo rm -rf base-arm*/var/lib/apt/lists/* base-arm*/tmp/* base-arm*/var/tmp/*
                sudo tar -C base-${arch}-${distro}-${suite} -c . | docker import - linaro/base-${arch}-${distro}:${suite}
                sudo rm -rf base-${arch}-${distro}-${suite}
                docker push linaro/base-${arch}-${distro}:${suite}
              done
            done