Hashar has uploaded a new change for review. (
https://gerrit.wikimedia.org/r/382217 )
Change subject: jenkins: switch to Java8
......................................................................
jenkins: switch to Java8
The next Jenkins version requires Java 8 and we thus have to switch to
it before upgrading. We were stuck to Java 7 since we had slaves on
Trusty which lacked Java 8 but they have all been reclaimed.
master (::jenkins) and slaves (::jenkins::slave::requisites) are
switched to java 8 be it on Jessie or Stretch. Thus remove the stretch
conditional.
The Jenkins master is driven by systemd which uses /usr/bin/java and the
slaves use /usr/bin/java to start. Thus select the Java 8 alternative
for /usr/bin/java
NOTE: for other tools, one would have to manually run:
update-java-alternatives --set java-1.8.0-openjdk-amd64
The reason it is done manually is that there is no good way to list all
the alternatives and the version they point to. That does not affect
the service though, setting the alternative is merely a convenience for
interactive use.
Bug: T162828
Change-Id: I7f761484f092e3c04ee6d8069ecbb653248cb85f
---
M modules/jenkins/manifests/init.pp
M modules/jenkins/manifests/slave/requisites.pp
2 files changed, 13 insertions(+), 16 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/operations/puppet
refs/changes/17/382217/1
diff --git a/modules/jenkins/manifests/init.pp
b/modules/jenkins/manifests/init.pp
index df9e2a3..99aa47f 100644
--- a/modules/jenkins/manifests/init.pp
+++ b/modules/jenkins/manifests/init.pp
@@ -59,15 +59,14 @@
allowdupe => false,
}
- # We want to run Jenkins under Java 7.
- # (unless when we are on stretch and there is no Java 7 anymore)
- if os_version('debian >= stretch') {
- $jdk_version = '8'
- } else {
- $jdk_version = '7'
+ ensure_packages('openjdk-8-jdk')
+
+ # Make sure sure Java 8 in case another Java version is installed with an
+ # higher priority in alternatives.
+ alternatives::select { 'java':
+ path => '/usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java',
+ require => Package['openjdk-8-jdk'],
}
- $jdk_package = "openjdk-${jdk_version}-jdk"
- ensure_packages($jdk_package)
# Upgrades are usually done manually by upload the Jenkins
# package at apt.wikimedia.org then restarting jenkins and
diff --git a/modules/jenkins/manifests/slave/requisites.pp
b/modules/jenkins/manifests/slave/requisites.pp
index 9eea8a1..697ee2b 100644
--- a/modules/jenkins/manifests/slave/requisites.pp
+++ b/modules/jenkins/manifests/slave/requisites.pp
@@ -3,14 +3,12 @@
# Dependency for the Jenkins agent on slaves
#
class jenkins::slave::requisites() {
+ ensure_packages('openjdk-8-jre-headless')
- if os_version('debian >= stretch') {
- $jdk_version = '8'
- } else {
- $jdk_version = '7'
+ # When a slave happen to have another jre installed, make sure 8 is the
+ # default.
+ alternatives::select { 'java':
+ path => '/usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java',
+ require => Package['openjdk-8-jre-headless'],
}
-
- $jdk_package = "openjdk-${jdk_version}-jre-headless"
-
- ensure_packages($jdk_package)
}
--
To view, visit https://gerrit.wikimedia.org/r/382217
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I7f761484f092e3c04ee6d8069ecbb653248cb85f
Gerrit-PatchSet: 1
Gerrit-Project: operations/puppet
Gerrit-Branch: production
Gerrit-Owner: Hashar <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits