|
| 1 | +# Author: Daniele Rondina, [email protected] |
| 2 | +# Description: Setup Container to compile and test simplestreams-builder code. |
| 3 | + |
| 4 | +version: "1" |
| 5 | + |
| 6 | +template_engine: |
| 7 | + engine: "mottainai" |
| 8 | + |
| 9 | +networks: |
| 10 | + - name: "mottainai0" |
| 11 | + type: "bridge" |
| 12 | + config: |
| 13 | + bridge.driver: native |
| 14 | + dns.domain: mottainai.local |
| 15 | + dns.mode: managed |
| 16 | + ipv4.address: 172.18.10.1/23 |
| 17 | + ipv4.dhcp: "true" |
| 18 | + ipv4.firewall: "true" |
| 19 | + ipv4.nat: "true" |
| 20 | + ipv6.nat: "false" |
| 21 | + ipv6.dhcp: "false" |
| 22 | + |
| 23 | +profiles: |
| 24 | + - name: net-mottainai0 |
| 25 | + description: Net mottainai0 |
| 26 | + devices: |
| 27 | + eth0: |
| 28 | + name: eth0 |
| 29 | + nictype: bridged |
| 30 | + parent: mottainai0 |
| 31 | + type: nic |
| 32 | + - name: default |
| 33 | + description: Default Storage |
| 34 | + devices: |
| 35 | + root: |
| 36 | + path: / |
| 37 | + pool: default |
| 38 | + type: disk |
| 39 | + |
| 40 | + |
| 41 | +projects: |
| 42 | + |
| 43 | + - name: "ssb-test-ubuntu" |
| 44 | + description: | |
| 45 | + Setup golang and run Simplestreams Builder Test Suite. |
| 46 | +
|
| 47 | + vars: |
| 48 | + - envs: |
| 49 | + ppa_golang_repo: ppa:longsleep/golang-backports |
| 50 | + repo_branch: "master" |
| 51 | + repo_giturl: "https://github.com/MottainaiCI/simplestreams-builder.git" |
| 52 | + |
| 53 | + groups: |
| 54 | + - name: "tests" |
| 55 | + description: "Simplestreams Builder test in Ubuntu Container" |
| 56 | + |
| 57 | + connection: "{{ .Values.connection | default "local" }}" |
| 58 | + |
| 59 | + # Define the list of LXD Profile to use |
| 60 | + # for create the containers |
| 61 | + common_profiles: |
| 62 | + - default |
| 63 | + - net-mottainai0 |
| 64 | + |
| 65 | + # Create the environment container as ephemeral or not. |
| 66 | + ephemeral: true |
| 67 | + |
| 68 | + nodes: |
| 69 | +{{ $gversions := .Values.golang_versions }} |
| 70 | +{{ range $i, $gv := $gversions }} |
| 71 | + - name: ssb-test{{ $i }} |
| 72 | + # ARM images or AMD64 |
| 73 | + image_source: "ubuntu/21.04" |
| 74 | + # By deafult it use remote images" |
| 75 | + image_remote_server: "images" |
| 76 | + |
| 77 | + entrypoint: |
| 78 | + - "/bin/bash" |
| 79 | + - "-c" |
| 80 | + |
| 81 | + labels: |
| 82 | + golang_version: "{{ $gv }}" |
| 83 | + |
| 84 | + # List of commands executed just after the creation of the |
| 85 | + # container. |
| 86 | + hooks: |
| 87 | + |
| 88 | + - event: post-node-creation |
| 89 | + commands: |
| 90 | + # DHCP seems slow |
| 91 | + - sleep 5 |
| 92 | + - echo "Testing Golang ${golang_version}" |
| 93 | + - echo "deb http://archive.ubuntu.com/ubuntu hirsute-backports main universe multiverse restricted" >> /etc/apt/sources.list |
| 94 | + - apt-get update |
| 95 | + - apt-get upgrade -y |
| 96 | + - apt-get install -y software-properties-common |
| 97 | + - apt-get update |
| 98 | + - add-apt-repository ${ppa_golang_repo} -y |
| 99 | + - apt-get update |
| 100 | + - apt-get install -y git make pip curl |
| 101 | + - apt-get install -y gcc-arm-linux-gnueabi libc6-dev-armel-cross |
| 102 | + - apt-get install -y libc6-armel-cross libc6-dev golang-${golang_version}-go |
| 103 | + - apt-get install -y libc6-dev-i386 libc6-dev-armhf-armel-cross linux-headers-generic |
| 104 | + # Fix asm/errno.h: No such file or directory on 386 build |
| 105 | + - cp --archive /usr/include/asm-generic /usr/include/asm |
| 106 | + - mkdir /gopath/src/github.com/geaaru/ -p |
| 107 | + - git clone ${repo_giturl} -b ${repo_branch} /gopath/src/github.com/MottainaiCI/simplestreams-builder/ |
| 108 | + |
| 109 | + |
| 110 | + - event: post-node-sync |
| 111 | + flags: |
| 112 | + - test |
| 113 | + commands: |
| 114 | + - | |
| 115 | + cd /gopath/src/github.com/MottainaiCI/simplestreams-builder && \ |
| 116 | + GOROOT="/usr/lib/go-${golang_version}" \ |
| 117 | + GOTOOLDIR="/usr/lib/go-${golang_version}'/pkg/tool/linux_amd64" \ |
| 118 | + GOPATH=/gopath \ |
| 119 | + GOBIN=$GOPATH/bin \ |
| 120 | + PATH=/usr/lib/go-${golang_version}/bin:$PATH:$GOBIN \ |
| 121 | + make deps |
| 122 | +
|
| 123 | + - | |
| 124 | + cd /gopath/src/github.com/MottainaiCI/simplestreams-builder && \ |
| 125 | + GOROOT="/usr/lib/go-${golang_version}" \ |
| 126 | + GOTOOLDIR="/usr/lib/${golang_version}'/pkg/tool/linux_amd64" \ |
| 127 | + GOPATH=/gopath \ |
| 128 | + GOBIN=$GOPATH/bin \ |
| 129 | + PATH=/usr/lib/go-${golang_version}/bin:$PATH:$GOBIN \ |
| 130 | + make build coverage |
| 131 | +
|
| 132 | +{{ end }} |
0 commit comments