GithubHelp home page GithubHelp logo

Comments (14)

jglick avatar jglick commented on May 30, 2024 1

What is the issues with using tool?

It is not tool itself per se, it is the downloads from every build to some Internet location controlled by someone else—a URL that could break at any time, or suddenly impose rate limiting to the ci.jenkins.io IP address, etc. And it is pretty silly when we have the required tool already available to the agent—we just need to point to it.

If we adjust the path, is it ok to define the PATH/JAVA_HOME variables at agent level

Well that would be the option to adjust images. I am guessing it would be simpler to just adjust buildPlugin.groovy etc. to select the desired tool path from a single image.

from pipeline-library.

jglick avatar jglick commented on May 30, 2024 1

not sure if needed for container images as they will only have one java version installed.

Right, we only need to change how VM agents work:

boolean addToolEnv = !useContainerAgent

from pipeline-library.

timja avatar timja commented on May 30, 2024

We should pack the JDK & Maven into VMs, not just container images, or at a minimum offer our own (e.g., Artifactory) download locations rather than using public URLs.

We already do that, should be fine to just remove them.

from pipeline-library.

jglick avatar jglick commented on May 30, 2024

We already do that

And are they in $PATH / %Path%? If so it would suffice to simply delete tool steps and associated code.

from pipeline-library.

timja avatar timja commented on May 30, 2024

hmm, https://github.com/jenkins-infra/packer-images/blob/main/scripts/ubuntu-20-provision.sh#L121-L139

https://github.com/jenkins-infra/packer-images/blob/main/scripts/windows-2019-provision.ps1#L82

maybe not, would probably be simpler if we built an image per java version, otherwise they are all installed and the path needs to be manipulated.

cc @dduportal

for the kubernetes pods / aci it should all work fine as there'll only be one installed

from pipeline-library.

jglick avatar jglick commented on May 30, 2024

simpler if we built an image per java version, otherwise they are all installed and the path needs to be manipulated

Adjusting the path should be easy enough I guess.

from pipeline-library.

dduportal avatar dduportal commented on May 30, 2024

I got 2 question in order to move forward:

  • What is the issues with using tool? (I never used it before on my own controllers but I don't see immediatly the challenge)
  • If we adjust the path, is it ok to define the PATH/JAVA_HOME variables at agent level (so we would avoid the complexity of maintining multiple VM images, and we would use the Casc config to define different agent templates with the same VM image but different Java default version)?

from pipeline-library.

dduportal avatar dduportal commented on May 30, 2024

I've started working on this one.
The main challenge is to maintain the "datasource" that will list the java installation paths per Operating System (and per java version).

This datasource can be represented with a 2-levels map such as the following:

def javaSetups = [
      jdk8: [
          windows: 'C:\\Tools\\jdk8u302-b08',
          linux: "/opt/jdk8u302-b08",
      ],
      jdk11: [
          windows: 'C:\\Tools\\jdk-11.0.12+7',
          linux: "/opt/jdk-11.0.12+7/bin/java",
      ],
      jdk17: [
          windows: 'C:\\Tools\\jdk-17+35',
          linux: "/opt/jdk-17+35/bin/java",
      ],
  ]

But it means that we must update this map each time there is a JDK upgrade on the VM templates.

  • It's the same challenge as today's tool though
  • It should be automatable through our current process that checks for "latest template version" to update the ci.jenkins.io's template IDs

=> What do you think about keep using the "tool" setup but disable the automatic download and use the JAVA_HOME path instead (in the tool configuration) ?

  • CasC managed so the update can be synchronized with agent template's update on a single PR
  • can be overriden per controller (not only ci.jenkins.io uses this shared library)
  • no need to update the shared library groovy code on each JDK upgrade
  • The tool already defines tools per platform (based on agent labels) so it already holds the datasource for us and it should avoid messing with PATH names (slash? antislash, etc.)

WDYT @timja @jglick ?

from pipeline-library.

timja avatar timja commented on May 30, 2024

I would just extract it out to a major version level

/opt/java-8
/opt/java-11
/opt/java-17

We don't need the minor version in the path, installers don't include it.

from pipeline-library.

jglick avatar jglick commented on May 30, 2024

What do you think about keep using the "tool" setup but disable the automatic download

That could work, if you can somehow arrange for each VM agent to get a https://javadoc.jenkins.io/hudson/tools/ToolLocationNodeProperty.html with suitable configuration.

I think it would be simpler, though, to just use generic permanent paths like /opt/jdk-8 and hard-code those into the library. No need to mess with CasC.

from pipeline-library.

dduportal avatar dduportal commented on May 30, 2024

Gotcha. Started jenkins-infra/packer-images#103 to have a set of static paths on the VMs to get started.

Next steps:

  • Same for container images
  • Define tools with the static path (still worth it to avoid unneeded downloads from untrusted sources)
  • Define static paths on the library here

from pipeline-library.

timja avatar timja commented on May 30, 2024

not sure if needed for container images as they will only have one java version installed.

as we take them (mostly) from upstream.

from pipeline-library.

dduportal avatar dduportal commented on May 30, 2024

Wip in #231

from pipeline-library.

dduportal avatar dduportal commented on May 30, 2024

Fixed by #231

from pipeline-library.

Related Issues (17)

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.