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