Skip to content

Commit 5eb1b15

Browse files
authored
Fix tools in agent images (#376)
# Summary This PR fixes an issue with the new agent dockerfiles where the db tools where not placed correctly. The binaries should be present in `/tools`. However, our tests were still passing. For that reason, the agent-script will now fail if the binaries are missing. ## Proof of Work The tests should fail if the binaries are missing. Example: https://spruce.mongodb.com/version/68af05cace35b000077fae05/tasks?sorts=STATUS%3AASC%3BBASE_STATUS%3ADESC The pipeline should pass. ## Checklist - [ ] Have you linked a jira ticket and/or is the ticket in the title? - [ ] Have you checked whether your jira ticket required DOCSP changes? - [ ] Have you added changelog file? - use `skip-changelog` label if not needed - refer to [Changelog files and Release Notes](https://github.com/mongodb/mongodb-kubernetes/blob/master/CONTRIBUTING.md#changelog-files-and-release-notes) section in CONTRIBUTING.md for more details
1 parent 1d7b447 commit 5eb1b15

File tree

2 files changed

+9
-6
lines changed

2 files changed

+9
-6
lines changed

docker/mongodb-agent/Dockerfile.atomic

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,11 @@ RUN case ${TARGETPLATFORM} in \
2020
&& mkdir -p /tools \
2121
&& curl -o /tools/mongodb_tools.tgz "${mongodb_tools_url}/${MONGODB_TOOLS_VERSION}"
2222

23-
RUN tar xfz /tools/mongodb_tools.tgz --directory /tools \
24-
&& rm /tools/mongodb_tools.tgz
23+
RUN tar xfz /tools/mongodb_tools.tgz \
24+
&& mv mongodb-database-tools-*/bin/* /tools \
25+
&& chmod +x /tools/* \
26+
&& rm /tools/mongodb_tools.tgz \
27+
&& rm -r mongodb-database-tools-*
2528

2629
FROM --platform=${BUILDPLATFORM} registry.access.redhat.com/ubi9/ubi-minimal AS agent_downloader
2730

docker/mongodb-kubernetes-init-database/content/agent-launcher.sh

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -206,10 +206,10 @@ else
206206
ln -sf "${MONGOD_ROOT}/bin/mongod" ${mdb_downloads_dir}/mongod/bin/mongod
207207
ln -sf "${MONGOD_ROOT}/bin/mongos" ${mdb_downloads_dir}/mongod/bin/mongos
208208

209-
ln -sf "/tools/mongodump" ${mdb_downloads_dir}/mongod/bin/mongodump
210-
ln -sf "/tools/mongorestore" ${mdb_downloads_dir}/mongod/bin/mongorestore
211-
ln -sf "/tools/mongoexport" ${mdb_downloads_dir}/mongod/bin/mongoexport
212-
ln -sf "/tools/mongoimport" ${mdb_downloads_dir}/mongod/bin/mongoimport
209+
for tool in mongoimport mongodump mongorestore mongoexport; do
210+
[ -e "/tools/${tool}" ] || { echo "/tools/${tool} not found"; exit 1; }
211+
ln -sf "/tools/${tool}" ${mdb_downloads_dir}/mongod/bin/${tool}
212+
done
213213
else
214214
echo "Mongod PID not found within the specified time."
215215
exit 1

0 commit comments

Comments
 (0)