GithubHelp home page GithubHelp logo

jenkinsci / adoptopenjdk-plugin Goto Github PK

View Code? Open in Web Editor NEW
16.0 5.0 12.0 152 KB

Install Eclipse Temurin™ build of OpenJDK

Home Page: https://plugins.jenkins.io/adoptopenjdk/

License: MIT License

Java 89.27% HTML 10.73%
jenkins-plugin jdk jdk-autoinstaller temurin

adoptopenjdk-plugin's Introduction

Eclipse Temurin:tm: JDK installer plugin

Provides an installer for the JDK tool that downloads the Eclipse Temurin:tm: build based upon OpenJDK from the Adoptium Working Group.

Usage recommendations

We want to warn that this plugin is NOT a good practice for production environments. As it relies on Adoptium's website to do the job, it's highly likely to stop working. It could happen because Adoptium's website changes or even if Adoptium bans our downloads due to excessive bandwidth usage or some other reason. Currently Adoptium is using GitHub for hosting release archives and GitHub could also stop working due to similar reasons.

The recommended and preferred approach is to download the JDK distribution using other installers, for example downloading it from a well known URL (preferably hosted on your own network) with ZIP Tool Installer, having it pre-installed in agent docker images, or executing a script to do the job.

Configure plugin with Configuration as Code

The configuration as code plugin allows administrators to automate Jenkins configuration. The sample configuration below defines tool installers based on agent labels, and uses

  • locally hosted Java installers for Linux and Windows agents (assuming local domain in example.com)
  • locally installed Java on agents with the Alpine label
  • locally installed Java on agents with the cloud label
  • locally installed Java on agents with the freebsd label

If none of those installers are selected, then as a fallback, the agent will download the specified Java version from the Eclipse Temurin:tm: project.

The example shows the preference to first use locally available zip files and local installations of the JDK. The JDK will be downloaded from the Eclipse Temurin:tm: project only in cases where the local installation is not available or does not apply.

tool:
  jdk:
    installations:
    - name: "jdk11"
      properties:
      - installSource:
          installers:
          - zip:
              label: "linux && amd64 && !Alpine && !cloud"
              subdir: "jdk-11.0.21+9"
              url: "https://example.com/jdk/11/OpenJDK11U-jdk_x64_linux_hotspot_11.0.21_9.tar.gz"
          - zip:
              label: "windows && amd64"
              subdir: "jdk-11.0.21+9"
              url: "https://example.com/jdk/11/OpenJDK11U-jdk_x64_windows_hotspot_11.0.21_9.zip"
          - command:
              command: "true"
              label: "cloud"
              toolHome: "/home/jenkins/tools/jdk-11.0.21+9"
          - command:
              command: "true"
              label: "freebsd"
              toolHome: "/usr/local/openjdk11"
          - adoptOpenJdkInstaller:
              id: "jdk-11.0.21+9"
    - name: "jdk17"
      properties:
      - installSource:
          installers:
          - zip:
              label: "linux && amd64 && !Alpine && !cloud"
              subdir: "jdk-17.0.9+9"
              url: "https://example.com/jdk/17/OpenJDK17U-jdk_x64_linux_hotspot_17.0.9_9.tar.gz"
          - zip:
              label: "windows && amd64"
              subdir: "jdk-17.0.9+9"
              url: "https://example.com/jdk/17/OpenJDK17U-jdk_x64_windows_hotspot_17.0.9_9.zip"
          - command:
              command: "true"
              label: "cloud"
              toolHome: "/home/jenkins/tools/jdk-17.0.9+9"
          - command:
              command: "true"
              label: "freebsd"
              toolHome: "/usr/local/openjdk17"
          - adoptOpenJdkInstaller:
              id: "jdk-17.0.9+9"
    - name: "jdk21"
      properties:
      - installSource:
          installers:
          - zip:
              label: "linux && amd64 && !Alpine && !cloud"
              subdir: "jdk-21.0.1+12"
              url: "https://example.com/jdk/21/OpenJDK21U-jdk_x64_linux_hotspot_21.0.1_12.tar.gz"
          - zip:
              label: "windows && amd64"
              subdir: "jdk-21.0.1+12"
              url: "https://example.com/jdk/21/OpenJDK21U-jdk_x64_windows_hotspot_21.0.1_12.zip"
          - command:
              command: "true"
              label: "cloud"
              toolHome: "/home/jenkins/tools/jdk-21.0.1+12"
          - adoptOpenJdkInstaller:
              id: "jdk-21.0.1+12"

Configure plugin via Groovy script

Either automatically upon Jenkins post-initialization or through Jenkins script console, example:

#!/usr/bin/env groovy
import hudson.model.JDK
import hudson.tools.InstallSourceProperty
import io.jenkins.plugins.adoptopenjdk.AdoptOpenJDKInstaller
import jenkins.model.Jenkins

final versions = [
        'jdk8' : 'jdk8u392-b08',
        'jdk11': 'jdk-11.0.21+9',
        'jdk17': 'jdk-17.0.9+9',
        'jdk21': 'jdk-21.0.1+12',
]

Jenkins.instance.getDescriptor(hudson.model.JDK).with {
    installations = versions.collect {
        new JDK(it.key, '', [
                new InstallSourceProperty([
                        new AdoptOpenJDKInstaller(it.value)
                ])
        ])
    } as JDK[]

}

Changelog

Changes in each release are described in GitHub releases.

adoptopenjdk-plugin's People

Contributors

based2 avatar basil avatar dependabot[bot] avatar hrmohr avatar jakub-bochenski avatar markewaite avatar olamy avatar oleg-nenashev avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.