Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: build both agent and inbound agent #570

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
191 commits
Select commit Hold shift + click to select a range
f598243
initial implementation, mostly inspired by https://github.com/carloss…
ndeloof Aug 28, 2015
cec8c0e
Adding udpate ECS container agent suggestion to README
chrishenzie Nov 17, 2015
a91dbd0
Merge pull request jenkinsci/docker-inbound-agent#2 from chrishenzie/…
ndeloof Nov 17, 2015
b37e78c
Upgrade remoting to 2.62 and disable JNLP3 protocol by default (#12)
oleg-nenashev Sep 2, 2016
2ec748c
Rename JENKINS_NAME to JENKINS_AGENT_NAME
carlossg Feb 22, 2017
542c469
Update the description, use Agents instead of Slaves where possible
oleg-nenashev Mar 15, 2017
29e9ca1
Merge pull request jenkinsci/docker-inbound-agent#24 from jenkinsci/e…
oleg-nenashev Mar 16, 2017
25b37d5
Merge branch 'master' into readme
oleg-nenashev Mar 16, 2017
e473a4a
Merge pull request jenkinsci/docker-inbound-agent#25 from oleg-nenash…
oleg-nenashev Mar 16, 2017
6dd9686
REadme: Fix typo noticed by @jglick
oleg-nenashev Mar 17, 2017
0849e20
Merge pull request jenkinsci/docker-inbound-agent#27 from oleg-nenash…
oleg-nenashev Mar 27, 2017
f603b13
[JENKINS-44114] - Add the WorkDir option example
oleg-nenashev Aug 4, 2017
ca434ab
Merge branch 'master' into alpine
oleg-nenashev Aug 4, 2017
10d856a
Document new env variable JENKINS_AGENT_WORKDIR
oli-g Sep 12, 2017
f9b762a
Update jenkinsci/jnlp-slave -> jenkins/jnlp-slave
carlossg Dec 8, 2017
9d4b7e8
Update Remoting to 3.15 + fix documentation
oleg-nenashev Dec 22, 2017
94fabc8
Merge pull request jenkinsci/docker-inbound-agent#53 from oleg-nenash…
oleg-nenashev Dec 22, 2017
f1d715b
Merge branch 'master' into workdir-env-var
oleg-nenashev Dec 22, 2017
313caf7
Merge pull request jenkinsci/docker-inbound-agent#54 from oleg-nenash…
oleg-nenashev Dec 26, 2017
89547f6
Merge branch 'master' into alpine
oleg-nenashev Dec 26, 2017
d5900ba
Fix #57 Clarify image name deprecation
carlossg Jan 30, 2018
7921939
Merge pull request jenkinsci/docker-inbound-agent#58 from jenkinsci/c…
oleg-nenashev Jan 30, 2018
5043700
Merge branch 'master' into alpine
oleg-nenashev Mar 22, 2018
c6490e3
Initial Windows agent support
slide Jul 13, 2019
15ebbef
Merge pull request jenkinsci/docker-inbound-agent#91 from slide/master
slide Aug 6, 2019
0ca658b
[JENKINS-42846] - Rename the jenkins-slave script to jenkins-agent
oleg-nenashev Sep 20, 2019
2882d8e
Revert "[JENKINS-42846] - Rename the jenkins-slave script to jenkins-…
oleg-nenashev Sep 20, 2019
638f970
[JENKINS-42846] - Rename the jenkins-slave script to jenkins-agent
oleg-nenashev Sep 20, 2019
aea520e
Add Gitter and GitHub Releases badges to README
oleg-nenashev Sep 20, 2019
0c9eade
Merge branch 'master' into alpine-to-master
oleg-nenashev Sep 20, 2019
49e1552
Merge pull request jenkinsci/docker-inbound-agent#112 from oleg-nenas…
oleg-nenashev Sep 20, 2019
4ac025d
Merge branch 'master' into JENKINS-42846-script-renaming
oleg-nenashev Sep 20, 2019
61dd2a8
[JENKINS-42846] - Remove the debug code
oleg-nenashev Sep 20, 2019
8ee2a92
Merge pull request jenkinsci/docker-inbound-agent#106 from oleg-nenas…
oleg-nenashev Sep 20, 2019
763659d
Adjusted jenkins-agent script for direct connection
alxsap Sep 24, 2019
2135156
JENKINS_WEB_SOCKET=true
jglick Dec 10, 2019
7312f65
Fix spelling mistake
rbywater Dec 15, 2019
a118d3d
Fix the Gitter chat link in the documentation
oleg-nenashev Dec 25, 2019
bfb513a
Merge pull request jenkinsci/docker-inbound-agent#134 from jenkinsci/…
slide Dec 25, 2019
e4ad809
Noting new variable in documentation.
jglick Jan 3, 2020
9a76e73
Merge branch 'master' of github.com:jenkinsci/docker-jnlp-slave into …
jglick Jan 3, 2020
f104777
Update to Remoting 3.40.
jeffret-b Jan 10, 2020
8fa077f
Improve README
jeffret-b Jan 10, 2020
0da278c
Fix copyright.
jeffret-b Jan 10, 2020
de8055c
Merge pull request jenkinsci/docker-inbound-agent#138 from jeffret-b/…
oleg-nenashev Jan 11, 2020
d3c82c5
Pass --init to docker-run to reap zombies.
alex3d Jan 14, 2020
2705724
Remove docker run --init flag (it's ignored on Windows)
alex3d Jan 15, 2020
f9f870e
Added tests
Jan 17, 2020
63202c2
Add `zombie reaping` note
alex3d Jan 17, 2020
8deb0d0
Removed hidden tabs
Jan 21, 2020
25ea266
Merge branch 'master' of github.com:jenkinsci/docker-jnlp-slave into …
jglick Jan 27, 2020
c4bf751
Script seems to be using tabs not spaces
jglick Jan 27, 2020
b153932
Also patch the PowerShell script
jglick Jan 27, 2020
aeac3ab
-eq rather than .Equals
jglick Jan 27, 2020
d7d74e4
Merge pull request jenkinsci/docker-inbound-agent#142 from krufab/add…
oleg-nenashev Jan 29, 2020
b05c5d9
Increased timeout in the netcat-helper container to 30s to execute co…
Jan 29, 2020
ce374c3
Corrected typo in the test file
Jan 29, 2020
14e26df
Merge pull request jenkinsci/docker-inbound-agent#148 from krufab/bug…
slide Jan 30, 2020
fdf9ed8
Merge pull request jenkinsci/docker-inbound-agent#130 from jglick/web…
MarkEWaite Feb 12, 2020
a0386dc
Directory updates for Linux containers
Apr 1, 2020
31aeff7
Rework directory structure and Windows containers
slide Apr 1, 2020
9194817
Merge pull request jenkinsci/docker-inbound-agent#139 from alex3d/ale…
slide Apr 10, 2020
95384db
Merge branch 'master' into directory_changes
oleg-nenashev Apr 11, 2020
7e0a363
Merge pull request jenkinsci/docker-inbound-agent#154 from slide/dire…
oleg-nenashev Apr 11, 2020
39b118c
INFRA-1105 - Rename the image to jenkins/inbound-agent
oleg-nenashev Apr 12, 2020
f8bd62e
Merge pull request jenkinsci/docker-inbound-agent#158 from jenkinsci/…
oleg-nenashev Apr 12, 2020
7dbb627
[INFRA-1105] - Rename Windows agents in README
oleg-nenashev Apr 12, 2020
5c86c5f
Cleanup Docker badges in README (#161)
oleg-nenashev Apr 13, 2020
341c81d
Update README.md
oleg-nenashev Apr 13, 2020
c62311f
Fix tests after renaming of the base image
oleg-nenashev Apr 13, 2020
3f98eec
Merge pull request jenkinsci/docker-inbound-agent#159 from oleg-nenas…
oleg-nenashev Apr 13, 2020
a12a9eb
Merge pull request jenkinsci/docker-inbound-agent#160 from jenkinsci/…
oleg-nenashev Apr 13, 2020
b8765a4
Show GitHub stars and repo quick link on the DockerHub landing page
oleg-nenashev Apr 13, 2020
23c8736
Merge pull request jenkinsci/docker-inbound-agent#164 from jenkinsci/…
slide Apr 13, 2020
70171b5
fixes jenkins/inbound-agent link in README
marshallford Apr 14, 2020
2ca8d6b
Merge pull request jenkinsci/docker-inbound-agent#166 from marshallfo…
slide Apr 14, 2020
3ae76e7
Fix issue with protocols value not being supplied to agent.jar
slide May 8, 2020
3b85772
Update jenkins-agent.ps1
slide May 8, 2020
ced2fdb
Merge pull request jenkinsci/docker-inbound-agent#170 from jenkinsci/…
slide May 8, 2020
59b285a
Rename test file
slide Sep 28, 2020
927180f
Merge pull request jenkinsci/docker-inbound-agent#195 from slide/wind…
slide Oct 5, 2020
0d728ff
Fixup docker image name and tag to correct
nwton Oct 17, 2020
3a46b5f
Remove unused spaces
nwton Oct 17, 2020
3e836be
Merge pull request jenkinsci/docker-inbound-agent#203 from nwton/fixu…
slide Oct 17, 2020
416747e
Upgrade to Remoting 4.6.
jeffret-b Nov 3, 2020
375b2b6
Update tests/tests.bats
jeffret-b Nov 4, 2020
91bca71
Update tests/inboundAgent.Tests.ps1
slide Nov 4, 2020
cd46ee2
Merge pull request jenkinsci/docker-inbound-agent#209 from jeffret-b/…
slide Nov 5, 2020
3d43dda
chore: bumped agent version to 4.6-2
garethjevans Dec 18, 2020
ef57093
Merge pull request jenkinsci/docker-inbound-agent#212 from garethjeva…
slide Dec 21, 2020
b8bbded
Upgrade to Remoting 4.7.
jeffret-b Mar 23, 2021
063b065
Merge pull request jenkinsci/docker-inbound-agent#225 from jeffret-b/…
slide Mar 24, 2021
045ccc2
Allows to pass JAVA_OPTS to the JVM
Vlatombe May 24, 2021
02af84c
Upgrade remoting to 4.9
Jul 1, 2021
b89bc58
Merge pull request jenkinsci/docker-inbound-agent#233 from agentgonzo…
slide Jul 1, 2021
5a841fb
Specify JENKINS_JAVA_BIN to run the agent using a specific JRE (#234)
Vlatombe Aug 4, 2021
88497e9
Update jenkins-agent.ps1 (#226)
kevit Aug 26, 2021
9151e67
Add publishing for linux via Jenkins (#236)
timja Aug 26, 2021
47313b5
Do not prevent execution if the single argument is an option (#219)
felipecrs Aug 26, 2021
946255b
Fix error with jenkins-agent syntax (#239)
felipecrs Sep 1, 2021
b55164b
Update to latest version of docker/agent (#240)
timja Sep 6, 2021
850d2a2
Merge branch 'master' into windows_javaopts
MarkEWaite Nov 20, 2021
4f3e562
Add Java 17 alpine (#252)
Jan 3, 2022
ecab800
Allow the use of multiple arguments (#254)
basil Jan 15, 2022
8fefb6a
Revert "Allow the use of multiple arguments" (#257)
timja Jan 17, 2022
44f8779
Specify JENKINS_JAVA_OPTS to pass JVM options that apply to the agent…
Dohbedoh Mar 9, 2022
921b076
Remove `--add-opens` directives on Java 17 (#263)
basil Mar 11, 2022
8502a12
Remove Java 8 (#278)
slide Sep 25, 2022
b4a507b
fix: only deploy to DockerHub on tag-triggered builds
dduportal Sep 23, 2022
9e6e950
Merge pull request jenkinsci/docker-inbound-agent#280 from dduportal/…
dduportal Sep 29, 2022
55207ce
fixup
dduportal Sep 29, 2022
ec675a4
Merge pull request jenkinsci/docker-inbound-agent#285 from dduportal/…
dduportal Sep 29, 2022
ef20208
chore(test) fix build argument tests by using an old version
dduportal Sep 29, 2022
9333b0e
Merge pull request jenkinsci/docker-inbound-agent#286 from dduportal/…
dduportal Sep 29, 2022
c1d4904
chore(linux tests) apply shellcheck and fix concurency issues
dduportal Nov 12, 2022
3ed3d99
fixup
dduportal Nov 12, 2022
3bafcfc
Merge pull request jenkinsci/docker-inbound-agent#299 from dduportal/…
dduportal Nov 12, 2022
e2e0f16
Add Java 17 alpine (#252)
Jan 3, 2022
9bbd324
Allow the use of multiple arguments (#254)
basil Jan 15, 2022
51774e3
Revert "Allow the use of multiple arguments" (#257)
timja Jan 17, 2022
9c88589
Specify JENKINS_JAVA_OPTS to pass JVM options that apply to the agent…
Dohbedoh Mar 9, 2022
3dd8b43
Remove `--add-opens` directives on Java 17 (#263)
basil Mar 11, 2022
86f5ddc
Remove Java 8 (#278)
slide Sep 25, 2022
c1f2329
fix: only deploy to DockerHub on tag-triggered builds
dduportal Sep 23, 2022
52b909f
fixup
dduportal Sep 29, 2022
3309026
chore(test) fix build argument tests by using an old version
dduportal Sep 29, 2022
b32baf3
chore(linux tests) apply shellcheck and fix concurency issues
dduportal Nov 12, 2022
ca52fd6
fixup
dduportal Nov 12, 2022
b65ad20
Fixup command line processing and add test
slide Nov 24, 2022
18b0c18
Merge branch 'master' into windows_javaopts
slide Nov 24, 2022
d80c959
documentation(README): complement `JENKINS_JAVA_OPTS` usage for Windo…
smerle33 Dec 10, 2022
fab30ac
cleanup(windows) remove custom user (feature parity with Linux and de…
dduportal Apr 29, 2023
106db6b
chore(windows tests) fix harness to use long flags, no more interacti…
dduportal Apr 30, 2023
4e6cad0
Merge pull request jenkinsci/docker-inbound-agent#344 from dduportal/…
dduportal Apr 30, 2023
0de5d15
Merge branch 'master' into cleanup/remove-user-creation
dduportal Apr 30, 2023
7afdf6e
Merge pull request jenkinsci/docker-inbound-agent#343 from dduportal/…
dduportal Apr 30, 2023
9aaaaa2
chore(windows) factorize JDK specification to make.ps1
dduportal May 18, 2023
94765e0
Merge pull request jenkinsci/docker-inbound-agent#347 from dduportal/…
dduportal May 19, 2023
c3a2767
[Windows] Allow JENKINS_URL to not be set when JENKINS_DIRECT_CONNECT…
krische Jun 28, 2023
b7157d3
build Windows images with docker compose like docker-agent and regrou…
lemeurherve Jul 8, 2023
07d810a
refactor builds like https://github.com/jenkinsci/docker-agent/pull/445
lemeurherve Jul 9, 2023
bd892f8
revert images regroupment by OS type
lemeurherve Jul 11, 2023
1b61b1c
restore jenkins-agent.ps1 location at root folder
lemeurherve Jul 11, 2023
344561b
clean comments
lemeurherve Jul 11, 2023
ea39792
restore docker-bake & jenkins-agent script location
lemeurherve Jul 11, 2023
61f7e3f
replace DOCKER_AGENT_VERSION by PARENT_IMAGE_VERSION
lemeurherve Jul 11, 2023
8543246
replace 'VERSION' by 'version'
lemeurherve Jul 11, 2023
0213d3c
restore 'version' case in tests.bats
lemeurherve Jul 11, 2023
2d3e872
Merge pull request jenkinsci/docker-inbound-agent#363 from lemeurherv…
dduportal Jul 28, 2023
cb1ef87
chore: output JAVA_MAJOR_VERSION in tests
lemeurherve Jul 30, 2023
077c013
chore: remove duplicated space
lemeurherve Jul 31, 2023
b3d78f7
chore: show `JAVA_MAJOR_VERSION` in tests output
lemeurherve Jul 31, 2023
3a6170f
chore: show `JAVA_MAJOR_VERSION` in tests output
lemeurherve Jul 31, 2023
60c4e1b
Merge branch 'master' into fix-tag-and-publish
lemeurherve Jul 31, 2023
f64c55e
Merge pull request jenkinsci/docker-inbound-agent#374 from lemeurherv…
dduportal Jul 31, 2023
2378fb0
chore: fix link title in README (#381)
lemeurherve Jul 31, 2023
67cc801
Sync README.md with docker hub (#385)
NotMyFault Aug 3, 2023
2c87f97
Fix incorrect link (#392)
slide Aug 31, 2023
3df8ead
refactor like jenkinsci/docker-agent#459
lemeurherve Sep 7, 2023
4237940
fix: switch to the docker-agent version which has nanoserver-ltsc2019…
lemeurherve Sep 7, 2023
ef3f841
fix bad rebase
lemeurherve Sep 7, 2023
375eb8f
run slow tests at the end
lemeurherve Sep 8, 2023
c9c45ca
remove unwanted CONTAINER_SHELL arg
lemeurherve Sep 8, 2023
1455e10
debug
lemeurherve Sep 8, 2023
04858bb
more debug
lemeurherve Sep 8, 2023
70904e4
try fixing pester failing to encode junit xml because of 0x1b char in…
lemeurherve Sep 8, 2023
49c5e7d
Revert "run slow tests at the end"
lemeurherve Sep 8, 2023
631b01a
fix(tests): Image not found.
gounthar Sep 8, 2023
3db7a8d
fix(tests): Image not found.
gounthar Sep 8, 2023
c9c4e5b
Merge pull request jenkinsci/docker-inbound-agent#397 from gounthar/j…
dduportal Sep 8, 2023
29f5399
comment out for now the failing test
lemeurherve Sep 8, 2023
26735e3
remove debug
lemeurherve Sep 8, 2023
a031462
Merge branch 'master' into refactor-like-docker-agent-pr-459
lemeurherve Sep 8, 2023
c7c6697
Merge pull request jenkinsci/docker-inbound-agent#396 from lemeurherv…
dduportal Sep 8, 2023
06c2be7
chore(deps): bump actions/checkout from 3 to 4
dependabot[bot] Sep 11, 2023
c785c9c
Merge pull request jenkinsci/docker-inbound-agent#401 from jenkinsci/…
dduportal Sep 11, 2023
80592ab
documentation(README): add description for secret
limejuny Oct 7, 2023
f854ceb
Store images in the repository
MarkEWaite Oct 7, 2023
0ffeb94
update first parent image version suffix containing all tags in tests
lemeurherve Oct 12, 2023
f196961
Merge pull request jenkinsci/docker-inbound-agent#418 from jenkinsci/…
dduportal Oct 12, 2023
b748ef7
feat!: set Java 17 as default (#419)
lemeurherve Oct 12, 2023
b85fad6
Remove usage of deprecated `-headless` argument (#428)
basil Oct 13, 2023
fcce536
fix linux tests by bumpiung the reference version containing all tags
lemeurherve Oct 22, 2023
9c47353
Merge pull request jenkinsci/docker-inbound-agent#436 from lemeurherv…
dduportal Oct 23, 2023
cbde922
Migrate to new Remoting calling convention
basil Oct 24, 2023
776b37b
Merge pull request jenkinsci/docker-inbound-agent#445 from basil/remo…
dduportal Oct 25, 2023
b490aae
chore: replace `master` by `controller` (#456)
lemeurherve Nov 20, 2023
5e06d07
rename `docker-inbound-agent` files before import
lemeurherve Jan 12, 2024
7510ba1
rename `docker-agent` files before import
lemeurherve Jan 12, 2024
326edf7
import prepared `docker-inbound-agent` files
lemeurherve Jan 12, 2024
2f13f7f
feat: build both `agent` and `inbound-agent` images
lemeurherve Jan 12, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions .github/workflows/update-dockerhub-description.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Update Docker Hub Description
on:
release:
types: [ published ]
workflow_dispatch:

jobs:
dockerHubDescription:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Update Docker Hub description for agent
uses: peter-evans/dockerhub-description@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}
enable-url-completion: true
short-description: This is a base image, which provides the Jenkins agent executable (agent.jar)
repository: jenkins/agent
readme-filepath: ./README_agent.md
- name: Update Docker Hub description for inbound-agent
uses: peter-evans/dockerhub-description@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}
enable-url-completion: true
short-description: This is an image for Jenkins agents using TCP or WebSockets to establish inbound connection to the Jenkins controller
repository: jenkins/inbound-agent
readme-filepath: ./README_inbound-agent.md
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@
bats-core/
bats/
target/
build-windows-current.yaml
2 changes: 1 addition & 1 deletion Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ pipeline {
}
post {
always {
junit(allowEmptyResults: true, keepLongStdio: true, testResults: 'target/**/junit-results.xml')
junit(allowEmptyResults: true, keepLongStdio: true, testResults: 'target/**/junit-results*.xml')
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Keep junit Linux test results too

}
}
}
Expand Down
14 changes: 5 additions & 9 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,6 @@ export BUILDKIT_PROGRESS=plain
current_arch := $(shell uname -m)
export ARCH ?= $(shell case $(current_arch) in (x86_64) echo "amd64" ;; (i386) echo "386";; (aarch64|arm64) echo "arm64" ;; (armv6*) echo "arm/v6";; (armv7*) echo "arm/v7";; (s390*|riscv*|ppc64le) echo $(current_arch);; (*) echo "UNKNOWN-CPU";; esac)

IMAGE_NAME:=jenkins4eval/agent

# Set to the path of a specific test suite to restrict execution only to this
# default is "all test suites in the "tests/" directory
TEST_SUITES ?= $(CURDIR)/tests

##### Macros
## Check the presence of a CLI in the current PATH
check_cli = type "$(1)" >/dev/null 2>&1 || { echo "Error: command '$(1)' required but not found. Exiting." ; exit 1 ; }
Expand All @@ -42,6 +36,7 @@ build: check-reqs

build-%:
@$(call check_image,$*)
@echo "== building $*"
@set -x; $(bake_base_cli) --set '*.platform=linux/$(ARCH)' '$*'

show:
Expand All @@ -59,7 +54,7 @@ prepare-test: bats check-reqs

## Define bats options based on environment
# common flags for all tests
bats_flags := $(TEST_SUITES)
bats_flags := ""
# if DISABLE_PARALLEL_TESTS true, then disable parallel execution
ifneq (true,$(DISABLE_PARALLEL_TESTS))
# If the GNU 'parallel' command line is absent, then disable parallel execution
Expand All @@ -75,9 +70,10 @@ test-%: prepare-test
@$(call check_image,$*)
# Ensure that the image is built
@make --silent build-$*
# Execute the test harness and write result to a TAP file
@echo "== testing $*"
set -x
IMAGE=$* bats/bin/bats $(bats_flags) | tee target/results-$*.tap
# Each type of image ("agent" or "inbound-agent") has its own tests suite
IMAGE=$* bats/bin/bats $(CURDIR)/tests/tests_$(shell echo $* | cut -d "_" -f 1).bats $(bats_flags) | tee target/results-$*.tap
# convert TAP to JUNIT
docker run --rm -v "$(CURDIR)":/usr/src/app -w /usr/src/app node:16-alpine \
sh -c "npm install tap-xunit -g && cat target/results-$*.tap | tap-xunit --package='jenkinsci.docker.$*' > target/junit-results-$*.xml"
Expand Down
134 changes: 10 additions & 124 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,135 +1,21 @@
# Jenkins Agent Docker image
# Jenkins Agent and Inbound Agent Docker images

[![Join the chat at https://gitter.im/jenkinsci/docker](https://badges.gitter.im/jenkinsci/docker.svg)](https://gitter.im/jenkinsci/docker?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
[![GitHub stars](https://img.shields.io/github/stars/jenkinsci/docker-agent?label=GitHub%20stars)](https://github.com/jenkinsci/docker-agent)
[![Docker Pulls](https://img.shields.io/docker/pulls/jenkins/agent.svg)](https://hub.docker.com/r/jenkins/agent/)
[![GitHub release](https://img.shields.io/github/release/jenkinsci/docker-agent.svg?label=changelog)](https://github.com/jenkinsci/docker-agent/releases/latest)

This is a base image for Docker, which includes JDK and the Jenkins agent executable (agent.jar).
This executable is an instance of the [Jenkins Remoting library](https://github.com/jenkinsci/remoting).
JDK version depends on the image and the platform, see the _Configurations_ section below.

:exclamation: **Warning!** This image used to be published as [jenkinsci/slave](https://hub.docker.com/r/jenkinsci/slave/) and [jenkins/slave](https://hub.docker.com/r/jenkins/slave/).
These images are now deprecated, use [jenkins/agent](https://hub.docker.com/r/jenkins/agent/).

## Changelog

See [GitHub releases](https://github.com/jenkinsci/docker-agent/releases) for versions `3.35-1` and above.
There is no changelog for previous versions, see the commit history.

Jenkins remoting changelogs are available [here](https://github.com/jenkinsci/remoting/releases).

## Usage

This image is used as the basis for the [Docker Inbound Agent](https://github.com/jenkinsci/docker-inbound-agent/) image.
In that image, the container is launched externally and attaches to Jenkins.

This image may instead be used to launch an agent using the **Launch method** of **Launch agent via execution of command on the controller**. For example on Linux you can try

```sh
docker run -i --rm --name agent --init jenkins/agent java -jar /usr/share/jenkins/agent.jar
```

after setting **Remote root directory** to `/home/jenkins/agent`.

or if using Windows Containers

```powershell
docker run -i --rm --name agent --init jenkins/agent:jdk17-windowsservercore-ltsc2019 java -jar C:/ProgramData/Jenkins/agent.jar
```

after setting **Remote root directory** to `C:\Users\jenkins\Agent`.

### Agent Work Directories

Starting from [Remoting 3.8](https://github.com/jenkinsci/remoting/blob/master/CHANGELOG.md#38) there is a support of Work directories,
which provides logging by default and change the JAR Caching behavior.
This repository contains the definition of two images:

Call example for Linux:

```sh
docker run -i --rm --name agent1 --init -v agent1-workdir:/home/jenkins/agent jenkins/agent java -jar /usr/share/jenkins/agent.jar -workDir /home/jenkins/agent
```

Call example for Windows Containers:

```powershell
docker run -i --rm --name agent1 --init -v agent1-workdir:C:/Users/jenkins/Work jenkins/agent:jdk11-windowsservercore-ltsc2019 java -jar C:/ProgramData/Jenkins/agent.jar -workDir C:/Users/jenkins/Work
```

## Configurations

The image has several supported configurations, which can be accessed via the following tags:

* Linux Images:
* `latest` (`jdk17`, `bookworm-jdk17`, `latest-bookworm`, `latest-bookworm-jdk17`, `latest-jdk17`): Latest version with the newest remoting and JDK17 (based on `debian:bookworm-${builddate}`)
* `alpine` (`alpine-jdk17`, `latest-alpine`, `latest-alpine-jdk17`): Small image based on Alpine Linux with JDK17 (based on `alpine:${version}`)
* `archlinux` (`archlinux-jdk11`, `latest-archlinux`, `latest-archlinux-jdk11`): Image based on Arch Linux with JDK11 (based on `archlinux:latest`)
* `bookworm-jdk11` (`latest-bookworm-jdk11`, `latest-jdk11`): JDK11 version with the newest remoting (based on `debian:bookworm-${builddate}`)
* `alpine-jdk11` (`latest-alpine-jdk11`): Small image based on Alpine Linux with JDK11 (based on `alpine:${version}`)

From version 4.11.2, the alpine images are tagged using the alpine OS version as well (i.e. `alpine` ==> `alpine3.16`, `alpine-jdk11` ==> `alpine3.16-jdk11`).

* Windows Images:
* JDK11:
* `jdk11-nanoserver-1809`: Latest version with the newest remoting with Windows Nano Server and Java 11 (based on `mcr.microsoft.com/windows/nanoserver:1809` and `eclipse-temurin:11.xxx-jdk-nanoserver-1809`)
* `jdk11-nanoserver-ltsc2019`: Latest version with the newest remoting with Windows Nano Server and Java 11 (based on `mcr.microsoft.com/windows/nanoserver:ltsc2019` and `eclipse-temurin:11.xxx-jdk-nanoserver-1809`)
* `jdk11-nanoserver-ltsc2022`: Latest version with the newest remoting with Windows Nano Server and Java 11 (based on `mcr.microsoft.com/windows/nanoserver:ltsc2022` and `eclipse-temurin:11.xxx-jdk-nanoserver-ltsc2022`)
* `jdk11-windowsservercore-1809`: Latest version with the newest remoting and Java 11 (based on `mcr.microsoft.com/windows/servercore:1809` and `eclipse-temurin:11.xxx-jdk-windowsservercore-1809`)
* `jdk11-windowsservercore-ltsc2019`: Latest version with the newest remoting and Java 11 (based on `mcr.microsoft.com/windows/servercore:ltsc2019` and `eclipse-temurin:11.xxx-jdk-windowsservercore-1809`)
* `jdk11-windowsservercore-ltsc2022`: Latest version with the newest remoting and Java 11 (based on `mcr.microsoft.com/windows/servercore:ltsc2022` and `eclipse-temurin:11.xxx-jdk-windowsservercore-ltsc2022`)
* JDK17 (default):
* `jdk17-nanoserver-1809` (`nanoserver-1809`): Latest version with the newest remoting with Windows Nano Server and Java 17 (based on `mcr.microsoft.com/windows/nanoserver:1809` and `eclipse-temurin:17.xxx-jdk-nanoserver-1809`)
* `jdk17-nanoserver-ltsc2019` (`nanoserver-ltsc2019`): Latest version with the newest remoting with Windows Nano Server and Java 17 (based on `mcr.microsoft.com/windows/nanoserver:ltsc2019` and `eclipse-temurin:17.xxx-jdk-nanoserver-1809`)
* `jdk17-nanoserver-ltsc2022` (`nanoserver-ltsc2022`): Latest version with the newest remoting with Windows Nano Server and Java 17 (based on `mcr.microsoft.com/windows/nanoserver:ltsc2022` and `eclipse-temurin:17.xxx-jdk-nanoserver-ltsc2022`)
* `jdk17-windowsservercore-1809` (`windowsservercore-1809`): Latest version with the newest remoting and Java 17 (based on `mcr.microsoft.com/windows/servercore:1809` and `eclipse-temurin:17.xxx-jdk-windowsservercore-1809`)
* `jdk17-windowsservercore-ltsc2019` (`windowsservercore-ltsc2019`): Latest version with the newest remoting and Java 17 (based on `mcr.microsoft.com/windows/servercore:ltsc2019` and `eclipse-temurin:17.xxx-jdk-windowsservercore-1809`)
* `jdk17-windowsservercore-ltsc2022` (`windowsservercore-ltsc2022`): Latest version with the newest remoting and Java 17 (based on `mcr.microsoft.com/windows/servercore:ltsc2022` and `eclipse-temurin:17.xxx-jdk-windowsservercore-ltsc2022`)
* JDK21:
* `jdk21-nanoserver-1809`: Latest version with the newest remoting with Windows Nano Server and Java 21 (based on `mcr.microsoft.com/windows/nanoserver:1809` and `eclipse-temurin:21.xxx-jdk-nanoserver-1809`)
* `jdk21-nanoserver-ltsc2019`: Latest version with the newest remoting with Windows Nano Server and Java 21 (based on `mcr.microsoft.com/windows/nanoserver:ltsc2019` and `eclipse-temurin:21.xxx-jdk-nanoserver-1809`)
* `jdk21-nanoserver-ltsc2022`: Latest version with the newest remoting with Windows Nano Server and Java 21 (based on `mcr.microsoft.com/windows/nanoserver:ltsc2022` and `eclipse-temurin:21.xxx-jdk-nanoserver-ltsc2022`)
* `jdk21-windowsservercore-1809`: Latest version with the newest remoting and Java 21 (based on `mcr.microsoft.com/windows/servercore:1809` and `eclipse-temurin:21.xxx-jdk-windowsservercore-1809`)
* `jdk21-windowsservercore-ltsc2019`: Latest version with the newest remoting and Java 21 (based on `mcr.microsoft.com/windows/servercore:ltsc2019` and `eclipse-temurin:21.xxx-jdk-windowsservercore-1809`)
* `jdk21-windowsservercore-ltsc2022`: Latest version with the newest remoting and Java 21 (based on `mcr.microsoft.com/windows/servercore:ltsc2022` and `eclipse-temurin:21.xxx-jdk-windowsservercore-ltsc2022`)

The file `docker-bake.hcl` defines all the configuration for Linux images and their associated tags.

There are also versioned tags in DockerHub, and they are recommended for production use.
See the full list [here](https://hub.docker.com/r/jenkins/agent/tags)

## Timezones

### Using directly the `jenkins/agent` image

By default, the image is using the `Etc/UTC` timezone.
If you want to use the timezone of your machine, you can mount the `/etc/localtime` file from the host (as per [this comment](https://github.com/moby/moby/issues/12084#issuecomment-89697533)) and the `/etc/timezone` from the host too.
In this example, the machine is using the `Europe/Paris` timezone.

```bash
docker run --rm --tty --interactive --entrypoint=date --volume=/etc/localtime:/etc/localtime:ro --volume=/etc/timezone:/etc/timezone:ro jenkins/agent
Fri Nov 25 18:27:22 CET 2022
```
## agent
[![Docker Pulls](https://img.shields.io/docker/pulls/jenkins/agent.svg)](https://hub.docker.com/r/jenkins/agent/)

You can also set the `TZ` environment variable to the desired timezone.
`TZ` is a standard POSIX environment variable used by many images, see [Wikipedia](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones) for a list of valid values.
The next command is run on a machine using the `Europe/Paris` timezone a few seconds after the previous one.
This is a base image for Docker, which includes JDK and the Jenkins agent executable (agent.jar).

```bash
docker run --rm --tty --interactive --env TZ=Asia/Shanghai --entrypoint=date jenkins/agent
Sat Nov 26 01:27:58 CST 2022
```
See [the `agent` README](./README_agent.md)

### Using the `jenkins/agent` image as a base image
## inbound-agent
[![Docker Pulls](https://img.shields.io/docker/pulls/jenkins/inbound-agent.svg)](https://hub.docker.com/r/jenkins/inbound-agent/)

Should you want to adapt the `jenkins/agent` image to your local timezone while creating your own image based on it, you could use the following command (inspired by issue #[291](https://github.com/jenkinsci/docker-inbound-agent/issues/291)):
This is an image based on `agent` for [Jenkins](https://jenkins.io) agents using TCP or WebSockets to establish inbound connection to the Jenkins master.

```dockerfile
FROM jenkins/agent as agent
[...]
ENV TZ=Asia/Shanghai
[...]
RUN ln -snf /usr/share/zoneinfo/"${TZ}" /etc/localtime && echo "${TZ}" > /etc/timezone \
&& dpkg-reconfigure -f noninteractive tzdata \
[...]
```
See [the `inbound-agent` README](./README_inbound-agent.md)
Loading