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
make -V/--version fast on Windows #8508
make -V/--version fast on Windows #8508
Conversation
Jenkins test this please |
I've seen some windows tests in *nix version tests use rspec, so there is the const containing the version. But I'm not sure if it is possible to test the batch file like this too. |
@jakelandis @colinsurprenant I think the above is a question for one of you guys :) |
I would like tests added for this. The proposal is simple (shortcut showing the verson) but the implementation is complex and fragile (nobody on the team is an expert in DOS batch, so this may break without us realizing it). |
bin/logstash.bat
Outdated
goto end | ||
|
||
:version | ||
set "LOGSTASH_VERSION_FILE1=%LOGSTASH_HOME%/logstash-core/versions-gem-copy.yml" |
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.
should this be LS_HOME
instead of LOGSTASH_HOME
? This is the first reference to LOGSTASH_HOME
I see in this file, but LS_HOME
is referenced several times.
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.
Thanks. Fixed.
@jordansissel I totally agree that it needs to be tested. I'm not sure how to do it though. It seems that there are tests in PowerShell script, but there is no version number variable, as stated above. Putting the same logic to extract the version number from the same files as in batch is doable, but I'm not sure if it makes sense. Unless it should be tested in rspec (not sure if it's suitable for rspec tests). |
@czlowieq I think rspec tests are fine for this case. Have you seen the tests in https://github.com/elastic/logstash/tree/master/qa/scripts/windows ? |
Blah, I misspoke, those are all powershell, but that should be fine :) |
@andrewvc Yeah, seen those. But still, I'm not sure if there is a version number I can easily get in those scripts, so I can compare it with the command result. Any ideas? |
what this would require is integration testing and we don't have a good story for that yet on Windows. Personally I am ok if we end up merging this without test IIF it has been throughly manually tested and we have other tests for the I will go ahead and review this shortly. Let me know if anyone has concerns in moving forward like this. |
bin/logstash.bat
Outdated
if "%LS_HOME%" == "" ( | ||
for %%a in ("%~dp0..") do set "LS_HOME=%%~fa" | ||
) | ||
|
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.
this LS_HOME
handling is no required since the first thing this bat file does is to call setup.bat
which handle the setup of LS_HOME
see
Lines 5 to 19 in 40827a5
rem ### 1: determine logstash home | |
rem to do this, we strip from the path until we | |
rem find bin, and then strip bin (there is an assumption here that there is no | |
rem nested directory under bin also named bin) | |
for %%I in (%SCRIPT%) do set LS_HOME=%%~dpI | |
:ls_home_loop | |
for %%I in ("%LS_HOME:~1,-1%") do set DIRNAME=%%~nxI | |
if not "%DIRNAME%" == "bin" ( | |
for %%I in ("%LS_HOME%..") do set LS_HOME=%%~dpfI | |
goto ls_home_loop | |
) | |
for %%I in ("%LS_HOME%..") do set LS_HOME=%%~dpfI |
bin/logstash.bat
Outdated
) | ||
) | ||
) | ||
echo "logstash !LOGSTASH_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.
++ this seems consistent with the bash version logic. will manually test shortly. 👍
@czlowieq good stuff. I left a few comments - please check about the |
@czlowieq could you please rebase and resolve conflicts? sorry about that, once done I will prioritize testing so we can go ahead and merge. Thanks. |
@colinsurprenant Should I squash the commits into one or leave them as is? |
@czlowieq sure - it will have to be done anyway before merging so ... |
92283e2
to
2d7c4bb
Compare
Since this is a community submitted pull request, a Jenkins build has not been kicked off automatically. Can an Elastic organization member please verify the contents of this patch and then kick off a build manually? |
Jenkins please test this |
bin/logstash.bat
Outdated
) | ||
) | ||
) | ||
echo "logstash !LOGSTASH_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.
this outputs the following:
C:\Users\colin\dev\logstash (pr/8508)
λ bin\logstash -V
"logstash 7.0.0-alpha1"
C:\Users\colin\dev\logstash (pr/8508)
λ bin\logstash --version
"logstash 7.0.0-alpha1"
To be consistent with the Linux behaviour we should remote the quotes from the output, it should be
echo logstash !LOGSTASH_VERSION!
@czlowieq while manually testing, I noticed that the version string is quoted which is different from the Linux output. Please correct this, then we should be good. |
2d7c4bb
to
9ffc83a
Compare
@colinsurprenant Thanks. Fixed it. |
LGTM - merging! |
Merged into master and 6.x |
Do not run logstash when checking version on windows
Fixes #5526