diff --git a/e2e/local/local_build_test.go b/e2e/local/local_build_test.go index 2c0f40c6dc..dc0ab18321 100644 --- a/e2e/local/local_build_test.go +++ b/e2e/local/local_build_test.go @@ -63,7 +63,7 @@ func TestLocalBuild(t *testing.T) { file := testutil.MakeTempCopy(t, "files/yaml.yaml") image := "test/test-" + strings.ToLower(util.RandomString(10)) - kamelBuild := KamelWithContext(ctx, "local", "build", file, "--image", image) + kamelBuild := kamelWithContextAndMaybeStaging(ctx, "local", "build", file, "--image", image) kamelBuild.SetOut(pipew) kamelBuild.SetErr(pipew) @@ -93,7 +93,7 @@ func TestLocalBuildWithTrait(t *testing.T) { file := testutil.MakeTempCopy(t, "files/trait.groovy") image := "test/test-" + strings.ToLower(util.RandomString(10)) - kamelBuild := KamelWithContext(ctx, "local", "build", file, "--image", image) + kamelBuild := kamelWithContextAndMaybeStaging(ctx, "local", "build", file, "--image", image) kamelBuild.SetOut(pipew) kamelBuild.SetErr(pipew) @@ -122,7 +122,7 @@ func TestLocalBuildIntegrationDirectory(t *testing.T) { file := testutil.MakeTempCopy(t, "files/yaml.yaml") dir := testutil.MakeTempDir(t) - kamelBuild := KamelWithContext(ctx, "local", "build", file, "--integration-directory", dir) + kamelBuild := kamelWithContextAndMaybeStaging(ctx, "local", "build", file, "--integration-directory", dir) go func() { err := kamelBuild.Execute() @@ -149,7 +149,7 @@ func TestLocalBuildIntegrationDirectoryWithSpaces(t *testing.T) { file := testutil.MakeTempCopy(t, "files/yaml.yaml") dir := testutil.MakeTempDir(t) + " - Camel rocks!" - kamelBuild := KamelWithContext(ctx, "local", "build", file, "--integration-directory", dir) + kamelBuild := kamelWithContextAndMaybeStaging(ctx, "local", "build", file, "--integration-directory", dir) go func() { err := kamelBuild.Execute() @@ -173,7 +173,7 @@ func TestLocalBuildIntegrationDirectoryWithMultiBytes(t *testing.T) { file := testutil.MakeTempCopy(t, "files/yaml.yaml") dir := testutil.MakeTempDir(t) + "_らくだ" // Camel - kamelBuild := KamelWithContext(ctx, "local", "build", file, "--integration-directory", dir) + kamelBuild := kamelWithContextAndMaybeStaging(ctx, "local", "build", file, "--integration-directory", dir) go func() { err := kamelBuild.Execute() @@ -197,7 +197,7 @@ func TestLocalBuildDependenciesOnly(t *testing.T) { file := testutil.MakeTempCopy(t, "files/yaml.yaml") dir := testutil.MakeTempDir(t) - kamelBuild := KamelWithContext(ctx, "local", "build", file, "--integration-directory", dir, "--dependencies-only", "-d", "camel-amqp") + kamelBuild := kamelWithContextAndMaybeStaging(ctx, "local", "build", file, "--integration-directory", dir, "--dependencies-only", "-d", "camel-amqp") go func() { err := kamelBuild.Execute() @@ -222,7 +222,7 @@ func TestLocalBuildModelineDependencies(t *testing.T) { file := testutil.MakeTempCopy(t, "files/dependency.groovy") dir := testutil.MakeTempDir(t) - kamelBuild := KamelWithContext(ctx, "local", "build", file, "--integration-directory", dir, "-d", "camel-amqp") + kamelBuild := kamelWithContextAndMaybeStaging(ctx, "local", "build", file, "--integration-directory", dir, "-d", "camel-amqp") go func() { err := kamelBuild.Execute() diff --git a/e2e/local/local_run_test.go b/e2e/local/local_run_test.go index cef5112b1f..8be0935538 100644 --- a/e2e/local/local_run_test.go +++ b/e2e/local/local_run_test.go @@ -45,7 +45,7 @@ func TestLocalRun(t *testing.T) { file := testutil.MakeTempCopy(t, "files/yaml.yaml") - kamelRun := KamelWithContext(ctx, "local", "run", file) + kamelRun := kamelWithContextAndMaybeStaging(ctx, "local", "run", file) kamelRun.SetOut(pipew) kamelRun.SetErr(pipew) @@ -71,7 +71,7 @@ func TestLocalRunWithDependencies(t *testing.T) { file := testutil.MakeTempCopy(t, "files/dependency.groovy") - kamelRun := KamelWithContext(ctx, "local", "run", file, "-d", "camel-amqp") + kamelRun := kamelWithContextAndMaybeStaging(ctx, "local", "run", file, "-d", "camel-amqp") kamelRun.SetOut(pipew) kamelRun.SetErr(pipew) @@ -98,7 +98,7 @@ func TestLocalRunContainerize(t *testing.T) { file := testutil.MakeTempCopy(t, "files/yaml.yaml") image := "test/test-" + strings.ToLower(util.RandomString(10)) - kamelRun := KamelWithContext(ctx, "local", "run", file, "--image", image, "--containerize") + kamelRun := kamelWithContextAndMaybeStaging(ctx, "local", "run", file, "--image", image, "--containerize") kamelRun.SetOut(pipew) kamelRun.SetErr(pipew) @@ -124,7 +124,7 @@ func TestLocalRunIntegrationDirectory(t *testing.T) { file := testutil.MakeTempCopy(t, "files/yaml.yaml") dir := testutil.MakeTempDir(t) - kamelBuild := KamelWithContext(ctx1, "local", "build", file, "--integration-directory", dir) + kamelBuild := kamelWithContextAndMaybeStaging(ctx1, "local", "build", file, "--integration-directory", dir) go func() { err := kamelBuild.Execute() @@ -142,7 +142,7 @@ func TestLocalRunIntegrationDirectory(t *testing.T) { defer pipew.Close() defer piper.Close() - kamelRun := KamelWithContext(ctx2, "local", "run", "--integration-directory", dir) + kamelRun := kamelWithContextAndMaybeStaging(ctx2, "local", "run", "--integration-directory", dir) kamelRun.SetOut(pipew) kamelRun.SetErr(pipew) diff --git a/e2e/local/util.go b/e2e/local/util.go index 1cbd7d0671..f10d279a93 100644 --- a/e2e/local/util.go +++ b/e2e/local/util.go @@ -21,12 +21,17 @@ limitations under the License. package local import ( + "context" + "os" "os/exec" "strings" . "github.com/apache/camel-k/e2e/support" + "github.com/spf13/cobra" ) +var runtimeRepo = os.Getenv("STAGING_RUNTIME_REPO") + func Docker(args ...string) string { cmd := exec.CommandContext(TestContext, "docker", args...) out, err := cmd.Output() @@ -48,3 +53,10 @@ func StopDockerContainers() { Docker(args...) } } + +func kamelWithContextAndMaybeStaging(ctx context.Context, args ...string) *cobra.Command { + if runtimeRepo != "" { + args = append(args, "--maven-repository", runtimeRepo) + } + return KamelWithContext(ctx, args...) +}