Debian Codegraph @

autotests/input/Earthfile

raw
1 # kate: hl earthfile;
2
3 VERSION --shell-out-anywhere 0.6
4
5 # BEGIN Global parameters
6 ARG DEVTOOLSET_VERSION = 11
7 ARG DEVTOOLSET = devtoolset-${DEVTOOLSET_VERSION}
8 # END Global parameters
9
10 ARG param_1 = "String w/ variable interpolation ${DEVTOOLSET}"
11 ARG param_2 = 'String w/o variable interpolation ${DEVTOOLSET}'
12 # Run shell command
13 ARG param_3 = $(echo "String w/ variable interpolation ${DEVTOOLSET}")
14
15 sample-target:
16 FROM alpine
17 ARG stage
18 COPY --if-exists files/${stage}/ /files/
19 SAVE ARTIFACT --keep-ts /files /share
20
21 repos-conf-apt:
22 ARG image
23 ARG ppa
24
25 FROM ${image}
26
27 ENV DEBIAN_FRONTEND=noninteractive
28 ENV DEBCONF_NONINTERACTIVE_SEEN=true
29
30 IF [ "${ppa}" != '' ]
31 ARG _more_cmds = add-apt-repository -y -n ppa:${ppa}/ppa
32 ELSE
33 ARG _more_cmds = :
34 END
35
36 RUN --mount type=secret,id=+secrets/repo_gpg_key,target=/run/secrets/private-archive-keyring.gpg \
37 --mount type=cache,target=/var/cache/apt/archives \
38 --mount type=cache,target=/var/lib/apt/lists \
39 set -x; \
40 debconf-set-selections /tmp/debconf-preset.txt \
41 && rm -rf /etc/apt/apt.conf.d/docker-clean \
42 && apt-get update \
43 && apt-get install -y software-properties-common \
44 && add-apt-repository --remove multiverse \
45 && gpg -v --dearmor - </run/secrets/private-archive-keyring.gpg > /usr/share/keyrings/private-archive-keyring.gpg \
46 && ${_more_cmds}
47
48 SAVE ARTIFACT /etc/apt/sources.list /sources.list
49 SAVE ARTIFACT /usr/share/keyrings/private-archive-keyring.gpg /private-archive-keyring.gpg
50
51 IF [ "${ppa}" != '' ]
52 SAVE ARTIFACT /etc/apt/sources.list.d/${ppa}*.list /sources.list.d
53 SAVE ARTIFACT /etc/apt/trusted.gpg.d/${ppa}*.gpg /trusted.gpg.d
54 END
55
56
57 APT_INSTALL:
58 COMMAND
59
60 ARG image
61 ARG packages = ''
62 ARG packages_on_hold = ''
63 ARG upgrade = 0
64 ARG clean = 0
65 ARG pm_aux_options = ''
66 ARG more_rm_files = ''
67 ARG more_cmds = :
68
69 IF [ ! -f /root/debconf-preset.txt ]
70 COPY (+repos-conf-apt/debconf-preset.txt --image=${image}) /root/debconf-preset.txt
71 ARG _debconf_cmd_cond = debconf-set-selections /root/debconf-preset.txt
72 ELSE
73 ARG _debconf_cmd_cond = :
74 END
75
76 IF [ ! -f /usr/share/keyrings/private-archive-keyring.gpg ]
77 COPY (+repos-conf-apt/private-archive-keyring.gpg --image=${image}) \
78 /usr/share/keyrings/private-archive-keyring.gpg
79 # NOTE Also copy the `sources.list` file with `multiverse` disabled!
80 COPY (+repos-conf-apt/sources.list --image=${image}) /etc/apt
81 END
82
83 # ...
84
85 MAKE_PYTHON_CI_IMAGE:
86 COMMAND
87
88 ARG image
89 ARG python = python3
90 ARG python_pkg = ${python}
91 ARG python_bin = ${python}
92 ARG python_ver = 3.11
93
94 DO +APT_INSTALL --packages="${python_pkg} git"
95
96 ARG _chroot_base = $(dirname $(cat /etc/debian_chroot))
97
98 DO ./share+IMAGE_INIT \
99 --image_description="CI image for Python projects" \
100 --debian_chroot=${_chroot_base}/python/${python_ver}/ci \
101 --storage_name=none
102
103 COPY --dir (+prep-python-ci/local --image=${image}) /usr
104
105 ENV SETUPTOOLS_USE_DISTUTILS='stdlib'
106 ENV PIP_DISABLE_PIP_VERSION_CHECK=1
107
108
109 all:
110 LOCALLY
111
112 # Primary images
113 BUILD +ci
114 BUILD +clang-ci
115 BUILD +python-ci
116
117 IF [ "${BUILD_TESTING}" -gt 0 ]
118 # Also include all tests
119 BUILD +tests
120 END
121
122 tests:
123 LOCALLY
124
125 BUILD +ci-tests
126 BUILD +clang-ci-tests
127 BUILD +python-ci-tests
128
129 ci-tests:
130 FROM +ci
131 COPY .env /
132 DO share+RUN_TESTS --VERBOSE=${VERBOSE}
133
134 clang-ci-tests:
135 FROM +clang-ci
136 COPY .env /
137 ENV EXPECT_CLANG_VERSION=${CLANG_VERSION}
138 DO share+RUN_TESTS --VERBOSE=${VERBOSE} --script=ci-tests.sh
139
140 python-ci-tests:
141 FROM +python-ci
142 COPY .env /
143 DO share+RUN_TESTS --VERBOSE=${VERBOSE}