From aecf18b842447ffa13fdcdc70f01b6cd9bc366fb Mon Sep 17 00:00:00 2001 From: Svyatoslav Scherbina Date: Wed, 5 Jul 2023 10:48:40 +0200 Subject: [PATCH] Native: move copying of toolchain builder artifact from Docker to host Don't make Docker container copy artifact to a host directory mounted with -v, because this fails due to a file permission issue: build is run by a regular user, but the volume directory inside the container is owned by root. Instead, make the host copy the artifact from the container. Also, make the container print the artifact path before that. Just in case, in order to easily copy file manually, should something go wrong. ^KT-58864 --- kotlin-native/tools/toolchain_builder/build_toolchain.sh | 4 +++- kotlin-native/tools/toolchain_builder/run_container.sh | 6 +++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/kotlin-native/tools/toolchain_builder/build_toolchain.sh b/kotlin-native/tools/toolchain_builder/build_toolchain.sh index f744edfea51..42416d36369 100644 --- a/kotlin-native/tools/toolchain_builder/build_toolchain.sh +++ b/kotlin-native/tools/toolchain_builder/build_toolchain.sh @@ -43,7 +43,9 @@ build_archive() { mv "$TARGET" "$FULL_NAME" ARCHIVE_NAME="$FULL_NAME.tar.gz" tar -czvf "$ARCHIVE_NAME" "$FULL_NAME" - cp "$ARCHIVE_NAME" /artifacts/"$ARCHIVE_NAME" + echo "$PWD/$ARCHIVE_NAME" + mkdir -p ~/artifacts + cp "$ARCHIVE_NAME" ~/artifacts/"$ARCHIVE_NAME" } echo "building toolchain for $TARGET" diff --git a/kotlin-native/tools/toolchain_builder/run_container.sh b/kotlin-native/tools/toolchain_builder/run_container.sh index b00a6e933d1..d2cca444dd0 100755 --- a/kotlin-native/tools/toolchain_builder/run_container.sh +++ b/kotlin-native/tools/toolchain_builder/run_container.sh @@ -12,9 +12,13 @@ docker ps -a | grep $CONTAINER_NAME > /dev/null \ && docker rm $CONTAINER_NAME > /dev/null echo "Running build script in container..." -docker run -v "$PWD"/artifacts:/artifacts \ +docker run \ --env TARGET="$TARGET" \ --env VERSION="$VERSION" \ --env TOOLCHAIN_VERSION_SUFFIX="$TOOLCHAIN_VERSION_SUFFIX" \ --name=$CONTAINER_NAME $IMAGE_NAME + +mkdir -p artifacts +docker cp kotlin-toolchain-builder:"/home/ct/x-tools/$TARGET-$VERSION-$TOOLCHAIN_VERSION_SUFFIX.tar.gz" artifacts/ + echo "Done." \ No newline at end of file