forked from aristanetworks/eos-external-tools
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbarney.yaml
239 lines (222 loc) · 7.66 KB
/
barney.yaml
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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
---
# yamllint disable rule:line-length
generators:
go: barney.ci/golang%generator
images:
internal/bootstrap/iso-extraction-floor:
units:
- image: barney.ci/alpine%pkg/alpine-base
- image: barney.ci/alpine%pkg/wget
- image: barney.ci/alpine%network
- image: barney.ci/alpine%apk-finalizers
internal/bootstrap/base.tar.xz:
description: |
Downloading a recent-ish centos container base from the upstream
centos registry. Note that we cache this step separately for quick
development.
no-create-mountpoints: true
units:
- floor: .%internal/bootstrap/iso-extraction-floor
sources: []
build: |
arch=$(uname -m)
case "$arch" in
x86_64)
arch=x86_64
cksum=63b7ddb444b23a07cb851398c338595e410fb3fac2dd72061d0292c653e5afe6
;;
i?86)
arch=x86_64
cksum=63b7ddb444b23a07cb851398c338595e410fb3fac2dd72061d0292c653e5afe6
;;
aarch64)
arch=arm64
cksum=312a833dfe646ce5b41f362cae577df9797955b85ced96173be8e88e5ebd5990
;;
*)
>&2 echo unsupported architecture "$arch"
exit 1
;;
esac
cd /dest
wget https://cloud.centos.org/centos/9-stream/${arch}/images/CentOS-Stream-Container-Base-9-20230501.0.${arch}.tar.xz \
--output-document base.tar.xz
echo "$cksum base.tar.xz" | sha256sum -c
internal/bootstrap/extract/1:
no-create-mountpoints: true
units:
- floor: .%internal/bootstrap/iso-extraction-floor
sources: []
mappings:
/src/base: .%internal/bootstrap/base.tar.xz
build: |
tar --strip-components=1 -xf /src/base/base.tar.xz -C /dest
internal/bootstrap/extract/2:
description: |
Extract our bootstrapping environment and remove any pre-configured
yum repos. This bootstrapping environment will be centos 9 stream,
but because we will install el9 repos under /etc/yum.repos.d, the
environments that we boostrap will be el9.
no-create-mountpoints: true
units:
- floor: .%internal/bootstrap/iso-extraction-floor
sources: []
mappings:
/src/layer: .%internal/bootstrap/extract/1
build: |
tar -xf /src/layer/layer.tar -C /dest
rm /dest/etc/yum.repos.d/*
internal/bootstrap/install-rpms:
description: |
The install-rpms command accepts a list of packages and installs them
(along with dependencies) into /dest. This is useful for creating new
chroot environments with an arbitrary set of yum repos.
no-create-mountpoints: true
units:
- sources: []
build: |
mkdir -p /dest/usr/bin
chmod 555 /dest/usr/bin
echo '#!/bin/sh
dnf --assumeyes --installroot=/dest --noplugins \
--config=/etc/dnf/dnf.conf \
--setopt=cachedir=/var/cache/microdnf \
--setopt=reposdir=/etc/yum.repos.d \
--setopt=varsdir=/etc/dnf --releasever=9.1 install "$@"
' > /dest/usr/bin/install-rpms
chmod 755 /dest/usr/bin/install-rpms
internal/bootstrap/repos:
description: |
Install yum repos associated with el9 under /etc/yum.repos.d. Intended to
be used in combination with the install-rpms script.
no-create-mountpoints: true
units:
- sources: []
entry:
env:
DNF_HOST: ${eext-dnf-host.url:-https://artifactory.infra.corp.arista.io/artifactory}
build: |
export DNF_ARCH="$(arch)"
export DNF_DISTRO_REPO="alma-vault/9.1"
export DNF_EPEL9_REPO_VERSION="v20240127-1"
export DNF_EPEL9_REPO="eext-snapshots-local/epel9/${DNF_EPEL9_REPO_VERSION}/9/Everything"
mkdir -p /dest/etc/yum.repos.d
echo "[epel9-subset]
baseurl=${DNF_HOST}/${DNF_EPEL9_REPO}/${DNF_ARCH}/
enabled=1
gpgcheck=0
" > /dest/etc/yum.repos.d/eext-externaldeps.repo
echo "[BaseOS]
baseurl=${DNF_HOST}/${DNF_DISTRO_REPO}/BaseOS/${DNF_ARCH}/os/
gpgcheck=0
enabled=1
" > /dest/etc/yum.repos.d/BaseOS.repo
echo "[AppStream]
baseurl=${DNF_HOST}/${DNF_DISTRO_REPO}/AppStream/${DNF_ARCH}/os/
exclude=podman
gpgcheck=0
enabled=1
" > /dest/etc/yum.repos.d/AppStream.repo
internal/bootstrap/network:
entry:
share-net: true
mounts:
- source: /etc/resolv.conf
target: /etc/resolv.conf
options: ro,bind
internal/bootstrap:
description: |
Minimal bootstrapping environment. Do not run builds in
this directly, but instead use it to create images that
contain a specific set of dependencies.
entry:
mutables:
- /var/cache
- /var/lib/dnf
units:
- image: .%internal/bootstrap/extract/2
- image: .%internal/bootstrap/repos
- image: .%internal/bootstrap/install-rpms
- image: .%internal/bootstrap/network
base-image:
units:
- floor: .%internal/bootstrap
sources: []
build: install-rpms autoconf automake coreutils git rpm rpmdevtools rpm-build make mock python3-devel quilt
go-binaries:
description: |
This image is a copy of .%go/static, but with /usr/bin
permissions changed to 0555, so that it can combine properly
with redhat-style images.
units:
- mappings:
/src/static: .%go/static
build: |
mkdir -p /dest/usr
cp -a /src/static/usr/bin /dest/usr/bin
chmod 555 /dest/usr/bin
eext:
units:
- image: .%base-image
- image: .%go-binaries
- build: |
mkdir -p $DESTDIR/usr/share/eext
cp -a ./configfiles/* $DESTDIR/usr/share/eext
mkdir -p $DESTDIR/etc/pki/eext
cp -a ./pki/* $DESTDIR/etc/pki/eext
mkdir -p $DESTDIR/etc
touch $DESTDIR/etc/resolv.conf
entry:
mutables: &eext-mutables
- /var/eext
- /var/cache
- /var/lib/mock
- /var/lib/rpm
- /var/tmp
mounts:
- source: /etc/resolv.conf
target: /etc/resolv.conf
options: ro,bind
# We need access to artifactory.infra.corp.arista.io
# to make mock work
share-net: true
eext-testfloor:
units:
- image: .%go/modules
- build: |
mkdir -p /dest/var/cache/go
mkdir -p /dest/var/ext
- floor: .%internal/bootstrap
sources: []
build: |
install-rpms autoconf automake coreutils golang git rpm rpmdevtools rpm-build make mock python3-devel quilt
touch $DESTDIR/etc/resolv.conf
entry:
env:
GOCACHE: /tmp/gocache
GOMODCACHE: /go/pkg/mod
mutables: *eext-mutables
mounts:
- source: /etc/resolv.conf
target: /etc/resolv.conf
options: ro,bind
# We need access to artifactory.infra.corp.arista.io
# to make mock work
share-net: true
test/eext:
units:
- floor: .%eext-testfloor
build: |
go test code.arista.io/eos/tools/eext/dnfconfig
go test code.arista.io/eos/tools/eext/srcconfig
go test code.arista.io/eos/tools/eext/manifest
go test code.arista.io/eos/tools/eext/impl
go test code.arista.io/eos/tools/eext/cmd
go test code.arista.io/eos/tools/eext/cmd -tags privileged
go vet code.arista.io/eos/tools/eext/...
test -z "$(gofmt -l .)"
# go test runs on separate test-floor
# so validate build here
test/eext-build:
units:
- image: .%eext