Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 6 additions & 8 deletions bin/build_image.sh
Original file line number Diff line number Diff line change
Expand Up @@ -74,15 +74,13 @@ build_image()
fi

if [ "${type}" == 'server' ]; then
# Create latest tag for image build cache
docker tag "${image_name}" "${CYBER_DOJO_RUNNER_IMAGE}:latest"
# Tag image-name for local development where runners name comes from echo-env-vars
docker tag "${image_name}" cyberdojo/runner:latest
# Tag image-name for local development, where sibling repos name the runner
# with the dockerhub name their env-vars carry rather than the ECR one.
docker tag "${image_name}" "cyberdojo/runner:${CYBER_DOJO_RUNNER_TAG}"
# After tagging, so removing an earlier build's tags takes its last tag with
# them and the image itself goes, rather than being left dangling when
# :latest moves to this build. check_args rejects 'server' inside CI, so the
# image pulled by the 'Download docker image' CI job is never at risk here.
# After tagging, so this build is protected by its own tag, and removing an
# earlier build's tags takes its last tag with them and the image itself
# goes. check_args rejects 'server' inside CI, so the image pulled by the
# 'Download docker image' CI job is never at risk here.
remove_old_images
echo
echo " echo CYBER_DOJO_RUNNER_SHA=${CYBER_DOJO_RUNNER_SHA}"
Expand Down
8 changes: 3 additions & 5 deletions bin/lib.sh
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,8 @@ remove_old_images()
remove_all_but_current "${dil}" cyberdojo/runner
}

# Keeps :latest, which local tooling and the build cache refer to, and this
# commit's tag, which names the build just made. Every older tag goes, and an
# earlier build whose last tag was one of those goes with it.
# Keeps this commit's tag, which names the build just made. Every older tag
# goes, and an earlier build whose last tag was one of those goes with it.
remove_all_but_current()
{
local -r docker_image_ls="${1}"
Expand All @@ -93,8 +92,7 @@ remove_all_but_current()
local tagged_name
for tagged_name in $(echo "${docker_image_ls}" | grep "${name}:" || true)
do
if [ "${tagged_name}" != "${name}:latest" ] \
&& [ "${tagged_name}" != "${name}:${CYBER_DOJO_RUNNER_TAG}" ]; then
if [ "${tagged_name}" != "${name}:${CYBER_DOJO_RUNNER_TAG}" ]; then
# Best-effort: an image still referenced by a container from another
# compose project (eg creator-runner-1) cannot be removed. Skip it rather
# than aborting the whole build under set -Eeu; it will be cleaned by a
Expand Down
2 changes: 1 addition & 1 deletion docs/profiling/time_docker_run_phases.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ On the host:
Inside the runner, to price its CLI as the runner actually pays for it:
docker run --rm --entrypoint=\"\" \\
--volume /var/run/docker.sock:/var/run/docker.sock \\
--volume \$PWD:/probe:ro cyberdojo/runner:latest \\
--volume \$PWD:/probe:ro cyberdojo/runner:\$(git rev-parse HEAD | cut -c1-7) \\
bash /probe/time_docker_run_phases.sh"

readonly IMG="${1:-ghcr.io/cyber-dojo-languages/perl_test_simple:dc0f44a}"
Expand Down