Skip to content

Commit 01efa77

Browse files
authored
MONGOCRYPT-747 Use less Artifactory for Earthly images (#987)
Prefer unqualified images. This may enable environment-specific registry settings. Authenticate in "earthly" function
1 parent 1e96c28 commit 01efa77

File tree

3 files changed

+20
-24
lines changed

3 files changed

+20
-24
lines changed

.evergreen/config.yml

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -383,10 +383,7 @@ functions:
383383
script: |
384384
# Authenticate to artifactory.
385385
echo "${artifactory_password}" | docker login --password-stdin --username "${artifactory_username}" artifactory.corp.mongodb.com
386-
# TODO(MONGOCRYPT-747): remove `--persist-build=false`.
387-
# Pass `--persist-build=false` to avoid using Docker Hub.
388-
# Earthly hardcodes use of docker/dockerfile-copy:v0.1.9 for the CACHE command.
389-
bash ${workdir}/libmongocrypt/.evergreen/earthly.sh ${args} --persist-build=false
386+
bash ${workdir}/libmongocrypt/.evergreen/earthly.sh ${args}
390387
391388
sbom:
392389
- command: ec2.assume_role
@@ -967,8 +964,6 @@ tasks:
967964
shell: bash
968965
script: |-
969966
set -o errexit
970-
# Authenticate to artifactory for signing image.
971-
echo "${artifactory_password}" | docker login --password-stdin --username "${artifactory_username}" artifactory.corp.mongodb.com
972967
# Copy file to sign into `libmongocrypt` directory to be used by Earthly.
973968
cp libmongocrypt_upload.tar.gz libmongocrypt
974969
- func: "earthly" # Sign tarball.

.evergreen/earthly.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,4 +48,4 @@ fi
4848

4949
chmod a+x "$exe_path"
5050

51-
"$exe_path" --buildkit-image "artifactory.corp.mongodb.com/dockerhub/earthly/buildkitd:v${EARTHLY_VERSION}" "$@"
51+
"$exe_path" "$@"

Earthfile

Lines changed: 18 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -50,15 +50,16 @@
5050
# • sles15 - OpenSUSE Leap 15.0
5151
# • alpine - Alpine Linux 3.18
5252
#
53-
# When adding new environments, always pull from a fully-qualified image ID:
53+
# When adding new environments, prefer an unqualified image ID with a version:
5454
# • DO NOT: "ubuntu"
5555
# • DO NOT: "ubuntu:latest"
56-
# • DO NOT: "ubuntu:22.10"
57-
# • DO: "artifactory.corp.mongodb.com/dockerhub/library/ubuntu:22.10"
56+
# • DO NOT: "docker.io/library/ubuntu:22.10"
57+
# • DO: "ubuntu:22.10"
58+
# Use of an unqualified image ID may enable separate registry in CI and local development.
5859
# ###
5960

6061
VERSION --use-cache-command 0.6
61-
FROM artifactory.corp.mongodb.com/dockerhub/library/alpine:3.16
62+
FROM alpine:3.16
6263
WORKDIR /s
6364

6465
init:
@@ -125,24 +126,24 @@ ALPINE_SETUP:
125126

126127
env.c6:
127128
# A CentOS 6 environment.
128-
FROM +init --base=artifactory.corp.mongodb.com/dockerhub/library/centos:6
129+
FROM +init --base=centos:6
129130
DO +CENTOS6_SETUP
130131

131132
env.c7:
132133
# A CentOS 7 environment.
133-
FROM +init --base=artifactory.corp.mongodb.com/dockerhub/library/centos:7
134+
FROM +init --base=centos:7
134135
DO +REDHAT_SETUP
135136

136137
env.rl8:
137138
# CentOS 8 is cancelled. Use RockyLinux 8 for our RHEL 8 environment.
138-
FROM +init --base=artifactory.corp.mongodb.com/dockerhub/library/rockylinux:8
139+
FROM +init --base=rockylinux:8
139140
DO +REDHAT_SETUP
140141

141142
# Utility command for Ubuntu environments
142143
ENV_UBUNTU:
143144
COMMAND
144145
ARG --required version
145-
FROM +init --base=artifactory.corp.mongodb.com/dockerhub/library/ubuntu:$version
146+
FROM +init --base=ubuntu:$version
146147
DO +DEBIAN_SETUP
147148

148149
env.u14:
@@ -167,19 +168,19 @@ env.u22:
167168

168169
env.amzn1:
169170
# An Amazon "1" environment. (AmazonLinux 2018)
170-
FROM +init --base=artifactory.corp.mongodb.com/dockerhub/library/amazonlinux:2018.03
171+
FROM +init --base=amazonlinux:2018.03
171172
DO +AMZ_SETUP
172173

173174
env.amzn2:
174175
# An AmazonLinux 2 environment
175-
FROM +init --base=artifactory.corp.mongodb.com/dockerhub/library/amazonlinux:2
176+
FROM +init --base=amazonlinux:2
176177
DO +AMZ_SETUP
177178

178179
# Utility command for Debian setup
179180
ENV_DEBIAN:
180181
COMMAND
181182
ARG --required version
182-
FROM +init --base=artifactory.corp.mongodb.com/dockerhub/library/debian:$version
183+
FROM +init --base=debian:$version
183184
IF [ $version = "9.2" ]
184185
# Update source list for archived Debian stretch packages.
185186
# Refer: https://unix.stackexchange.com/a/743865/260858
@@ -208,11 +209,11 @@ env.deb12:
208209

209210
env.sles15:
210211
# An OpenSUSE Leap 15.0 environment.
211-
FROM +init --base=artifactory.corp.mongodb.com/dockerhub/opensuse/leap:15.0
212+
FROM +init --base=opensuse/leap:15.0
212213
DO +SLES_SETUP
213214

214215
env.alpine:
215-
FROM +init --base=artifactory.corp.mongodb.com/dockerhub/library/alpine:3.18
216+
FROM +init --base=alpine:3.18
216217
DO +ALPINE_SETUP
217218

218219
# Utility: Warm-up obtaining CMake and Ninja for the build. This is usually
@@ -259,7 +260,7 @@ BUILD_EXAMPLE_STATE_MACHINE:
259260
RUN cd /s && /s/example-state-machine
260261

261262
rpm-build:
262-
FROM +init --base artifactory.corp.mongodb.com/dockerhub/fedora:38
263+
FROM +init --base fedora:38
263264
GIT CLONE https://src.fedoraproject.org/rpms/libmongocrypt.git /R
264265
# Install the packages listed by "BuildRequires" and rpm-build:
265266
RUN __install $(awk '/^BuildRequires:/ { print $2 }' /R/libmongocrypt.spec) \
@@ -275,7 +276,7 @@ rpm-build:
275276

276277
rpm-install-runtime:
277278
# Install the runtime RPM
278-
FROM +init --base artifactory.corp.mongodb.com/dockerhub/fedora:38
279+
FROM +init --base fedora:38
279280
COPY +rpm-build/RPMS /tmp/libmongocrypt-rpm/
280281
RUN dnf makecache
281282
RUN __install $(find /tmp/libmongocrypt-rpm/ -name 'libmongocrypt-1.*.rpm')
@@ -325,7 +326,7 @@ deb-build:
325326

326327
deb-install-runtime:
327328
# Install the runtime deb package
328-
FROM +init --base=artifactory.corp.mongodb.com/dockerhub/library/debian:unstable
329+
FROM +init --base=debian:unstable
329330
COPY +deb-build/debs/libmongocrypt0*.deb /tmp/lmc.deb
330331
RUN __install /tmp/lmc.deb
331332

@@ -354,7 +355,7 @@ packaging-full-test:
354355
BUILD +rpm-runtime-test
355356

356357
check-format:
357-
FROM +init --base=artifactory.corp.mongodb.com/dockerhub/python:3.11.2-slim-buster
358+
FROM +init --base=python:3.11.2-slim-buster
358359
RUN __install build-essential # To install `make` to install clang-format.
359360
RUN pip install pipx
360361
COPY etc/format* /X/etc/

0 commit comments

Comments
 (0)