Description
What
I propose to build both images in this repository.
Why
- Faster agents release:
- Both images build in the same job
- in parallel in case of Linux images
- sequentially in case of Windows images, with inbound-agent benefiting from the agent container image build cache
- No need to wait merging docker-agent image, wait for the tag then the publication on Docker Hub, then updatecli PR on docker-inbound agent, merge, tag and publication again.
- Both images build in the same job
- Less work and maintenance
- One common Dockerfile per OS flavor (Alpine, Debian, Nanoserver, Windows Server Core)
- There is no Archlinux inbound-agent image, a new one could easily be added but Decide the future of the Archlinux image: either add "Archlinux JDK17" or remove "Archlinux JDK11" #422
- One common set of tests helpers
- One common images and tags definition
- docker bake file for Linux images
- docker compose file for Windows images
- One common Dockerfile per OS flavor (Alpine, Debian, Nanoserver, Windows Server Core)
- No change whatsoever for final users
- Same Docker Hub repositories, images, tags and content
- No practical change for contributors
- Better possibilities for custom local builds and tests
How
Code wise
I'm using multistages Dockerfiles, docker bake's matrix
for Linux images (allowing parallel builds), and a loop over "agent" and "inbound-agent" with docker compose and --target
for Windows images.
I've splitted my pull requests commits:
- Renamed agent files
- Imported files from inbound-agent, with their related git history reapplied as patch
- One atomic commit with all code changes
New file
- README.md
Modified
- .gitignore
- alpine/Dockerfile
- build.ps1
- build.sh
- debian/Dockerfile
- debian/preview/Dockerfile
- docker-bake.hcl
- Jenkinsfile
- Makefile
- tests/agent.Tests.ps1
- tests/test_helpers.bash
- tests/test_helpers.psm1
- windows/nanoserver/Dockerfile
- windows/windowsservercore/Dockerfile
Renamed from agent
- README_agent.md
Renamed and modified from agent
- tests/tests_agent.bats
Imported from inbound-agent
- jenkins-agent
- jenkins-agent.ps1
- tests/netcat-helper/Dockerfile
- tests/netcat-helper/Dockerfile-windows
Imported and renamed from inbound-agent
- README_inbound-agent.md
Imported and modified from inbound-agent
- tests/inbound-agent.Tests.ps1
Imported, renamed and modified from inbound-agent
- .github/workflows/sync-dockerhub-readme.yml
- tests/tests_inbound-agent.bats
PR preview: lemeurherve/docker-agent@master...feat-build-both-agent-and-inbound-agent
Main commit: lemeurherve@8f27a4e
Repo wise
At first I was about to ask about which repo use as final repo between docker-agent and docker-inbound-agent, but after more reflexion (and all the work on git history), I think this repo makes more sense as the only benefit of inbound-agent repo would be some more GitHub stars and watchers.
If going that way, merging the PR will allow testing a real publication of agent and inbound-agent for this repo to validate the process.
Then, we could:
- Add a "inbound-label" to every inbound-agent repo issues
- Transfer these issues here
- (Optional) Create a last
999.999.999
empty inbound-agent release with a warning/note in the release note mentioning the move to the docker-agent repo, so users will get a notification - Add the same kind of mention in inbound-agent README
- Archive inbound-agent repo
- (Optional) Rename this repo to reflect it contains both agent. Suggestions: "docker-agents", "docker-agent-inbound"
- Adapt jobs on ci.jenkins.io and trusted.ci.jenkins.io
- Rename the "agent" ones
- Remove the "inbound-agent" ones
Alternative:
Create a new repo like "docker-agent-inbound" for example, then label and transfer issues from the existing repos, then archive then. (+ optional "warning" releases).
This option is fine to me too as I would simply have to change the git reference in my local repo config to push to it.
@jenkinsci/team-docker-packaging WDYT?