Skip to content

Instantly share code, notes, and snippets.

@tetchel
Last active April 8, 2020 15:33
Show Gist options
  • Save tetchel/9b8e4fe411ffdf8c13dffcd6a954f0ef to your computer and use it in GitHub Desktop.
Save tetchel/9b8e4fe411ffdf8c13dffcd6a954f0ef to your computer and use it in GitHub Desktop.

Jenkins agents in Eclipse Codewind builds

Intro to Agents

An agent is a slave machine that is used to run a pipeline or a stage of a jenkins build. Only one build can be using a given agent at a given time.

Agents can be top-level ('pipeline' level) but can be further broken down by stages. So, one build can use multiple agents for its different stages. For VS Code, the top-level agent is a kube one from a node image (Jenkinsfile#57). This agent is used for any stage which does not override the agent clause.

If you have to run docker commands, use the docker-build agent for that stage. For VS Code and Eclipse, this is only the test stage (Jenkinsfile#134).

3 agent types

  1. Kube agents
    • Described using regular kubernetes yaml (Jenkinsfile#58).
      • Pick any public docker image (you could build your own)
      • Use whatever user the dockerfile specifies
    • Basically unlimited resources to run these through Eclipse infrastructure
    • You can spin off as many as you want as part of your build
      • But the pods will share a filesystem, for some reason - watch out for this especially when using parallel stages.
      • In VS Code the parallel stages execute in two different copies of the code to work around this (Jenkinsfile#156)
    • Can't run docker commands (docker in docker too messy)
  2. docker-build agents
    • These are our 4 VMs, so limited resources (see https://ci.eclipse.org/codewind/computer/)
    • Just regular VMs, not run in docker, so they can run docker commands
    • Use genie.codewind user who is part of docker group but not part of sudoers
    • We have ssh access and root password to all machines except s8p2d-ubuntu1804 which is managed by eclipse team so we have to ask them to install stuff
  3. Basic agent
    • Used if agent clause is agent any
    • Used by the 'Upload to download.eclipse.org' stages (Jenkinsfile#200)

Important notes

  • Since the kube agent is unlimited, use the kube agent as much as possible to take load off our VMs.
  • When switching between agents, the filesystem is not preserved. Use stashes to persist changes between stages. (Jenkinsfile#115)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment