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

hope debian jdk 11 inbound-agent timezone UTC--->CST #602

Closed
l19891223j opened this issue Oct 9, 2022 · 6 comments
Closed

hope debian jdk 11 inbound-agent timezone UTC--->CST #602

l19891223j opened this issue Oct 9, 2022 · 6 comments

Comments

@l19891223j
Copy link

l19891223j commented Oct 9, 2022

What feature do you want to see added?

[root@xxx debian]#
[root@xxx debian]# pwd
/root/test/docker-inbound-agent-4.10-2/11/debian
[root@xxx debian]# ls
Dockerfile jenkins-agent
// docker build 时需要把jenkins-agent文件拷贝到当前目录下
[root@xxx debian]# cat Dockerfile


ARG version=4.9-1-jdk11
FROM jenkins/agent:$version

**ENV TIME_ZONE Asia/Shanghai**
ARG version
LABEL Description="This is a base image, which allows connecting Jenkins agents via JNLP protocols" Vendor="Jenkins project" Version="$version"

ARG user=jenkins

USER root
RUN apt-get install -y tzdata \
    && ln -snf /usr/share/zoneinfo/$TIME_ZONE /etc/localtime && echo $TIME_ZONE > /etc/timezone \
    && dpkg-reconfigure -f noninteractive tzdata \
    && apt-get clean \
    && rm -rf /tmp/* /var/cache/* /usr/share/doc/* /usr/share/man/* /var/lib/apt/lists/*

#COPY ../../jenkins-agent /usr/local/bin/jenkins-agent  
COPY ./jenkins-agent /usr/local/bin/jenkins-agent
RUN chmod +x /usr/local/bin/jenkins-agent &&\
    ln -s /usr/local/bin/jenkins-agent /usr/local/bin/jenkins-slave
RUN apt-get -y install curl
USER ${user}

ENTRYPOINT ["/usr/local/bin/jenkins-agent"]

Upstream changes

No response

@dduportal
Copy link
Contributor

Interesting, that would be a nice feature to contribute into jenkinsci/docker-agent, which is the parent image. Are you interested into the contribution? (if you are not, another community member can take this contribution on their own instead, no worry).

@gounthar
Copy link
Contributor

gounthar commented Nov 24, 2022

I can make a PR for that (I've already started), but first of all, I'd like to understand why we should go from UTC to CST. 🤔
If you're in Asia, it totally makes sense to me, but what about the rest of the world?
Did I misunderstand, and would anyone benefit from his own timezone when using the image?
I don't think so.

What is the goal, and what are the pros of doing that?

Thanks.

@gounthar
Copy link
Contributor

gounthar commented Nov 24, 2022

After discussing a bit with @dduportal, we agreed that your proposal was maybe to add the tzdata package to let developers use their own timezone when creating a Docker image based on Jenkins' docker-agent image.

I guess @l19891223j you're building an image based on the inbound or docker-agent. If we add in the docker-agent image the tzdata package, you will be able to call this code in your Dockerfile or in your pipeline:

ln -snf /usr/share/zoneinfo/$TIME_ZONE /etc/localtime && echo $TIME_ZONE > /etc/timezone \
    && dpkg-reconfigure -f noninteractive tzdata

As ENV is persisted in the final image, we maybe should use ARG instead of ENV, or omit it.

I will then make two PRs:

  • one for adding the tzdata package
  • one for adding a paragraph in the README.md file to explain how to configure your own timezone when building a Docker image from docker-agent.

@gounthar
Copy link
Contributor

@dduportal proposed something even simpler which does not require you to build your own image.

@dduportal
Copy link
Contributor

Hi @l19891223j , the latest inbound image is now having tzdata. As documented in https://github.com/jenkinsci/docker-agent#timezones, you should be able to achieve timezone inside container agents.

Can you confirm by closing the issue or commenting out what you tried (and the problem you have) with latest version?

@lemeurherve
Copy link
Member

No response since eight months, closing this issue.

@lemeurherve lemeurherve transferred this issue from jenkinsci/docker-inbound-agent Jan 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants