jenkinsci / docker-agent

Jenkins agent (base image) and inbound agent Docker images
https://hub.docker.com/r/jenkins/inbound-agent/
MIT License
287 stars 230 forks source link

[JENKINS-44104] - Add optional support of downloading new Remoting versions from master #724

Open oleg-nenashev opened 7 years ago

oleg-nenashev commented 7 years ago

See https://issues.jenkins-ci.org/browse/JENKINS-44104

There was an attempt to do it in jenkinsci/docker-inbound-agent#19, but it was rejected. This update should be optional.

zhan9san commented 3 months ago

It can be done by pass VERSION as an argument when building an image.

https://github.com/jenkinsci/docker-agent/blob/8096ca3528b1e25d59a650e696f852d4d9b9d4bf/debian/Dockerfile#L101

Can we close this issue?

MarkEWaite commented 3 months ago

@zhan9san I believe that the request is to download the new remoting version when the container is run rather than when the container is built. Doesn't the ARG VERSION require a rebuild of the container image?

zhan9san commented 3 months ago

Hi @MarkEWaite

Let me try to understand this case.

User case

If a image tag, jenkins/inbound-agent:3261.v9c670a_4748a_9-2-jdk21 is used, and there is a new version such as 3262.xxx is released in https://github.com/jenkinsci/remoting/releases, the user does not want to rebuild the inbound-agent image but expects to use the 3262.xxx of remoting.

I think the only way we can do it is to add some logic in entrypoint, jenkins-agent.

Possible Solution

Add an environment variable JENKINS_AGENT_VERSION, and compare it with the remoting version in image. If it matches, do noting. If not, download the specified version and overwrite the existing one.

I'd like to hear your feedback.

MarkEWaite commented 3 months ago

I think that your idea would work, though I'm not that we want to add this suggested enhancement in any case. Replacing the version of remoting inside the agent container seems worse (to me) that expecting that the user will configure the remoting / agent version explicitly.

dduportal commented 3 months ago

If a image tag, jenkins/inbound-agent:3261.v9c670a_4748a_9-2-jdk21 is used, and there is a new version such as 3262.xxx is released in https://github.com/jenkinsci/remoting/releases, the user does not want to rebuild the inbound-agent image but expects to use the 3262.xxx of remoting.

That is true, but in that case, the user should track the image tag version and is expected to update it to jenkins/inbound-agent:3262.xxx => for 99% of the cases at least.

But let's consider you're using the :latest tag, in that case that would make sense to provide an optional "Retrieve last version". Of course the tagged version could benefit from this feature.

However it should not enabled by default. It's really important otherwise the default behavior stopped to be deterministic. It would be a huge source of breakage, hard to reproduce or debug.

Something like this could probably work:

$ docker run --rm --env JENKINS_USE_AGENT_FROM_CONTROLLER=true jenkins/inbound-agent:3261.v9c670a_4748a_9-2-jdk21
# ... Download agent.jar version from the agent with a log message informing the user that specified agent version is overided)

WDYT?

zhan9san commented 3 months ago

That is true, but in that case, the user should track the image tag version and is expected to update it to jenkins/inbound-agent:3262.xxx => for 99% of the cases at least.

Totally agree with you. If the tag version is not the same as the one really using, it would introduce confusion.

docker run --rm --env JENKINS_USE_AGENT_FROM_CONTROLLER=true jenkins/inbound-agent:3261.v9c670a_4748a_9-2-jdk21

it would introduce confusion also.

I find the original request is for compatibility

In my option, the remoting version should be set explicitly.

Generally, if we upgrade jenkins controller, we have to test the compatibility firstly, whether the remoting works with both old and new version of controller before upgrade.

dduportal commented 3 months ago

I'm sorry I don't understand what you are asking for then.

If you want the remoting version XX then you only use the Docker image jenkins/inbound-agent:XX no? That is the whole reason why using this Docker image should be done with tags.

I might be missing something: can you elaborate on the root problem?

zhan9san commented 3 months ago

The request is from https://github.com/jenkinsci/docker-agent/issues/724#issue-2085104406

IIUC, the request expects to overwrite the remoting version in image to another one which is from Jenkins controller.

I think we should reject it as well.

dduportal commented 3 months ago

The request is from #724 (comment)

IIUC, the request expects to overwrite the remoting version in image to another one which is from Jenkins controller.

I think we should reject it as well.

Oh my bad, i understand now. I agree with you, the issue should be refused !