From 0eba4672d76b4ee2e779abe0c31868e0bae3711c Mon Sep 17 00:00:00 2001 From: Adam Cmiel Date: Fri, 27 Sep 2024 08:41:54 +0200 Subject: [PATCH] temp: Revert "buildah: don't modify Dockerfile in place" This reverts commit bfee9783f5ae472cb321cef32d86c60be95f5d01. --- task/buildah/0.2/buildah.yaml | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/task/buildah/0.2/buildah.yaml b/task/buildah/0.2/buildah.yaml index e7238fac30..c4601b782c 100644 --- a/task/buildah/0.2/buildah.yaml +++ b/task/buildah/0.2/buildah.yaml @@ -211,12 +211,8 @@ spec: echo "Cannot find Dockerfile $DOCKERFILE" exit 1 fi - - dockerfile_copy=/tmp/$(basename "$dockerfile_path") - cp "$dockerfile_path" "$dockerfile_copy" - - if [ -n "$JVM_BUILD_WORKSPACE_ARTIFACT_CACHE_PORT_80_TCP_ADDR" ] && grep -q '^\s*RUN \(./\)\?mvn' "$dockerfile_copy"; then - sed -i -e "s|^\s*RUN \(\(./\)\?mvn\)\(.*\)|RUN echo \"mirror.defaulthttp://$JVM_BUILD_WORKSPACE_ARTIFACT_CACHE_PORT_80_TCP_ADDR/v1/cache/default/0/*\" > /tmp/settings.yaml; \1 -s /tmp/settings.yaml \3|g" "$dockerfile_copy" + if [ -n "$JVM_BUILD_WORKSPACE_ARTIFACT_CACHE_PORT_80_TCP_ADDR" ] && grep -q '^\s*RUN \(./\)\?mvn' "$dockerfile_path"; then + sed -i -e "s|^\s*RUN \(\(./\)\?mvn\)\(.*\)|RUN echo \"mirror.defaulthttp://$JVM_BUILD_WORKSPACE_ARTIFACT_CACHE_PORT_80_TCP_ADDR/v1/cache/default/0/*\" > /tmp/settings.yaml; \1 -s /tmp/settings.yaml \3|g" "$dockerfile_path" touch /var/lib/containers/java fi @@ -251,7 +247,7 @@ spec: done BASE_IMAGES=$( - dockerfile-json "${BUILD_ARG_FLAGS[@]}" "$dockerfile_copy" | + dockerfile-json "${BUILD_ARG_FLAGS[@]}" "$dockerfile_path" | jq -r '.Stages[] | select(.From | .Stage or .Scratch | not) | .BaseName | select(test("^oci-archive:") | not)' ) @@ -293,7 +289,7 @@ spec: sed -E -i \ -e 'H;1h;$!d;x' \ -e 's@^\s*(run((\s|\\\n)+-\S+)*(\s|\\\n)+)@\1. /cachi2/cachi2.env \&\& \\\n @igM' \ - "$dockerfile_copy" + "$dockerfile_path" echo "Prefetched content will be made available" prefetched_repo_for_my_arch="/tmp/cachi2/output/deps/rpm/$(uname -m)/repos.d/cachi2.repo" @@ -363,7 +359,7 @@ spec: "${LABELS[@]}" \ --tls-verify=$TLSVERIFY --no-cache \ --ulimit nofile=4096:4096 \ - -f "$dockerfile_copy" -t "$IMAGE" . + -f "$dockerfile_path" -t $IMAGE . container=$(buildah from --pull-never "$IMAGE") buildah mount $container | tee /shared/container_path