Skip to content

Commit

Permalink
fix(java): wrong gradle init (#3778)
Browse files Browse the repository at this point in the history
* test(java): reproduce bug

* fix(java): wrong gradle init

* test: fix docker buildx env
  • Loading branch information
viceice authored Dec 10, 2024
1 parent c408f54 commit ae5c448
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/cli/tools/java/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
20 changes: 20 additions & 0 deletions test/java/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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
#--------------------------------------
Expand All @@ -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
2 changes: 1 addition & 1 deletion tools/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit ae5c448

Please sign in to comment.