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

[Task] Use xpath if it is available in cryostat scripts #1355

Closed
maxcao13 opened this issue Feb 2, 2023 · 3 comments · Fixed by #1356
Closed

[Task] Use xpath if it is available in cryostat scripts #1355

maxcao13 opened this issue Feb 2, 2023 · 3 comments · Fixed by #1356
Assignees
Labels
chore Refactor, rename, cleanup, etc.

Comments

@maxcao13
Copy link
Member

maxcao13 commented Feb 2, 2023

since the main cryostat image smoketest takes a bit longer with the new mvn:evaluate changes vs the old xpath.

Yea, this is unfortunate, but it's probably overall nicer that the script no longer requires xpath to be installed. Maybe the script should check if xpath is available and use it if so, falling back to mvn:evaluate if not.

Originally posted by @andrewazores in cryostatio/cryostat-web#842 (comment)

Related to https://github.com/cryostatio/cryostat/pull/1249

@maxcao13 maxcao13 self-assigned this Feb 2, 2023
@maxcao13 maxcao13 added the chore Refactor, rename, cleanup, etc. label Feb 2, 2023
@andrewazores
Copy link
Member

Maybe the order of preference should be xpath > mvnd > mvn. Check for each of those on $PATH and use the first one available for reading the values from pom.xml. It's a little messy because the syntax for the whole command is different between xpath and mvn(d), but maybe there is a cleaner way to do it than having an if/else for every time a pom.xml property is read.

@maxcao13
Copy link
Member Author

maxcao13 commented Feb 2, 2023

Maybe the order of preference should be xpath > mvnd > mvn. Check for each of those on $PATH and use the first one available for reading the values from pom.xml. It's a little messy because the syntax for the whole command is different between xpath and mvn(d), but maybe there is a cleaner way to do it than having an if/else for every time a pom.xml property is read.

Does mvnd command syntax work like mvn ? For example, we can do mvnd help:evaluate -o -B -q -DforceStdout -Dexpression="$1" ? Then would overriding the envvar MVN=mvnd work? Assuming it works this way anyways.

@andrewazores
Copy link
Member

Yes, mvnd is generally a drop-in replacement for mvn:

mvnd -Dmvnd.rawStreams $@

This line from the ~/bin/mvn script I shared means that what I'm normally doing in my shell is typing ex. mvn clean package, which actually invokes the ~/bin/mvn script with the [clean, package] args. The script then forks a mvnd process with the args [-Dmvnd.rawStreams, clean, package]. Without the rawStreams property mvnd tags the log output with stdout/stderr which breaks some other scripting, so adding that property means the output format is also identical to standard mvn.

Then would overriding the envvar MVN=mvnd work?

This is actually why I've put that MVN=/usr/bin/mvn overrideable variable into a bunch of the scripts, it's a holdover from when I was first experimenting with mvnd and wanted to be able to do ex. MVN=~/bin/mvnd sh smoketest.sh or whatever.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
chore Refactor, rename, cleanup, etc.
Projects
No open projects
Status: Done
Development

Successfully merging a pull request may close this issue.

2 participants