From 664f43b00f34bcf3a2631e0959fcfc6c5e5c12f3 Mon Sep 17 00:00:00 2001 From: Pepa Martinec Date: Fri, 11 Apr 2025 11:29:57 +0200 Subject: [PATCH 01/16] feat: Increase maximum VARCHAR size in Snowflake to 128MB, according to 2025_02 Bundle https://docs.snowflake.com/en/release-notes/bcr-bundles/2025_02/bcr-1942 (cherry picked from commit 10db57970dd0451fb20db5ea87b0dfa343d1c253) --- packages/php-datatypes/src/Definition/Snowflake.php | 2 +- packages/php-datatypes/tests/SnowflakeDatatypeTest.php | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/php-datatypes/src/Definition/Snowflake.php b/packages/php-datatypes/src/Definition/Snowflake.php index ba933a03e..ecf43f1f6 100644 --- a/packages/php-datatypes/src/Definition/Snowflake.php +++ b/packages/php-datatypes/src/Definition/Snowflake.php @@ -106,7 +106,7 @@ class Snowflake extends Common self::TYPE_GEOMETRY, self::TYPE_VECTOR, ]; - public const MAX_VARCHAR_LENGTH = 16777216; + public const MAX_VARCHAR_LENGTH = 134217728; public const MAX_VARBINARY_LENGTH = 8388608; /** diff --git a/packages/php-datatypes/tests/SnowflakeDatatypeTest.php b/packages/php-datatypes/tests/SnowflakeDatatypeTest.php index 375962ae0..8d371c9d2 100644 --- a/packages/php-datatypes/tests/SnowflakeDatatypeTest.php +++ b/packages/php-datatypes/tests/SnowflakeDatatypeTest.php @@ -216,10 +216,10 @@ public function testValidCharacterLengths(): void new Snowflake('STRING'); new Snowflake('STRING', ['length' => '']); new Snowflake('STRING', ['length' => '1']); - new Snowflake('STRING', ['length' => '16777216']); + new Snowflake('STRING', ['length' => '134217728']); new Snowflake('STRING', [ 'length' => [ - 'character_maximum' => '16777216', + 'character_maximum' => '134217728', ], ]); new Snowflake('STRING', [ @@ -343,7 +343,7 @@ public function invalidCharacterLengths(): array return [ ['a'], ['0'], - ['16777217'], + ['134217729'], ['-1'], ]; } From 3af591d6883c70f38936367dc9a2cef109e8f62b Mon Sep 17 00:00:00 2001 From: Pepa Martinec Date: Fri, 11 Apr 2025 14:07:17 +0200 Subject: [PATCH 02/16] feat: Use separate default and max length for Snowflake VARCHAR (cherry picked from commit 226bc28f92faaa529c676139d806fee5035d8f71) --- packages/php-datatypes/src/Definition/Snowflake.php | 1 + .../Backend/Snowflake/ToStage/StageTableDefinitionFactory.php | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/php-datatypes/src/Definition/Snowflake.php b/packages/php-datatypes/src/Definition/Snowflake.php index ecf43f1f6..d55430884 100644 --- a/packages/php-datatypes/src/Definition/Snowflake.php +++ b/packages/php-datatypes/src/Definition/Snowflake.php @@ -106,6 +106,7 @@ class Snowflake extends Common self::TYPE_GEOMETRY, self::TYPE_VECTOR, ]; + public const DEFAULT_VARCHAR_LENGTH = 16777216; public const MAX_VARCHAR_LENGTH = 134217728; public const MAX_VARBINARY_LENGTH = 8388608; diff --git a/packages/php-db-import-export/src/Backend/Snowflake/ToStage/StageTableDefinitionFactory.php b/packages/php-db-import-export/src/Backend/Snowflake/ToStage/StageTableDefinitionFactory.php index 1ea94e73e..c0989111d 100644 --- a/packages/php-db-import-export/src/Backend/Snowflake/ToStage/StageTableDefinitionFactory.php +++ b/packages/php-db-import-export/src/Backend/Snowflake/ToStage/StageTableDefinitionFactory.php @@ -87,7 +87,7 @@ private static function createNvarcharColumn(string $columnName): SnowflakeColum new Snowflake( Snowflake::TYPE_VARCHAR, [ - 'length' => (string) Snowflake::MAX_VARCHAR_LENGTH, + 'length' => (string) Snowflake::DEFAULT_VARCHAR_LENGTH, 'nullable' => true, // set all columns to be nullable ], ), From 4a59df0d64407c50fac9f8d061913542f7a5522c Mon Sep 17 00:00:00 2001 From: zajca Date: Tue, 19 Aug 2025 10:32:52 +0200 Subject: [PATCH 03/16] release tag --- .github/workflows/main.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 2a72ac270..3cfdd94ef 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -38,8 +38,8 @@ jobs: echo "git rev-parse origin/$MAIN_BRANCH: $(git rev-parse origin/$MAIN_BRANCH)" echo "git rev-parse HEAD: $(git rev-parse HEAD)" echo "github.ref_type: ${{ github.ref_type }}" - echo "isReleaseTag=$(if [ "$(git rev-parse origin/$MAIN_BRANCH)" == "$(git rev-parse HEAD)" ] && ${{ github.ref_type == 'tag' }}; then echo 1; else echo 0; fi)" >> "$GITHUB_OUTPUT" - echo "isReleaseTag=$(if [ "$(git rev-parse origin/$MAIN_BRANCH)" == "$(git rev-parse HEAD)" ] && ${{ github.ref_type == 'tag' }}; then echo 1; else echo 0; fi)" + echo "isReleaseTag=$(if ${{ github.ref_type == 'tag' }}; then echo 1; else echo 0; fi)" >> "$GITHUB_OUTPUT" + echo "isReleaseTag=$(if ${{ github.ref_type == 'tag' }}; then echo 1; else echo 0; fi)" - name: Configure AWS Credentials id: creds From c6355df48cd23fec5cb4b342d8935cf30dca9043 Mon Sep 17 00:00:00 2001 From: Jiri Semmler Date: Mon, 4 Mar 2024 13:16:46 +0100 Subject: [PATCH 04/16] Fix build (cherry picked from commit ea6f956a5831f28048ef2465234ed0ab3fd4565e) --- Dockerfile | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Dockerfile b/Dockerfile index 023a30a9e..2ed3b20c2 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,14 +1,14 @@ # syntax=docker/dockerfile:1.4.0 -ARG PHP_VERSION=8.1.27 +ARG PHP_VERSION=8.1 -FROM php:${PHP_VERSION}-cli-bullseye AS base +FROM php:${PHP_VERSION}-cli-buster AS base MAINTAINER Keboola ARG COMPOSER_FLAGS="--prefer-dist --no-interaction" ARG DEBIAN_FRONTEND=noninteractive ENV COMPOSER_ALLOW_SUPERUSER 1 -ENV COMPOSER_PROCESS_TIMEOUT 4500 +ENV COMPOSER_PROCESS_TIMEOUT 3600 ARG AWS_SECRET_ACCESS_KEY ARG AWS_ACCESS_KEY_ID ARG AWS_SESSION_TOKEN @@ -21,7 +21,7 @@ RUN apt-get update -q \ && apt-get install gnupg -y --no-install-recommends \ && curl https://packages.microsoft.com/keys/microsoft.asc | apt-key add - \ && curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | gpg --dearmor -o /usr/share/keyrings/cloud.google.gpg \ - && curl https://packages.microsoft.com/config/debian/11/prod.list > /etc/apt/sources.list.d/mssql-release.list \ + && curl https://packages.microsoft.com/config/debian/9/prod.list > /etc/apt/sources.list.d/mssql-release.list \ && echo "deb [signed-by=/usr/share/keyrings/cloud.google.gpg] https://packages.cloud.google.com/apt cloud-sdk main" | tee -a /etc/apt/sources.list.d/google-cloud-sdk.list \ && curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | apt-key --keyring /usr/share/keyrings/cloud.google.gpg add - \ && apt-get update -q \ From 9c25eff0bcc88699744835864325c13543a242d2 Mon Sep 17 00:00:00 2001 From: zajca Date: Mon, 11 Mar 2024 14:51:34 +0100 Subject: [PATCH 05/16] use php:8.1.27-cli-bullseye (cherry picked from commit bdc84ffb22e1658cef61b31926b9e5c380c87cef) --- Dockerfile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index 2ed3b20c2..57728a0da 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,8 +1,8 @@ # syntax=docker/dockerfile:1.4.0 -ARG PHP_VERSION=8.1 +ARG PHP_VERSION=8.1.27 -FROM php:${PHP_VERSION}-cli-buster AS base +FROM php:${PHP_VERSION}-cli-bullseye AS base MAINTAINER Keboola ARG COMPOSER_FLAGS="--prefer-dist --no-interaction" @@ -21,7 +21,7 @@ RUN apt-get update -q \ && apt-get install gnupg -y --no-install-recommends \ && curl https://packages.microsoft.com/keys/microsoft.asc | apt-key add - \ && curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | gpg --dearmor -o /usr/share/keyrings/cloud.google.gpg \ - && curl https://packages.microsoft.com/config/debian/9/prod.list > /etc/apt/sources.list.d/mssql-release.list \ + && curl https://packages.microsoft.com/config/debian/11/prod.list > /etc/apt/sources.list.d/mssql-release.list \ && echo "deb [signed-by=/usr/share/keyrings/cloud.google.gpg] https://packages.cloud.google.com/apt cloud-sdk main" | tee -a /etc/apt/sources.list.d/google-cloud-sdk.list \ && curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | apt-key --keyring /usr/share/keyrings/cloud.google.gpg add - \ && apt-get update -q \ From f0ac9801b398800c9ef8e35fd035b50ae4525d84 Mon Sep 17 00:00:00 2001 From: zajca Date: Wed, 24 Apr 2024 21:59:45 +0200 Subject: [PATCH 06/16] update composer timeout (cherry picked from commit 65007ba20a23a21baaed81a1a70aeceb7dd91600) --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 57728a0da..023a30a9e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -8,7 +8,7 @@ MAINTAINER Keboola ARG COMPOSER_FLAGS="--prefer-dist --no-interaction" ARG DEBIAN_FRONTEND=noninteractive ENV COMPOSER_ALLOW_SUPERUSER 1 -ENV COMPOSER_PROCESS_TIMEOUT 3600 +ENV COMPOSER_PROCESS_TIMEOUT 4500 ARG AWS_SECRET_ACCESS_KEY ARG AWS_ACCESS_KEY_ID ARG AWS_SESSION_TOKEN From 7c96aea46eac49f7ab540afe897c9b16171f83ff Mon Sep 17 00:00:00 2001 From: zajca Date: Tue, 19 Aug 2025 10:57:53 +0200 Subject: [PATCH 07/16] fix split --- .github/workflows/main.yml | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 3cfdd94ef..f55a5ed3a 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -198,6 +198,18 @@ jobs: - name: Split monorepo run: | + set -euxo pipefail ssh-add -l + GITDIR="$(git rev-parse --git-dir)" # absolute path to the real git dir + echo "GITDIR=${GITDIR}" + docker build -t monorepo-tools ./bin - docker run -v $PWD:/monorepo -w /monorepo -v $SSH_AUTH_SOCK:/ssh-agent -v ~/.ssh/known_hosts:/root/.ssh/known_hosts -e SSH_AUTH_SOCK=/ssh-agent monorepo-tools bin/split-repo.sh . ${{ matrix.repo }} ${{ matrix.path }} ${{ matrix.name }}/ ${{ matrix.lastTag}} + docker run \ + -v "$PWD:/monorepo" \ + -v "$GITDIR:$GITDIR" \ # <— make the pointed-to gitdir visible in the container + -w /monorepo \ + -v "$SSH_AUTH_SOCK:/ssh-agent" \ + -v ~/.ssh/known_hosts:/root/.ssh/known_hosts \ + -e SSH_AUTH_SOCK=/ssh-agent \ + monorepo-tools \ + bin/split-repo.sh . "${{ matrix.repo }}" "${{ matrix.path }}" "${{ matrix.name }}/" "${{ matrix.lastTag }}" From 72b88e378f1b9685d9553d37ff3be7b2bd328e6c Mon Sep 17 00:00:00 2001 From: Roman Bracinik Date: Tue, 29 Jul 2025 16:28:57 +0200 Subject: [PATCH 08/16] update bin/Dockerfile (cherry picked from commit 24d0f49ceb5eff9d6d6027bfe31591a1ced69976) --- bin/Dockerfile | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/bin/Dockerfile b/bin/Dockerfile index 0e406b8c6..bacda8607 100644 --- a/bin/Dockerfile +++ b/bin/Dockerfile @@ -1,7 +1,7 @@ -FROM debian:11 +FROM debian:12 -RUN echo "deb http://deb.debian.org/debian bullseye-backports main contrib non-free" >> /etc/apt/sources.list \ - && echo "deb-src http://deb.debian.org/debian bullseye-backports main contrib non-free" >> /etc/apt/sources.list \ +RUN echo "deb http://deb.debian.org/debian bookworm-backports main contrib non-free" >> /etc/apt/sources.list \ + && echo "deb-src http://deb.debian.org/debian bookworm-backports main contrib non-free" >> /etc/apt/sources.list \ && apt-get update -yq \ && apt-get install -yqq \ git \ @@ -9,7 +9,7 @@ RUN echo "deb http://deb.debian.org/debian bullseye-backports main contrib non-f vim \ openssh-client \ python3-pip \ + python3-packaging \ && mkdir -p ~/.ssh || true \ && chmod 700 ~/.ssh/ \ - && ssh-keyscan -t rsa github.com >> ~/.ssh/known_hosts \ - && pip install packaging + && ssh-keyscan -t rsa github.com >> ~/.ssh/known_hosts From f09f7927f040eb6c3f463f8cfc517c3682d64950 Mon Sep 17 00:00:00 2001 From: Roman Bracinik Date: Wed, 30 Jul 2025 07:56:35 +0200 Subject: [PATCH 09/16] Update Dockerfile RUN git config --system --add safe.directory /monorepo (cherry picked from commit 6ad939ce67a9eb0a479cc1635cae8440989a87c7) --- bin/Dockerfile | 2 ++ 1 file changed, 2 insertions(+) diff --git a/bin/Dockerfile b/bin/Dockerfile index bacda8607..323c746d1 100644 --- a/bin/Dockerfile +++ b/bin/Dockerfile @@ -13,3 +13,5 @@ RUN echo "deb http://deb.debian.org/debian bookworm-backports main contrib non-f && mkdir -p ~/.ssh || true \ && chmod 700 ~/.ssh/ \ && ssh-keyscan -t rsa github.com >> ~/.ssh/known_hosts + +RUN git config --system --add safe.directory /monorepo From 16e18e8704ffe8363155805b1dbb0fa120d4e945 Mon Sep 17 00:00:00 2001 From: Roman Bracinik Date: Wed, 30 Jul 2025 08:18:25 +0200 Subject: [PATCH 10/16] add safe.dir /monorepo/.git (cherry picked from commit 27ee07d5e88fbf47cd6cdc4ec6d06dbd318d4563) --- bin/Dockerfile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/bin/Dockerfile b/bin/Dockerfile index 323c746d1..5814f69c2 100644 --- a/bin/Dockerfile +++ b/bin/Dockerfile @@ -14,4 +14,5 @@ RUN echo "deb http://deb.debian.org/debian bookworm-backports main contrib non-f && chmod 700 ~/.ssh/ \ && ssh-keyscan -t rsa github.com >> ~/.ssh/known_hosts -RUN git config --system --add safe.directory /monorepo +RUN git config --system --add safe.directory /monorepo \ + && git config --system --add safe.directory /monorepo/.git From cece35f7dd61082b43c4e6d3c09829a9089bbc2c Mon Sep 17 00:00:00 2001 From: Roman Bracinik Date: Wed, 30 Jul 2025 13:38:57 +0200 Subject: [PATCH 11/16] add permission in split-repo.sh (cherry picked from commit 13360a8215615a801f40b89b93709122054d5217) --- bin/Dockerfile | 3 --- bin/split-repo.sh | 1 + 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/bin/Dockerfile b/bin/Dockerfile index 5814f69c2..bacda8607 100644 --- a/bin/Dockerfile +++ b/bin/Dockerfile @@ -13,6 +13,3 @@ RUN echo "deb http://deb.debian.org/debian bookworm-backports main contrib non-f && mkdir -p ~/.ssh || true \ && chmod 700 ~/.ssh/ \ && ssh-keyscan -t rsa github.com >> ~/.ssh/known_hosts - -RUN git config --system --add safe.directory /monorepo \ - && git config --system --add safe.directory /monorepo/.git diff --git a/bin/split-repo.sh b/bin/split-repo.sh index 63a8ffa57..4b5c441ea 100755 --- a/bin/split-repo.sh +++ b/bin/split-repo.sh @@ -37,6 +37,7 @@ clean_up () { trap clean_up EXIT echo ">> Cloning source repo '${SOURCE_REPO_PATH}'" +git config --system --add safe.directory /monorepo git clone --no-local --mirror "${SOURCE_REPO_PATH}" $TMP_DIR cd $TMP_DIR From b3600d6108618437ca4acfdd2d4651a78ca77402 Mon Sep 17 00:00:00 2001 From: zajca Date: Tue, 19 Aug 2025 11:20:09 +0200 Subject: [PATCH 12/16] fix split --- .github/workflows/main.yml | 18 +++++++++++++----- bin/split-repo.sh | 2 +- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index f55a5ed3a..cc3d614b5 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -195,21 +195,29 @@ jobs: - uses: webfactory/ssh-agent@fc49353b67b2b7c1e0e6a600572d01a69f2672dd with: ssh-private-key: ${{ secrets[matrix.sshKey] }} - - name: Split monorepo run: | set -euxo pipefail + ssh-add -l - GITDIR="$(git rev-parse --git-dir)" # absolute path to the real git dir - echo "GITDIR=${GITDIR}" + # Build the tools image (use your updated Dockerfile that installs git-filter-repo via pip) docker build -t monorepo-tools ./bin + + # Get the real gitdir and ensure it’s absolute + GITDIR="$(git rev-parse --git-dir)" + if [[ "${GITDIR}" != /* ]]; then + GITDIR="$PWD/${GITDIR}" + fi + echo "GITDIR=${GITDIR}" + + # Run split inside the container, mounting both worktree and the real gitdir docker run \ -v "$PWD:/monorepo" \ - -v "$GITDIR:$GITDIR" \ # <— make the pointed-to gitdir visible in the container + -v "$GITDIR:$GITDIR" \ -w /monorepo \ -v "$SSH_AUTH_SOCK:/ssh-agent" \ - -v ~/.ssh/known_hosts:/root/.ssh/known_hosts \ + -v "$HOME/.ssh/known_hosts:/root/.ssh/known_hosts" \ -e SSH_AUTH_SOCK=/ssh-agent \ monorepo-tools \ bin/split-repo.sh . "${{ matrix.repo }}" "${{ matrix.path }}" "${{ matrix.name }}/" "${{ matrix.lastTag }}" diff --git a/bin/split-repo.sh b/bin/split-repo.sh index 4b5c441ea..8d9599bcd 100755 --- a/bin/split-repo.sh +++ b/bin/split-repo.sh @@ -22,7 +22,7 @@ LAST_TAG_IN_SINGLEREPO="${5}" # We require the source to be a local path because we use --mirror flag. The --mirror flag is needed on the other hand # to copy all refs when doing a local clone. -if [[ ! -d "${SOURCE_REPO_PATH}/.git" ]]; then +if ! git -C "${SOURCE_REPO_PATH}" rev-parse --is-inside-work-tree >/dev/null 2>&1; then echo "Source repo '${SOURCE_REPO_PATH}' is not a valid GIT repository" exit 1 fi From 6f868068912991c0f00df970ca2a940a7185f411 Mon Sep 17 00:00:00 2001 From: zajca Date: Tue, 19 Aug 2025 11:29:04 +0200 Subject: [PATCH 13/16] fix split --- .github/workflows/main.yml | 16 +++++----------- bin/split-repo.sh | 3 +-- 2 files changed, 6 insertions(+), 13 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index cc3d614b5..69f8a5bf5 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -198,23 +198,17 @@ jobs: - name: Split monorepo run: | set -euxo pipefail - + ssh-add -l - - # Build the tools image (use your updated Dockerfile that installs git-filter-repo via pip) docker build -t monorepo-tools ./bin - - # Get the real gitdir and ensure it’s absolute + GITDIR="$(git rev-parse --git-dir)" - if [[ "${GITDIR}" != /* ]]; then - GITDIR="$PWD/${GITDIR}" - fi + [[ "${GITDIR}" != /* ]] && GITDIR="$PWD/${GITDIR}" echo "GITDIR=${GITDIR}" - - # Run split inside the container, mounting both worktree and the real gitdir + docker run \ -v "$PWD:/monorepo" \ - -v "$GITDIR:$GITDIR" \ + -v "$GITDIR:/monorepo/.git" \ # <-- key change -w /monorepo \ -v "$SSH_AUTH_SOCK:/ssh-agent" \ -v "$HOME/.ssh/known_hosts:/root/.ssh/known_hosts" \ diff --git a/bin/split-repo.sh b/bin/split-repo.sh index 8d9599bcd..c4e358f69 100755 --- a/bin/split-repo.sh +++ b/bin/split-repo.sh @@ -37,9 +37,8 @@ clean_up () { trap clean_up EXIT echo ">> Cloning source repo '${SOURCE_REPO_PATH}'" -git config --system --add safe.directory /monorepo -git clone --no-local --mirror "${SOURCE_REPO_PATH}" $TMP_DIR cd $TMP_DIR +git clone --no-local --mirror "${SOURCE_REPO_PATH}" $TMP_DIR echo ">> Rebuild repo" LIB_PATH="${LIB_PATH%/}/" # ensure trailing slash From 2ad6460910a51fbc4dc568674af1bdd45b26b01a Mon Sep 17 00:00:00 2001 From: zajca Date: Tue, 19 Aug 2025 11:36:34 +0200 Subject: [PATCH 14/16] fix split --- .github/workflows/main.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 69f8a5bf5..585b2607b 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -206,9 +206,11 @@ jobs: [[ "${GITDIR}" != /* ]] && GITDIR="$PWD/${GITDIR}" echo "GITDIR=${GITDIR}" - docker run \ + # Show exactly what we'll run (for debugging) + set -x + docker run --rm \ -v "$PWD:/monorepo" \ - -v "$GITDIR:/monorepo/.git" \ # <-- key change + -v "$GITDIR:/monorepo/.git" \ -w /monorepo \ -v "$SSH_AUTH_SOCK:/ssh-agent" \ -v "$HOME/.ssh/known_hosts:/root/.ssh/known_hosts" \ From d46bddba722eb1bdadb9b1278b96edc5a1587548 Mon Sep 17 00:00:00 2001 From: zajca Date: Tue, 19 Aug 2025 11:47:43 +0200 Subject: [PATCH 15/16] fix split --- .github/workflows/main.yml | 15 +++++++++------ bin/split-repo.sh | 13 +++++++++++-- 2 files changed, 20 insertions(+), 8 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 585b2607b..4e6780a60 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -202,16 +202,19 @@ jobs: ssh-add -l docker build -t monorepo-tools ./bin + # Resolve absolute paths on the host + WORKTREE="$PWD" GITDIR="$(git rev-parse --git-dir)" - [[ "${GITDIR}" != /* ]] && GITDIR="$PWD/${GITDIR}" + [[ "${GITDIR}" != /* ]] && GITDIR="$WORKTREE/${GITDIR}" + + echo "WORKTREE=${WORKTREE}" echo "GITDIR=${GITDIR}" - # Show exactly what we'll run (for debugging) - set -x + # Run with identical absolute paths inside the container docker run --rm \ - -v "$PWD:/monorepo" \ - -v "$GITDIR:/monorepo/.git" \ - -w /monorepo \ + -v "${WORKTREE}:${WORKTREE}" \ + -v "${GITDIR}:${GITDIR}" \ + -w "${WORKTREE}" \ -v "$SSH_AUTH_SOCK:/ssh-agent" \ -v "$HOME/.ssh/known_hosts:/root/.ssh/known_hosts" \ -e SSH_AUTH_SOCK=/ssh-agent \ diff --git a/bin/split-repo.sh b/bin/split-repo.sh index c4e358f69..0074eff3f 100755 --- a/bin/split-repo.sh +++ b/bin/split-repo.sh @@ -20,6 +20,15 @@ LIB_PATH="${3}" TAG_PREFIX="${4}" LAST_TAG_IN_SINGLEREPO="${5}" +echo ">> Splitting repo" +echo "Source repo: ${SOURCE_REPO_PATH}" +echo "Target repo: ${TARGET_REPO_URL}" +echo "Library path: ${LIB_PATH}" +echo "Tag prefix: ${TAG_PREFIX}" +echo "Last tag in singlerepo: ${LAST_TAG_IN_SINGLEREPO}" + +echo "Work tree: $(git -C "${SOURCE_REPO_PATH}" rev-parse --show-toplevel)" +echo "Git dir: $(git -C "${SOURCE_REPO_PATH}" rev-parse --git-dir)" # We require the source to be a local path because we use --mirror flag. The --mirror flag is needed on the other hand # to copy all refs when doing a local clone. if ! git -C "${SOURCE_REPO_PATH}" rev-parse --is-inside-work-tree >/dev/null 2>&1; then @@ -37,8 +46,8 @@ clean_up () { trap clean_up EXIT echo ">> Cloning source repo '${SOURCE_REPO_PATH}'" -cd $TMP_DIR -git clone --no-local --mirror "${SOURCE_REPO_PATH}" $TMP_DIR +REAL_GIT_DIR="$(git -C "${SOURCE_REPO_PATH}" rev-parse --git-dir)" +git clone --no-local --mirror "${REAL_GIT_DIR}" "$TMP_DIR" echo ">> Rebuild repo" LIB_PATH="${LIB_PATH%/}/" # ensure trailing slash From 2f7e4b536699e04826dd8e1a02dc7e89c374b443 Mon Sep 17 00:00:00 2001 From: zajca Date: Tue, 19 Aug 2025 12:04:35 +0200 Subject: [PATCH 16/16] fix split --- bin/Dockerfile | 3 ++- bin/split-repo.sh | 6 ++---- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/bin/Dockerfile b/bin/Dockerfile index bacda8607..c36300507 100644 --- a/bin/Dockerfile +++ b/bin/Dockerfile @@ -12,4 +12,5 @@ RUN echo "deb http://deb.debian.org/debian bookworm-backports main contrib non-f python3-packaging \ && mkdir -p ~/.ssh || true \ && chmod 700 ~/.ssh/ \ - && ssh-keyscan -t rsa github.com >> ~/.ssh/known_hosts + && ssh-keyscan -t rsa github.com >> ~/.ssh/known_hosts \ + && git config --system --add safe.directory '*' diff --git a/bin/split-repo.sh b/bin/split-repo.sh index 0074eff3f..8c062dc66 100755 --- a/bin/split-repo.sh +++ b/bin/split-repo.sh @@ -27,14 +27,12 @@ echo "Library path: ${LIB_PATH}" echo "Tag prefix: ${TAG_PREFIX}" echo "Last tag in singlerepo: ${LAST_TAG_IN_SINGLEREPO}" -echo "Work tree: $(git -C "${SOURCE_REPO_PATH}" rev-parse --show-toplevel)" -echo "Git dir: $(git -C "${SOURCE_REPO_PATH}" rev-parse --git-dir)" -# We require the source to be a local path because we use --mirror flag. The --mirror flag is needed on the other hand -# to copy all refs when doing a local clone. if ! git -C "${SOURCE_REPO_PATH}" rev-parse --is-inside-work-tree >/dev/null 2>&1; then echo "Source repo '${SOURCE_REPO_PATH}' is not a valid GIT repository" exit 1 fi +echo "Work tree: $(git -C "${SOURCE_REPO_PATH}" rev-parse --show-toplevel || true)" +echo "Git dir: $(git -C "${SOURCE_REPO_PATH}" rev-parse --git-dir || true)" TMP_DIR=`mktemp -d` WORK_DIR=`pwd`