Skip to content

Commit 3e7752f

Browse files
fix: bind maven local repository in docker environment (#10967)
* fix: bind home dir in docker run * update config for testing * chore: generate libraries at Fri Jun 14 14:48:27 UTC 2024 * restore config * Revert "restore config" This reverts commit bb6370c. * restore config * restore change * add comments --------- Co-authored-by: cloud-java-bot <cloud-java-bot@google.com>
1 parent acd8025 commit 3e7752f

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

.github/scripts/hermetic_library_generation.sh

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ set -e
1717
# 1. git
1818
# 2. gh
1919
# 3. docker
20+
# 4. mvn
2021

2122
# The parameters of this script is:
2223
# 1. target_branch, the branch into which the pull request is merged.
@@ -88,12 +89,15 @@ fi
8889
git show "${target_branch}":"${generation_config}" > "${baseline_generation_config}"
8990
config_diff=$(diff "${generation_config}" "${baseline_generation_config}" || true)
9091

92+
# get .m2 folder so it's mapped into the docker container
93+
m2_folder=$(dirname "$(mvn help:evaluate -Dexpression=settings.localRepository -q -DforceStdout)")
94+
9195
# run hermetic code generation docker image.
9296
docker run \
9397
--rm \
9498
-u "$(id -u):$(id -g)" \
9599
-v "$(pwd):${workspace_name}" \
96-
-v "$HOME"/.m2:/home/.m2 \
100+
-v "${m2_folder}":/home/.m2 \
97101
gcr.io/cloud-devrel-public-resources/java-library-generation:"${image_tag}" \
98102
--baseline-generation-config-path="${workspace_name}/${baseline_generation_config}" \
99103
--current-generation-config-path="${workspace_name}/${generation_config}"

0 commit comments

Comments
 (0)