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
This commit is contained in:
Svyatoslav Scherbina
2023-07-05 10:48:40 +02:00
committed by Space Team
parent a276ad48a0
commit aecf18b842
2 changed files with 8 additions and 2 deletions
@@ -43,7 +43,9 @@ build_archive() {
mv "$TARGET" "$FULL_NAME" mv "$TARGET" "$FULL_NAME"
ARCHIVE_NAME="$FULL_NAME.tar.gz" ARCHIVE_NAME="$FULL_NAME.tar.gz"
tar -czvf "$ARCHIVE_NAME" "$FULL_NAME" 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" echo "building toolchain for $TARGET"
@@ -12,9 +12,13 @@ docker ps -a | grep $CONTAINER_NAME > /dev/null \
&& docker rm $CONTAINER_NAME > /dev/null && docker rm $CONTAINER_NAME > /dev/null
echo "Running build script in container..." echo "Running build script in container..."
docker run -v "$PWD"/artifacts:/artifacts \ docker run \
--env TARGET="$TARGET" \ --env TARGET="$TARGET" \
--env VERSION="$VERSION" \ --env VERSION="$VERSION" \
--env TOOLCHAIN_VERSION_SUFFIX="$TOOLCHAIN_VERSION_SUFFIX" \ --env TOOLCHAIN_VERSION_SUFFIX="$TOOLCHAIN_VERSION_SUFFIX" \
--name=$CONTAINER_NAME $IMAGE_NAME --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." echo "Done."