You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by gf...@apache.org on 2024/03/27 14:32:39 UTC
(camel-k) branch main updated: fix(#5238): Fix Jib integration build
This is an automated email from the ASF dual-hosted git repository.
gfournier pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel-k.git
The following commit(s) were added to refs/heads/main by this push:
new 31d18a7d9 fix(#5238): Fix Jib integration build
31d18a7d9 is described below
commit 31d18a7d9ede176f077718c8a452a603a1a182b7
Author: Christoph Deppisch <cd...@redhat.com>
AuthorDate: Wed Mar 27 12:33:02 2024 +0100
fix(#5238): Fix Jib integration build
- Set proper Jib config home env var to writable directory in the Docker image
- Set proper Jib cache directory to writable directory in the Docker image
---
pkg/builder/jib.go | 5 +++++
pkg/util/jib/configuration.go | 1 +
2 files changed, 6 insertions(+)
diff --git a/pkg/builder/jib.go b/pkg/builder/jib.go
index 0c2f071fa..8285c907e 100644
--- a/pkg/builder/jib.go
+++ b/pkg/builder/jib.go
@@ -19,6 +19,7 @@ package builder
import (
"context"
+ "fmt"
"os"
"os/exec"
"path/filepath"
@@ -109,6 +110,7 @@ func (t *jibTask) Do(ctx context.Context) v1.BuildStatus {
mavenArgs = append(mavenArgs, "-P", "jib")
mavenArgs = append(mavenArgs, jib.JibMavenToImageParam+t.task.Image)
mavenArgs = append(mavenArgs, jib.JibMavenFromImageParam+baseImage)
+ mavenArgs = append(mavenArgs, jib.JibMavenBaseImageCache+mavenDir+"/jib")
if t.task.Configuration.ImagePlatforms != nil {
platforms := strings.Join(t.task.Configuration.ImagePlatforms, ",")
mavenArgs = append(mavenArgs, jib.JibMavenFromPlatforms+platforms)
@@ -122,6 +124,9 @@ func (t *jibTask) Do(ctx context.Context) v1.BuildStatus {
mvnCmd = c
}
cmd := exec.CommandContext(ctx, mvnCmd, mavenArgs...)
+ cmd.Env = os.Environ()
+ // Set Jib config directory to a writable directory within the image, Jib will create a default config file
+ cmd.Env = append(cmd.Env, fmt.Sprintf("XDG_CONFIG_HOME=%s/jib", mavenDir))
cmd.Dir = mavenDir
myerror := util.RunAndLog(ctx, cmd, maven.MavenLogHandler, maven.MavenLogHandler)
diff --git a/pkg/util/jib/configuration.go b/pkg/util/jib/configuration.go
index 2b483f3cf..8a74ce003 100644
--- a/pkg/util/jib/configuration.go
+++ b/pkg/util/jib/configuration.go
@@ -37,6 +37,7 @@ const JibMavenGoal = "jib:build"
const JibMavenToImageParam = "-Djib.to.image="
const JibMavenFromImageParam = "-Djib.from.image="
const JibMavenFromPlatforms = "-Djib.from.platforms="
+const JibMavenBaseImageCache = "-Djib.baseImageCache="
const JibMavenInsecureRegistries = "-Djib.allowInsecureRegistries="
const JibDigestFile = "target/jib-image.digest"
const JibMavenPluginVersionDefault = "3.4.1"