Skip to content

Commit 7890557

Browse files
authored
Use Artifactory for image registry (#911)
* replace dockerhub references with artifactory * install `make` to build clang-format * remove ubuntu2004 from docker distros. * Avoids "not implemented" error referenced in mongodb/mongo-c-driver#1794 * replace ubuntu1804 with ubuntu2204 in docker distros * Agrees with Evergreen distro best practices. * pass `--persist-build=false` to avoid internal use of Docker Hub
1 parent b150e74 commit 7890557

File tree

3 files changed

+26
-22
lines changed

3 files changed

+26
-22
lines changed

.evergreen/config.yml

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -346,7 +346,13 @@ functions:
346346
params:
347347
shell: bash
348348
working_dir: ${working_dir|libmongocrypt}
349-
script: bash ${workdir}/libmongocrypt/.evergreen/earthly.sh ${args}
349+
script: |
350+
# Authenticate to artifactory.
351+
echo "${artifactory_password}" | docker login --password-stdin --username "${artifactory_username}" artifactory.corp.mongodb.com
352+
# TODO(MONGOCRYPT-747): remove `--persist-build=false`.
353+
# Pass `--persist-build=false` to avoid using Docker Hub.
354+
# Earthly hardcodes use of docker/dockerfile-copy:v0.1.9 for the CACHE command.
355+
bash ${workdir}/libmongocrypt/.evergreen/earthly.sh ${args} --persist-build=false
350356
351357
tasks:
352358
- name: build-and-test-and-upload
@@ -926,11 +932,8 @@ tasks:
926932
tags: [packaging]
927933
run_on: &docker-distros
928934
# * The RHEL76-docker distro runs an old and unsupported version of Docker.
929-
# * (We requires the --mount parameter)
930-
- ubuntu2004-small
931-
- ubuntu2004
932-
- ubuntu1804
933-
- ubuntu1804-medium
935+
# * (We require the --mount parameter)
936+
- ubuntu2204-large
934937
- debian10
935938
- debian11
936939
- amazon2

.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" "$@"
51+
"$exe_path" --buildkit-image "artifactory.corp.mongodb.com/dockerhub/earthly/buildkitd:v${EARTHLY_VERSION}" "$@"

Earthfile

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -54,11 +54,11 @@
5454
# • DO NOT: "ubuntu"
5555
# • DO NOT: "ubuntu:latest"
5656
# • DO NOT: "ubuntu:22.10"
57-
# • DO: "docker.io/library/ubuntu:22.10"
57+
# • DO: "artifactory.corp.mongodb.com/dockerhub/library/ubuntu:22.10"
5858
# ###
5959

6060
VERSION --use-cache-command 0.6
61-
FROM docker.io/library/alpine:3.16
61+
FROM artifactory.corp.mongodb.com/dockerhub/library/alpine:3.16
6262
WORKDIR /s
6363

6464
init:
@@ -125,24 +125,24 @@ ALPINE_SETUP:
125125

126126
env.c6:
127127
# A CentOS 6 environment.
128-
FROM +init --base=docker.io/library/centos:6
128+
FROM +init --base=artifactory.corp.mongodb.com/dockerhub/library/centos:6
129129
DO +CENTOS6_SETUP
130130

131131
env.c7:
132132
# A CentOS 7 environment.
133-
FROM +init --base=docker.io/library/centos:7
133+
FROM +init --base=artifactory.corp.mongodb.com/dockerhub/library/centos:7
134134
DO +REDHAT_SETUP
135135

136136
env.rl8:
137137
# CentOS 8 is cancelled. Use RockyLinux 8 for our RHEL 8 environment.
138-
FROM +init --base=docker.io/library/rockylinux:8
138+
FROM +init --base=artifactory.corp.mongodb.com/dockerhub/library/rockylinux:8
139139
DO +REDHAT_SETUP
140140

141141
# Utility command for Ubuntu environments
142142
ENV_UBUNTU:
143143
COMMAND
144144
ARG --required version
145-
FROM +init --base=docker.io/library/ubuntu:$version
145+
FROM +init --base=artifactory.corp.mongodb.com/dockerhub/library/ubuntu:$version
146146
DO +DEBIAN_SETUP
147147

148148
env.u14:
@@ -167,19 +167,19 @@ env.u22:
167167

168168
env.amzn1:
169169
# An Amazon "1" environment. (AmazonLinux 2018)
170-
FROM +init --base=docker.io/library/amazonlinux:2018.03
170+
FROM +init --base=artifactory.corp.mongodb.com/dockerhub/library/amazonlinux:2018.03
171171
DO +AMZ_SETUP
172172

173173
env.amzn2:
174174
# An AmazonLinux 2 environment
175-
FROM +init --base=docker.io/library/amazonlinux:2
175+
FROM +init --base=artifactory.corp.mongodb.com/dockerhub/library/amazonlinux:2
176176
DO +AMZ_SETUP
177177

178178
# Utility command for Debian setup
179179
ENV_DEBIAN:
180180
COMMAND
181181
ARG --required version
182-
FROM +init --base=docker.io/library/debian:$version
182+
FROM +init --base=artifactory.corp.mongodb.com/dockerhub/library/debian:$version
183183
IF [ $version = "9.2" ]
184184
# Update source list for archived Debian stretch packages.
185185
# Refer: https://unix.stackexchange.com/a/743865/260858
@@ -208,11 +208,11 @@ env.deb12:
208208

209209
env.sles15:
210210
# An OpenSUSE Leap 15.0 environment.
211-
FROM +init --base=docker.io/opensuse/leap:15.0
211+
FROM +init --base=artifactory.corp.mongodb.com/dockerhub/opensuse/leap:15.0
212212
DO +SLES_SETUP
213213

214214
env.alpine:
215-
FROM +init --base=docker.io/library/alpine:3.18
215+
FROM +init --base=artifactory.corp.mongodb.com/dockerhub/library/alpine:3.18
216216
DO +ALPINE_SETUP
217217

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

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

276276
rpm-install-runtime:
277277
# Install the runtime RPM
278-
FROM +init --base fedora:38
278+
FROM +init --base artifactory.corp.mongodb.com/dockerhub/fedora:38
279279
COPY +rpm-build/RPMS /tmp/libmongocrypt-rpm/
280280
RUN dnf makecache
281281
RUN __install $(find /tmp/libmongocrypt-rpm/ -name 'libmongocrypt-1.*.rpm')
@@ -325,7 +325,7 @@ deb-build:
325325

326326
deb-install-runtime:
327327
# Install the runtime deb package
328-
FROM +init --base=docker.io/library/debian:unstable
328+
FROM +init --base=artifactory.corp.mongodb.com/dockerhub/library/debian:unstable
329329
COPY +deb-build/debs/libmongocrypt0*.deb /tmp/lmc.deb
330330
RUN __install /tmp/lmc.deb
331331

@@ -354,7 +354,8 @@ packaging-full-test:
354354
BUILD +rpm-runtime-test
355355

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

0 commit comments

Comments
 (0)