From c9fa14604397613b7b3c078182300fd5a824b075 Mon Sep 17 00:00:00 2001 From: David Simansky Date: Thu, 22 Feb 2024 16:04:52 +0100 Subject: [PATCH] [release-v1.11] update workflow plugin to 1.32.1 (#364) * [release-v1.11] update workflow plugin to 1.32.1 * [release-v1.11] pin e2e setup branch to release --- go.mod | 2 +- go.sum | 4 +- openshift/e2e-common.sh | 2 +- .../kn-plugin-workflow/pkg/command/run.go | 8 ++-- .../pkg/common/containers.go | 40 ++++++++++++------- .../pkg/metadata/constants.go | 3 +- vendor/modules.txt | 4 +- 7 files changed, 38 insertions(+), 25 deletions(-) diff --git a/go.mod b/go.mod index 638d89a6cf..63564523b0 100644 --- a/go.mod +++ b/go.mod @@ -287,7 +287,7 @@ require ( replace ( github.com/apache/incubator-kie-kogito-serverless-operator/api v0.0.0 => github.com/apache/incubator-kie-kogito-serverless-operator/api v0.0.0-20240126134605-2b5056d12bb9 - github.com/apache/incubator-kie-tools/packages/kn-plugin-workflow => github.com/kiegroup/kie-tools/packages/kn-plugin-workflow v1.32.0 + github.com/apache/incubator-kie-tools/packages/kn-plugin-workflow => github.com/kiegroup/kie-tools/packages/kn-plugin-workflow v1.32.1 // Workflow plugin github.com/imdario/mergo => github.com/imdario/mergo v0.3.16 diff --git a/go.sum b/go.sum index cdff643235..c6b5cd65a0 100644 --- a/go.sum +++ b/go.sum @@ -1241,8 +1241,8 @@ github.com/kelseyhightower/envconfig v1.4.0 h1:Im6hONhd3pLkfDFsbRgu68RDNkGF1r3dv github.com/kelseyhightower/envconfig v1.4.0/go.mod h1:cccZRl6mQpaq41TPp5QxidR+Sa3axMbJDNb//FQX6Gg= github.com/kevinburke/ssh_config v1.2.0 h1:x584FjTGwHzMwvHx18PXxbBVzfnxogHaAReU4gf13a4= github.com/kevinburke/ssh_config v1.2.0/go.mod h1:CT57kijsi8u/K/BOFA39wgDQJ9CxiF4nAY/ojJ6r6mM= -github.com/kiegroup/kie-tools/packages/kn-plugin-workflow v1.32.0 h1:bOdIgHoc6iEimt+ld20V6DDXNV3HEom92/aZk0clmEo= -github.com/kiegroup/kie-tools/packages/kn-plugin-workflow v1.32.0/go.mod h1:2cSJdS2W6sbYkSM4ytRnNcIP9l5mVGoOgvfryL1cG7U= +github.com/kiegroup/kie-tools/packages/kn-plugin-workflow v1.32.1 h1:lZ2pzt9wdbAufllA6IInMgGKfa3Lc1ITA1ivTCydLQA= +github.com/kiegroup/kie-tools/packages/kn-plugin-workflow v1.32.1/go.mod h1:AX3nCQLg1hH+jj1bnSmszZwpsq+kdkUCIwhpNNe0ZLc= github.com/kisielk/errcheck v1.1.0/go.mod h1:EZBBE59ingxPouuu3KfxchcWSUPOHkagtvWXihfKN4Q= github.com/kisielk/errcheck v1.2.0/go.mod h1:/BMXB+zMLi60iA8Vv6Ksmxu/1UDYcXs4uQLJ+jE2L00= github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= diff --git a/openshift/e2e-common.sh b/openshift/e2e-common.sh index f53f69002d..01110b7192 100755 --- a/openshift/e2e-common.sh +++ b/openshift/e2e-common.sh @@ -31,7 +31,7 @@ readonly SERVING_BRANCH="release-next" readonly EVENTING_BRANCH="release-next" # The value should be updated once S-O release branch is cut -readonly SERVERLESS_BRANCH="main" +readonly SERVERLESS_BRANCH="release-1.32" # Determine if we're running locally or in CI. if [ -n "$OPENSHIFT_BUILD_NAMESPACE" ]; then diff --git a/vendor/github.com/apache/incubator-kie-tools/packages/kn-plugin-workflow/pkg/command/run.go b/vendor/github.com/apache/incubator-kie-tools/packages/kn-plugin-workflow/pkg/command/run.go index 7f83254c4b..ec0393d983 100644 --- a/vendor/github.com/apache/incubator-kie-tools/packages/kn-plugin-workflow/pkg/command/run.go +++ b/vendor/github.com/apache/incubator-kie-tools/packages/kn-plugin-workflow/pkg/command/run.go @@ -100,12 +100,12 @@ func runDevCmdConfig() (cfg RunCmdConfig, err error) { func runSWFProject(cfg RunCmdConfig) error { - if errDocker := common.CheckDocker(); errDocker == nil { - if err := runSWFProjectDevMode(common.Docker, cfg); err != nil { + if errPodman := common.CheckPodman(); errPodman == nil { + if err := runSWFProjectDevMode(common.Podman, cfg); err != nil { return err } - } else if errDocker := common.CheckPodman(); errDocker == nil { - if err := runSWFProjectDevMode(common.Podman, cfg); err != nil { + } else if errDocker := common.CheckDocker(); errDocker == nil { + if err := runSWFProjectDevMode(common.Docker, cfg); err != nil { return err } } else { diff --git a/vendor/github.com/apache/incubator-kie-tools/packages/kn-plugin-workflow/pkg/common/containers.go b/vendor/github.com/apache/incubator-kie-tools/packages/kn-plugin-workflow/pkg/common/containers.go index 5924a78b6f..d4db79d6fb 100644 --- a/vendor/github.com/apache/incubator-kie-tools/packages/kn-plugin-workflow/pkg/common/containers.go +++ b/vendor/github.com/apache/incubator-kie-tools/packages/kn-plugin-workflow/pkg/common/containers.go @@ -28,6 +28,7 @@ import ( "os" "os/exec" "os/signal" + "runtime" "strings" "syscall" @@ -61,10 +62,10 @@ func getDockerClient() (*client.Client, error) { func GetContainerID(containerTool string) (string, error) { switch containerTool { - case Docker: - return getDockerContainerID() case Podman: return getPodmanContainerID() + case Docker: + return getDockerContainerID() default: return "", fmt.Errorf("no matching container type found") } @@ -76,10 +77,13 @@ func getPodmanContainerID() (string, error) { "-a", "--filter", fmt.Sprintf("ancestor=%s", metadata.DevModeImage), + "--filter", + "status=running", "--format", "{{.ID}}") + fmt.Println(cmd) output, err := cmd.CombinedOutput() if err != nil { - return "", fmt.Errorf("error getting container id: %w", err) + return "", fmt.Errorf("error getting podman container id: %w", err) } containerID := strings.TrimSpace(string(output)) return containerID, nil @@ -130,20 +134,29 @@ func StopContainer(containerTool string, containerID string) error { return nil } +func resolveVolumeBindPath(containerTool string) string { + if containerTool == "podman" && runtime.GOOS == "linux" { + return metadata.VolumeBindPathSELinux + } + return metadata.VolumeBindPath +} + func RunContainerCommand(containerTool string, portMapping string, path string) error { + volumeBindPath := resolveVolumeBindPath(containerTool) fmt.Printf("🔎 Warming up SonataFlow containers (%s), this could take some time...\n", metadata.DevModeImage) if containerTool == Podman { + c := exec.Command( + containerTool, + "run", + "--rm", + "-p", + fmt.Sprintf("%s:8080", portMapping), + "-v", + fmt.Sprintf("%s:%s", path, volumeBindPath), + fmt.Sprintf("%s", metadata.DevModeImage), + ) if err := RunCommand( - exec.Command( - containerTool, - "run", - "--rm", - "-p", - fmt.Sprintf("%s:8080", portMapping), - "-v", - fmt.Sprintf("%s:%s", path, metadata.VolumeBindPath), - fmt.Sprintf("%s", metadata.DevModeImage), - ), + c, "container run", ); err != nil { return err @@ -164,7 +177,6 @@ func GracefullyStopTheContainerWhenInterrupted(containerTool string) { go func() { <-c // Wait for the interrupt signal - containerID, err := GetContainerID(containerTool) if err != nil { fmt.Printf("\nerror getting container id: %v\n", err) diff --git a/vendor/github.com/apache/incubator-kie-tools/packages/kn-plugin-workflow/pkg/metadata/constants.go b/vendor/github.com/apache/incubator-kie-tools/packages/kn-plugin-workflow/pkg/metadata/constants.go index cbc23d400e..7a1f5c6b90 100644 --- a/vendor/github.com/apache/incubator-kie-tools/packages/kn-plugin-workflow/pkg/metadata/constants.go +++ b/vendor/github.com/apache/incubator-kie-tools/packages/kn-plugin-workflow/pkg/metadata/constants.go @@ -82,7 +82,8 @@ const ( DockerInternalPort = "8080/tcp" // VolumeBindPath The :z is to let docker know that the volume content can be shared between containers(SELinux) - VolumeBindPath = "/home/kogito/serverless-workflow-project/src/main/resources:z" + VolumeBindPathSELinux = "/home/kogito/serverless-workflow-project/src/main/resources:z" + VolumeBindPath = "/home/kogito/serverless-workflow-project/src/main/resources" DashboardsDefaultDirName = "dashboards" ) diff --git a/vendor/modules.txt b/vendor/modules.txt index b127c5a0f3..58c5859b49 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -96,7 +96,7 @@ github.com/apache/incubator-kie-kogito-serverless-operator/api/v1alpha08 # github.com/apache/incubator-kie-kogito-serverless-operator/workflowproj v0.0.0-20240126134605-2b5056d12bb9 ## explicit; go 1.21 github.com/apache/incubator-kie-kogito-serverless-operator/workflowproj -# github.com/apache/incubator-kie-tools/packages/kn-plugin-workflow v0.33.0 => github.com/kiegroup/kie-tools/packages/kn-plugin-workflow v1.32.0 +# github.com/apache/incubator-kie-tools/packages/kn-plugin-workflow v0.33.0 => github.com/kiegroup/kie-tools/packages/kn-plugin-workflow v1.32.1 ## explicit; go 1.20 github.com/apache/incubator-kie-tools/packages/kn-plugin-workflow/pkg/command github.com/apache/incubator-kie-tools/packages/kn-plugin-workflow/pkg/command/quarkus @@ -2293,7 +2293,7 @@ sigs.k8s.io/structured-merge-diff/v4/value ## explicit; go 1.12 sigs.k8s.io/yaml sigs.k8s.io/yaml/goyaml.v2 -# github.com/apache/incubator-kie-tools/packages/kn-plugin-workflow => github.com/kiegroup/kie-tools/packages/kn-plugin-workflow v1.32.0 +# github.com/apache/incubator-kie-tools/packages/kn-plugin-workflow => github.com/kiegroup/kie-tools/packages/kn-plugin-workflow v1.32.1 # github.com/imdario/mergo => github.com/imdario/mergo v0.3.16 # github.com/manifestival/client-go-client => github.com/manifestival/client-go-client v0.5.1-0.20240212170846-db471987b889 # k8s.io/api => k8s.io/api v0.27.10