Skip to content

Commit

Permalink
fix(jib): inherit maven options
Browse files Browse the repository at this point in the history
  • Loading branch information
squakez committed Jan 15, 2024
1 parent ff78e29 commit b76480e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
3 changes: 3 additions & 0 deletions e2e/commonwithcustominstall/platform_traits_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,15 @@ func TestTraitOnIntegrationPlatform(t *testing.T) {
Expect(KamelInstallWithID(operatorID, ns).Execute()).To(Succeed())

containerTestName := "testname"

Eventually(PlatformPhase(ns), TestTimeoutMedium).Should(Equal(v1.IntegrationPlatformPhaseReady))
ip := Platform(ns)()
ip.Spec.Traits = v1.Traits{Logging: &trait.LoggingTrait{Level: "DEBUG"}, Container: &trait.ContainerTrait{Name: containerTestName}}

if err := TestClient().Update(TestContext, ip); err != nil {
t.Fatal("Can't create IntegrationPlatform", err)
}
Eventually(PlatformPhase(ns), TestTimeoutMedium).Should(Equal(v1.IntegrationPlatformPhaseReady))

name := RandomizedSuffixName("java")
t.Run("Run integration with platform traits", func(t *testing.T) {
Expand Down
6 changes: 3 additions & 3 deletions pkg/util/maven/maven_command.go
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ func (c *Command) Do(ctx context.Context) error {
Log.WithValues("MAVEN_OPTS", mavenOptions).Infof("executing: %s", strings.Join(cmd.Args, " "))

// generate maven file
if err := generateMavenContext(c.context.Path, args); err != nil {
if err := generateMavenContext(c.context.Path, args, mavenOptions); err != nil {
return err
}

Expand Down Expand Up @@ -286,7 +286,7 @@ func ParseGAV(gav string) (Dependency, error) {
}

// Create a MAVEN_CONTEXT file containing all arguments for a maven command.
func generateMavenContext(path string, args []string) error {
func generateMavenContext(path string, args []string, options string) error {
// TODO refactor maven code to avoid creating a file to pass command args
commandArgs := make([]string, 0)
for _, arg := range args {
Expand All @@ -295,5 +295,5 @@ func generateMavenContext(path string, args []string) error {
}
}

return util.WriteToFile(filepath.Join(path, "MAVEN_CONTEXT"), strings.Join(commandArgs, " "))
return util.WriteToFile(filepath.Join(path, "MAVEN_CONTEXT"), strings.Join(commandArgs, " ")+" "+options)
}

0 comments on commit b76480e

Please sign in to comment.