From ae5c448049bc67d8b83f3d19c57b1d5046ece900 Mon Sep 17 00:00:00 2001 From: Michael Kriese Date: Tue, 10 Dec 2024 23:32:14 +0100 Subject: [PATCH] fix(java): wrong gradle init (#3778) * test(java): reproduce bug * fix(java): wrong gradle init * test: fix docker buildx env --- src/cli/tools/java/index.ts | 2 +- test/java/Dockerfile | 20 ++++++++++++++++++++ tools/test.js | 2 +- 3 files changed, 22 insertions(+), 2 deletions(-) diff --git a/src/cli/tools/java/index.ts b/src/cli/tools/java/index.ts index 95c957ded..4a89996d7 100644 --- a/src/cli/tools/java/index.ts +++ b/src/cli/tools/java/index.ts @@ -100,7 +100,7 @@ export class JavaPrepareService extends BasePrepareService { await createMavenSettings(this.pathSvc); await createGradleSettings(this.pathSvc); - if (!(await this.pathSvc.toolEnvExists(this.name))) { + if (!(await this.pathSvc.toolEnvExists('gradle'))) { // fix: Failed to load native library 'libnative-platform.so' for Linux amd64. await this.pathSvc.exportToolEnv( 'gradle', diff --git a/test/java/Dockerfile b/test/java/Dockerfile index 123418283..0934e97f9 100644 --- a/test/java/Dockerfile +++ b/test/java/Dockerfile @@ -226,6 +226,25 @@ RUN install-tool gradle RUN install-tool maven +#-------------------------------------- +# test: readonly +#-------------------------------------- +FROM base AS test-readonly + +RUN prepare-tool java + +# fake reaonly +RUN set -ex; \ + chmod -R g-w /opt/containerbase; \ + chown -R root /opt/containerbase; \ + rm -rf /tmp/containerbase; \ + true + +USER 12021 + +RUN ls -la /tmp +RUN containerbase-cli init tool java + #-------------------------------------- # final #-------------------------------------- @@ -238,3 +257,4 @@ COPY --from=test-gradle-d /.dummy /.dummy COPY --from=test-maven-a /.dummy /.dummy COPY --from=test-others /.dummy /.dummy COPY --from=test-latest-version /.dummy /.dummy +COPY --from=test-readonly /.dummy /.dummy diff --git a/tools/test.js b/tools/test.js index 1e4e3a52a..1e55f5032 100644 --- a/tools/test.js +++ b/tools/test.js @@ -33,7 +33,7 @@ class TestCommand extends Command { if (this.debug) { shell.echo('Debug mode enabled'); env.CONTAINERBASE_DEBUG = '1'; - env.BUILDKIT_PROGRESS = '1'; + env.BUILDKIT_PROGRESS = 'plain'; } if (this.logLevel) {