-
-
Notifications
You must be signed in to change notification settings - Fork 144
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
Adapting templates to state of 8.7.1 tarball, while keeping required … #329
Closed
SimonHoenscheid
wants to merge
1
commit into
voxpupuli:master
from
SimonHoenscheid:shoenscheid_rebase_dodevops_bugfix-issue-300
Closed
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,58 @@ | ||
#!/bin/sh | ||
# This file is managed by Puppet | ||
|
||
# This file should be identical to 'check-java.sh' in the Jira 7.0.4 standalone | ||
# This file should be identical to 'check-java.sh' in the Jira 8.7.1 standalone | ||
# tarball. | ||
|
||
_EXPECTED_JAVA_VERSION="8" | ||
|
||
# | ||
# check for correct java version by parsing out put of java -version | ||
# we expect first line to be in format 'java version "1.8.0_40"' and assert that minor version number will be 8 or higher | ||
# we expect first line to be in format 'java version "1.8.0_161"' or 'java version "10.0.1" 2018-04-17' | ||
# or 'openjdk version "11-ea" 2018-09-25' and assert that version number will be 8 or 11 (if enabled) | ||
# or sth like 'Picked up JDK_JAVA_OPTIONS:' (which we need to skip) | ||
# | ||
|
||
"$_RUNJAVA" -version 2>&1 | grep "java version" | ( | ||
IFS=. read ignore1 version ignore2 | ||
if [ ! ${version:-0} -ge "$_EXPECTED_JAVA_VERSION" ] | ||
then | ||
echo "*************************************************************************************************************************************" | ||
echo "********** Wrong JVM version! You are running with "$ignore1"."$version"."$ignore2" but JIRA requires at least 1.8 to run. **********" | ||
echo "*************************************************************************************************************************************" | ||
exit 1 | ||
fi | ||
) | ||
if [ $? -ne 0 ] ; then | ||
exit 1 | ||
java_raw_version=`echo "$($_RUNJAVA -version 2>&1)" | grep -v "JDK_JAVA_OPTIONS" | grep "version" | awk '{ print substr($3, 2, length($3)-2); }'` | ||
java_version=0 | ||
|
||
if [[ $java_raw_version = *-ea* ]] | ||
then | ||
# early access format e.g 11-ea | ||
IFS='-' read -a values <<< "$java_raw_version" | ||
java_version=${values[0]} | ||
else | ||
if [[ $java_raw_version = 1.* ]] | ||
then | ||
# old format e.g. 1.8.0_161 | ||
IFS='.' read -a values <<< "$java_raw_version" | ||
java_version=${values[1]} | ||
else | ||
# new format e.g. 10.0.1 | ||
IFS='.' read -a values <<< "$java_raw_version" | ||
java_version=${values[0]} | ||
fi | ||
fi | ||
|
||
if [ $java_version -ne 8 ] && [ $java_version -ne 11 ] | ||
then | ||
echo "****************************************************************************" | ||
echo "******* Wrong JVM version! Jira requires 1.8 or 11 to run. *******" | ||
echo "****************************************************************************" | ||
echo "***" | ||
echo "*** Output of java -version command is:" | ||
$_RUNJAVA -version 2>&1 | ||
echo "*** (End of output) ***" | ||
echo "***" | ||
if [ "$ignore_jvm_version" = "true" ] | ||
then | ||
echo "*** Environment variable 'ignore_jvm_version' is set to 'true'" | ||
echo "*** Jira is going to bypass restriction and run using existing JVM version" | ||
echo "***" | ||
echo "****************************************************************************" | ||
else | ||
echo "*** If you want Jira to start using this JVM" | ||
echo "*** set environment variable 'ignore_jvm_version' to 'true'" | ||
echo "***" | ||
echo "****************************************************************************" | ||
exit 1 | ||
fi | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
shouldn't this be behind a check which version of java we're on?
see discussion here: #326
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.
Well, we would need to decide how.
Either we put a dependency to the puppetlabs-java module and use its facts. However this adds a whole module to be aware of, just for that "little" fact. Many users use it to install the needed Javas (like we do), but not all i would guess.
Another option would be a custom fact to this module which should have a special name like "...jira_java..." or so to not conflict with the facts of puppetlabs-java (for the people who use that module to install the needed java). Code could be copied from puppetlabs-java. This could also have the advantage of checking the java with the user, which will actually run Jira.
Or we leave it completely up to configuration with a required variable somewhat like discussed in #326 , forcing the user to set it, but that is no smart way in my opinion.
Any opinions/favourites?
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.
can we try use the facts without depending on it?
we'd have to do it defensively, but so does every module which relies on facts that are only available after the software has been installed, i.e.: after it was run, so it's not like we'd be breaking new ground here
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.
@igalic I dont get you completely. You mean to use the facts from puppetlabs-java, but without setting the dependencies in metadata.json? That is not smart in my opinion, because then we would need to tell in the documentation, that for proper JVM_GC_ARGS variables one needs to install puppetlabs-java.
There is another thing: #326 was created, because Java 11 does not like "PrintGCTimeStamps", however "PrintGCTimeStamps" is not in the upstream code anymore for Jira 8.7.1. If we want to be downwards-compatible with older Jira version, we have a problem. Alternative could be that we say, the new release of the module is only compatible with Jira 8.7.1 and newer. Or we remove the "PrintGCTimeStamps" also for older Jira releases.
Also java version check is not enough, for java 11 we might need to compare the value of jira::jvm_xmx also.
My proposals would be the following:
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 would also put the following in consideration: which Jira versions are still supported and which Java versions are supported by these versions? Write this in the documentation. Going for the smallest commonality. I am fine with depending on puppetlabs-java and would write documentation for 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.
Jira 7.12 to 8.12 is supported, 7.12 only has support for OracleJava 8, 7.13 to 8.1 have support for Oracle & OpenJDK8. 8.2 Onwards has Java11 support.
Here are the EOL Dates:
8.1 (EOL Date: Apr 4, 2021)
8.0 (EOL Date: Feb 11, 2021)
7.13 (EOL Date: Nov 28, 2020)
7.12 (EOL Date: Aug 27, 2020)
Since 7.12 just dropped out of support, it's much easier to maintain, because openJDK/JRE is always available
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.
@timdeluxe, @SimonHoenscheid In #326 I've added the 'jvm_type' parameter, which can be set to the used JVM version, which is used in setenv.sh and other configurations.
The current changes in #326 tackle the following aspects of your comment:
As you asked, I've set the default to 'oracle-jdk-1.8' and left the default parameters for jvm_optional, jvm_extra_args, jvm_gc_args, jvm_codecache_args empty. If someone chooses to use JDK 11, the jvm type can be set to openjdk-11 or even to custom if parameters don't line up.
I wonder if we would need to add something like "jvm_gc_args_additional" variables, so that someone who chooses a 'jvm type != custom' does not need to fallback to custom if one parameter needs to be adjusted. I've put that one into my PR #326 as well, including a test. Another option would be, that we add the 'jvm_*' args if they are not empty and the jvm_type points to something default like 'oracle-jdk-1.8'. What do you think?
I think, leaving the jvm_type parameter empty is too much implicit behavior. If someone wants custom parameters to be set the behavior should be explicitly defined.
The PrintGCTimeStamps is a java parameter, it shouldn't be judged by the jira version.