-
Notifications
You must be signed in to change notification settings - Fork 193
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-7579: Knative Workflow - Specify Kogito version #1114
Conversation
Hi @spolti ! I've added you as a reviewer as I think you can add insightful feedback. @ricardozanini If you could take a look too, it would be great. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great work!
I might be missing something, but I'm missing the repository configuration. If the user sets the version like quarkus-redhat-000x
, how will maven download it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
very nice, just a few things.
} | ||
|
||
func RunExtensionCommand(verbose bool, extensionCommand string, friendlyMessages []string, extensions string) error { | ||
command := exec.Command("mvn", extensionCommand, fmt.Sprintf("-Dextensions=%s", extensions)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
how to check if the mvn is available in the path?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch. I should have checked the mvn
and Java
before the command starts with the CheckJavaDependencies
function that is in the check.go
file. I've forgotten to add this function call in the config
command.
func checkImageName(name string) (err error) { | ||
matched, err := regexp.MatchString("[a-z]([-a-z0-9]*[a-z0-9])?", name) | ||
if !matched { | ||
fmt.Println("ERROR: Image name should match [a-z]([-a-z0-9]*[a-z0-9])?") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you mind to add a example about what this regex should match? Users might find it difficult to read regex.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure
"github.com/spf13/cobra" | ||
) | ||
|
||
type ConfigCmdConfig struct { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe rename to CmdConfig only?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've adopt the "CmdConfig" name pattern. So the other commands names are "BuildCmdConfig", "CreateCmdConfig", etc. ConfigCmdConfig
it's not pretty, but it's what it is for this case.
return nil | ||
} | ||
|
||
func runConfigCmdConfig(cmd *cobra.Command) (cfg ConfigCmdConfig, err error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe rename?
return | ||
} | ||
|
||
func getUpdateExtensionFriendlyMessages() []string { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
isn't this duplicated?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No. I'm going to centralize all messages, I think it's going to be better to maintain it.
" might be missing something, but I'm missing the repository configuration. If the user sets the version like quarkus-redhat-000x, how will maven download it?" @ricardozanini , for now, to overcomplicate it, the user will have to have global settings configured. (This is probably the case if they use an RH distribution in their company). |
@spolti Hi, I believe I've covered all raised topics, do you have any other additional comment? @barboras7 Could you please take a look into this PR? |
Hi @ljmotta, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @ljmotta,
great work! I am leaving some minor comments below.
Also, one thing I noticed when testing the plugin manually:
When I create a project using kn workflow create --name myTesting
, I am able to do so. However, when I want to build this, I need to use mytesting
instead of myTesting
to succeed. Do you think you could add a validation for project creation to avoid such issues?
QuarkusVersion: quarkusVersion, | ||
KogitoVersion: kogitoVersion, | ||
}, | ||
Version: version, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It might be difficult in the future to understand what version
is. Would it be possible to use a more specific variable name?
} | ||
|
||
fmt.Println("✅ Quarkus extension was successfully add to the project") | ||
fmt.Println("✅ Quarkus extension was successfully add to the project pom.xml") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fmt.Println("✅ Quarkus extension was successfully add to the project pom.xml") | |
fmt.Println("✅ Quarkus extension was successfully added to the project pom.xml") |
return | ||
} | ||
|
||
// check if quarkus and kogito versions in the config file |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// check if quarkus and kogito versions in the config file | |
// check if quarkus and kogito versions are in the config file |
@barboras7 Sure thing. I'm going to add the validation and make the suggested changes. Thanks for reviewing. |
@barboras7 Actually, after I've started making the changes, I've realized that adding this validation in the create command wouldn't be the ideal. The create command creates a local folder for the user and each user have their own organization. The build generates a container image, therefore has its own name limitations and patterns, and don't need to follow the folder/project name. |
Thanks @ljmotta, I understand why you don't feel like the validation would be ideal. Maybe just a small suggestion - a log message at a warning level, when project name does not follow a correct image name pattern like |
* Parametrize Kogito version * Remove versions from staging and release build, and minor fixes * Add version and config file * Use env to set a custom quarkus and kogito version * Check env in main * Fix env * Add config file * Create version env * Extract file names to const * Cross compile to arm (macOS M1) * Add arm build script * Fix readme * Update the build extension version * Minor tweaks * Clean up * Remove both build extensions * Update dependencies versions in the config command * Add apply option * Update project version * Bumb up golang version * Update go.mod * PR review * Explain runAddExtension * Review
JIRAS
KOGITO-7579: Specify Kogito version
KOGITO-7485: macOS ARM build
KOGITO-7573: Verify image name
KOGITO-7607: Use Maven instead of Maven wrapper
On this PR
This PR adds the possibility to tweak the Kogito and Quarkus versions. Also, it adds some general improvements:
mvnw
andmvnw.cmd
.Specify Kogito and Quarkus version
During the project creation, it's possible to pass a
--quarkus-version
or the--kogito-version
flags in thecreate
command to set a specific Quarkus version and a Kogito version for the project.The
create
command now generates aworkflow.config.yml
file containing the versions, and those versions can be tweaked at any time.New commands
Show the plugin version:
Tweak the config file and apply those changes in the pom.xml:
Apply manual changes in the pom.xml: