Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

KOGITO-7740: KN Workflow plugin does not allow to use RHBQ version #1175

Merged
merged 4 commits into from
Aug 11, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions packages/kn-plugin-workflow/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ BIN_DARWIN_ARM64 ?= $(BIN)-darwin-arm64
BIN_LINUX ?= $(BIN)-linux-amd64
BIN_WINDOWS ?= $(BIN)-windows-amd64.exe

SET_QUARKUS_VERSION := main.quarkusVersion=$(QUARKUS_VERSION)
SET_KOGITO_VERSION := main.kogitoVersion=$(KOGITO_VERSION)
SET_VERSION := main.pluginVersion=$(PLUGIN_VERSION)
LDFLAGS := "-X $(SET_QUARKUS_VERSION) -X $(SET_KOGITO_VERSION) -X $(SET_VERSION)"
SET_QUARKUS_PLATFORM_GROUP_ID := main.quarkusPlatformGroupId=$(QUARKUS_PLATFORM_GROUP_ID)
SET_QUARKUS_VERSION := main.quarkusVersion=$(QUARKUS_VERSION)
SET_VERSION := main.pluginVersion=$(PLUGIN_VERSION)
LDFLAGS := "-X $(SET_QUARKUS_PLATFORM_GROUP_ID) -X $(SET_QUARKUS_VERSION) -X $(SET_VERSION)"

ARCH := $(shell uname -m)
ifeq ($(ARCH),arm64)
Expand Down
6 changes: 3 additions & 3 deletions packages/kn-plugin-workflow/cmd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,13 @@ import (
"github.com/kiegroup/kie-tools/packages/kn-plugin-workflow/pkg/root"
)

var quarkusVersion, kogitoVersion, pluginVersion string
var quarkusPlatformGroupId, quarkusVersion, pluginVersion string

func main() {
cfg := root.RootCmdConfig{
DependenciesVersion: common.DependenciesVersion{
QuarkusVersion: quarkusVersion,
KogitoVersion: kogitoVersion,
QuarkusPlatformGroupId: quarkusPlatformGroupId,
QuarkusVersion: quarkusVersion,
},
PluginVersion: pluginVersion,
}
Expand Down
12 changes: 6 additions & 6 deletions packages/kn-plugin-workflow/env/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,23 +24,23 @@ module.exports = composeEnv([require("@kie-tools/build-env/env")], {
default: packageJson.version,
description: "Knative Workflow plugin version",
},
KN_PLUGIN_WORKFLOW__quarkusPlatformGroupId: {
name: "KN_PLUGIN_WORKFLOW__quarkusPlatformGroupId",
default: "io.quarkus.platform",
description: "Quarkus group to be used when creating the Kogito Serverless Workflow project",
},
KN_PLUGIN_WORKFLOW__quarkusVersion: {
name: "KN_PLUGIN_WORKFLOW__quarkusVersion",
default: "2.10.0.Final",
description: "Quarkus version to be used when creating the Kogito Serverless Workflow project",
},
KN_PLUGIN_WORKFLOW__kogitoVersion: {
name: "KN_PLUGIN_WORKFLOW__kogitoVersion",
default: "1.24.0.Final",
description: "Kogito version to be used when creating the Kogito Serverless Workflow project",
},
}),
get env() {
return {
knPluginWorkflow: {
version: getOrDefault(this.vars.KN_PLUGIN_WORKFLOW__version),
quarkusPlatformGroupId: getOrDefault(this.vars.KN_PLUGIN_WORKFLOW__quarkusPlatformGroupId),
quarkusVersion: getOrDefault(this.vars.KN_PLUGIN_WORKFLOW__quarkusVersion),
kogitoVersion: getOrDefault(this.vars.KN_PLUGIN_WORKFLOW__kogitoVersion),
},
};
},
Expand Down
1 change: 0 additions & 1 deletion packages/kn-plugin-workflow/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ require (
github.com/briandowns/spinner v1.18.1
github.com/ory/viper v1.7.5
github.com/spf13/cobra v1.4.0
gopkg.in/yaml.v3 v3.0.1
)

require (
Expand Down
2 changes: 0 additions & 2 deletions packages/kn-plugin-workflow/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -94,5 +94,3 @@ gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY=
gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ=
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
4 changes: 2 additions & 2 deletions packages/kn-plugin-workflow/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@
"build:win32": "pnpm setup:env:win32 make build-win32",
"install": "go mod tidy",
"powershell": "@powershell -NoProfile -ExecutionPolicy Unrestricted -Command",
"setup:env": "cross-env QUARKUS_VERSION=$(build-env knPluginWorkflow.quarkusVersion) KOGITO_VERSION=$(build-env knPluginWorkflow.kogitoVersion) PLUGIN_VERSION=$(build-env knPluginWorkflow.version)",
"setup:env:win32": "pnpm powershell \"cross-env QUARKUS_VERSION=$(build-env knPluginWorkflow.quarkusVersion) KOGITO_VERSION=$(build-env knPluginWorkflow.kogitoVersion) PLUGIN_VERSION=$(build-env knPluginWorkflow.version)\"",
"setup:env": "cross-env QUARKUS_PLATFORM_GROUP_ID=$(build-env knPluginWorkflow.quarkusPlatformGroupId) QUARKUS_VERSION=$(build-env knPluginWorkflow.quarkusVersion) PLUGIN_VERSION=$(build-env knPluginWorkflow.version)",
"setup:env:win32": "pnpm powershell \"cross-env QUARKUS_PLATFORM_GROUP_ID=$(build-env knPluginWorkflow.quarkusPlatformGroupId) QUARKUS_VERSION=$(build-env knPluginWorkflow.quarkusVersion) PLUGIN_VERSION=$(build-env knPluginWorkflow.version)\"",
"test": "go test ./..."
},
"devDependencies": {
Expand Down
21 changes: 11 additions & 10 deletions packages/kn-plugin-workflow/pkg/command/build.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ type BuildCmdConfig struct {
Verbose bool
}

func NewBuildCommand(dependenciesVersion common.DependenciesVersion) *cobra.Command {
func NewBuildCommand() *cobra.Command {
var cmd = &cobra.Command{
Use: "build",
Short: "Build a Kogito Serverless Workflow project and generate a container image",
Expand Down Expand Up @@ -94,7 +94,7 @@ func NewBuildCommand(dependenciesVersion common.DependenciesVersion) *cobra.Comm
}

cmd.RunE = func(cmd *cobra.Command, args []string) error {
_, err := runBuild(cmd, args, dependenciesVersion)
_, err := runBuild(cmd, args)
return err
}

Expand All @@ -114,7 +114,7 @@ func NewBuildCommand(dependenciesVersion common.DependenciesVersion) *cobra.Comm
return cmd
}

func runBuild(cmd *cobra.Command, args []string, dependenciesVersion common.DependenciesVersion) (out string, err error) {
func runBuild(cmd *cobra.Command, args []string) (out string, err error) {
start := time.Now()

cfg, err := runBuildCmdConfig(cmd)
Expand All @@ -137,12 +137,11 @@ func runBuild(cmd *cobra.Command, args []string, dependenciesVersion common.Depe
}
}

quarkusVersion, _, err := ReadConfig(dependenciesVersion)
if err != nil {
return
}

if err = runAddExtension(cfg, quarkusVersion); err != nil {
if err = runAddExtension(cfg); err != nil {
return
}

Expand Down Expand Up @@ -192,7 +191,7 @@ func runBuildCmdConfig(cmd *cobra.Command) (cfg BuildCmdConfig, err error) {
// This function removes the extension that is not going to be used (if present)
// and updates the chosen one. The entire operation is handled as an extension addition.
// Therefore the removal is hidden from the user
func runAddExtension(cfg BuildCmdConfig, quarkusVersion string) error {
func runAddExtension(cfg BuildCmdConfig) error {
if cfg.Jib || cfg.JibPodman {
fmt.Printf(" - Adding Quarkus Jib extension\n")
if err := common.RunExtensionCommand(
Expand All @@ -203,10 +202,11 @@ func runAddExtension(cfg BuildCmdConfig, quarkusVersion string) error {
); err != nil {
return err
}
if err := common.UpdateProjectExtensionsVersions(
if err := common.RunExtensionCommand(
cfg.Verbose,
"quarkus:add-extension",
common.GetFriendlyMessages("adding Quarkus extension"),
common.GetVersionedExtension(common.QUARKUS_CONTAINER_IMAGE_JIB, quarkusVersion),
common.QUARKUS_CONTAINER_IMAGE_JIB,
); err != nil {
return err
}
Expand All @@ -220,10 +220,11 @@ func runAddExtension(cfg BuildCmdConfig, quarkusVersion string) error {
); err != nil {
return err
}
if err := common.UpdateProjectExtensionsVersions(
if err := common.RunExtensionCommand(
cfg.Verbose,
"quarkus:add-extension",
common.GetFriendlyMessages("adding Quarkus extension"),
common.GetVersionedExtension(common.QUARKUS_CONTAINER_IMAGE_DOCKER, quarkusVersion),
common.QUARKUS_CONTAINER_IMAGE_DOCKER,
); err != nil {
return err
}
Expand Down
137 changes: 0 additions & 137 deletions packages/kn-plugin-workflow/pkg/command/config.go

This file was deleted.

Loading