How to update JDK on Jenkins Server cartridge (OpenShift)?

让人想犯罪 __ 提交于 2019-12-10 19:59:29

问题


The Jenkins Server cartridge (OpenShift) uses OpenJDK 7u55.

How to update to OpenJDK 7u60 or 8u05 or Oracle JDK (7u60 or 8u05), please?


回答1:


You can do this using OpenShift's action hooks. Add a script which will check for the existence of the JDK you want to use, and download it if it doesn't exist.

For example, in .openshift/action_hooks/deploy, add this snippet:

#! /bin/bash
JDK_HOME=$OPENSHIFT_DATA_DIR/jdk1.8.0

if [[ ! -L $JDK_HOME && ! -d $JDK_HOME ]] 
  then 
  cd $OPENSHIFT_DATA_DIR
  wget http://www.java.net/download/jdk8u20/archive/b17/binaries/jdk-8u20-ea-bin-b17-linux-x64-04_jun_2014.tar.gz
  tar xvf *.tar.gz 
  rm -f *.tar.gz
  ln -s jdk1.8.0_20 jdk1.8.0
fi

In Jenkins, you can then configure builds to use this JDK by configuring the PATH variable, in an "Execute Shell" action, like so:

export PATH=$OPENSHIFT_DATA_DIR/jdk1.8.0/bin:$PATH

This example retrieves 8u20. Sorry, I'm not sure of the links to use for the exact versions you mention. Also, word of warning, this download is over HTTP, without performing a check against the published MD5 checksums. If you're doing anything serious, you should edit to code snippet to perform that check.



来源:https://stackoverflow.com/questions/24513572/how-to-update-jdk-on-jenkins-server-cartridge-openshift

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!