Skip to content

Commit

Permalink
Merge pull request #25 from gocd-contrib/go-agent-on-java10-11
Browse files Browse the repository at this point in the history
Install JDK10 and JDK11
  • Loading branch information
GaneshSPatil authored Sep 26, 2018
2 parents 53f12c3 + 7338fe0 commit bff01f4
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 8 deletions.
2 changes: 1 addition & 1 deletion Dockerfile.centos6
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ ENTRYPOINT ["/usr/bin/tini", "--"]

USER go

CMD ["/bin/bash", "-lc", "/bootstrap.sh"]
CMD ["/bin/bash", "-lc", "with-java /bootstrap.sh"]
2 changes: 1 addition & 1 deletion Dockerfile.centos7
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ ENTRYPOINT ["/usr/bin/tini", "--"]

USER go

CMD ["/bin/bash", "-lc", "/bootstrap.sh"]
CMD ["/bin/bash", "-lc", "with-java /bootstrap.sh"]
24 changes: 18 additions & 6 deletions provision/provision.sh
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,19 @@ EOF
try gauge --version
}

function install_openjdk() {
function install_jdk8() {
try yum install --assumeyes java-1.8.0-openjdk java-1.8.0-openjdk-devel
try java -version
}

function install_jdk10() {
try su - go -c "jabba install [email protected]"
}

function install_jdk11() {
try su - go -c "jabba install [email protected]"
}

function install_native_build_packages() {
try yum install --assumeyes centos-release-scl # for gcc-6

Expand Down Expand Up @@ -122,7 +130,7 @@ else

try yum install --assumeyes git subversion

try mkdir -p /usr/local/bin
try mkdir -p /usr/local/bin
try curl --silent --fail --location https://s3.amazonaws.com/mirrors-archive/local/perforce/r${P4_VERSION}/bin.linux26x86_64/p4 --output /usr/local/bin/p4
try curl --silent --fail --location https://s3.amazonaws.com/mirrors-archive/local/perforce/r${P4D_VERSION}/bin.linux26x86_64/p4d --output /usr/local/bin/p4d
try chmod 755 /usr/local/bin/p4 /usr/local/bin/p4d
Expand Down Expand Up @@ -286,7 +294,9 @@ function add_golang_gocd_bootstrapper() {
}

function setup_entrypoint() {
try cp /usr/local/src/provision/with-java /usr/local/bin/with-java
try cp /usr/local/src/provision/bootstrap.sh /bootstrap.sh
try chmod 755 /usr/local/bin/with-java
try chmod 755 /bootstrap.sh
}

Expand All @@ -299,10 +309,15 @@ function build_gocd() {

setup_epel
install_basic_utils
# setup gocd user to use internal mirrors for builds
add_gocd_user
install_node
install_yarn
install_gauge
install_openjdk
install_jabba
install_jdk8
install_jdk10
install_jdk11
install_native_build_packages
install_ruby
install_python
Expand All @@ -320,9 +335,6 @@ if [ "$CENTOS_MAJOR_VERSION" == "7" ]; then
install_xvfb
fi

# setup gocd user to use internal mirrors for builds
add_gocd_user
install_jabba
setup_git_config
build_gocd

Expand Down
11 changes: 11 additions & 0 deletions provision/with-java
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/usr/bin/env bash

if [ "${JAVA_VERSION}" = "10" ]; then
source "${HOME}/.jabba/jabba.sh"
jabba use "[email protected]"
elif [ "${JAVA_VERSION}" = "11" ]; then
source "${HOME}/.jabba/jabba.sh"
jabba use "[email protected]"
fi

exec "$@"

0 comments on commit bff01f4

Please sign in to comment.