JetBrains / teamcity-docker-agent

TeamCity agent docker image sources
https://hub.docker.com/r/jetbrains/teamcity-agent/
Apache License 2.0
77 stars 64 forks source link

agent container downloads update in loop #70

Closed braunp closed 4 years ago

braunp commented 4 years ago

Hi, I am trying to set up a teamcity agent (version 2019.2.2 as the server instance is using that version) in my company cloud. I am able to start a container based on the image and able to connect to my server instance. however, the agent is restarted when the download is finished. On new startup the agents also starts to download everything again (in loop...)

Currently I dont get what I need to configure to get the tools installed. Is there a way to skip the download to be able to verify the agent can be authorized on server side?

thanks Patrick

kir commented 4 years ago

Hi @braunp , sorry for the problem.

To investigate this we need buildAgent/logs from the build agent container. Do you have any custom TeamCity plugins installed on the server? Some improper packaging of such plugins may result in such a problem.

Another thing to try - run a TeamCity agent without docker - would it upgrade correctly without restart?

For further investigation and to provide logs, please create an issue in YouTrack: https://youtrack.jetbrains.com/issues/TW

Thanks,

braunp commented 4 years ago

Hi @kir I did check the logs and noticed that the issue is with missing permissions. I am trying to run the agent in an openshift environment and I cant run it as root. I am wondering if this is currently possible with my environment and the agent setup. I don't understand why I have an image but it is updated after starting the container/pod

kir commented 4 years ago

Hi @braunp, try using the latest TeamCity build agent image. It runs under non-root user, and it should correctly downgrade if connected to the older TeamCity server version.

braunp commented 4 years ago

Hi @kir it the upgrade.log i found the following stacktrace. Running 2020.1.1 agent and 2019.2.2 server

java.lang.NoClassDefFoundError: jetbrains/buildServer/agent/LauncherUtil$DeleteDecision at jetbrains.buildServer.agent.LauncherUtil.delete(LauncherUtil.java:213) at jetbrains.buildServer.agent.upgrade.AgentUpgrade.applyUpdates(AgentUpgrade.java:89) at jetbrains.buildServer.agent.upgrade.UpgradeRunBase.run(UpgradeRunBase.java:41) at jetbrains.buildServer.agent.upgrade.UpgradeMode$5.run(UpgradeMode.java:133) at jetbrains.buildServer.agent.upgrade.Upgrade2$1.lockHeld(Upgrade2.java:57) at jetbrains.buildServer.agent.upgrade.Upgrade2$1.lockHeld(Upgrade2.java:55) at jetbrains.buildServer.agent.lock.impl.misc.MockLock.assumeLocked(MockLock.java:22) at jetbrains.buildServer.agent.lock.impl.misc.MockLock.tryLock(MockLock.java:14) at jetbrains.buildServer.agent.upgrade.Upgrade2.main3(Upgrade2.java:54) at jetbrains.buildServer.agent.upgrade.Upgrade2.main2(Upgrade2.java:27) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at jetbrains.buildServer.agent.ClazzLoader.call(ClazzLoader.java:59) at jetbrains.buildServer.agent.ClazzLoader.callMain2(ClazzLoader.java:19) at jetbrains.buildServer.agent.upgrade.Upgrade.main(Upgrade.java:16) Caused by: java.lang.ClassNotFoundException: jetbrains.buildServer.agent.LauncherUtil$DeleteDecision at java.net.URLClassLoader.findClass(URLClassLoader.java:382) at java.lang.ClassLoader.loadClass(ClassLoader.java:418) at java.lang.ClassLoader.loadClass(ClassLoader.java:351) ... 17 more

kir commented 4 years ago

Hi, our team tested connecting newer teamcity-agent image to older teamcity-server - works fine (but outside K8S). So there should be some other reasons for this error, related to you environment :(

To help with that we'll need logs from your agent and server instances. Please use our issue tracker to create a ticket and provide the corresponding details.

braunp commented 4 years ago

Hi @kir I need to check if I can get access to the server logs. I am not the "owner" of the server and I simply want to run my own agent. We can close this issue for now and once I have the logs I will create a ticket in your issue-tracker Many thanks for your help so far!

cheers Patrick

kir commented 4 years ago

Thanks, Patrick. Hope it will work out finally :)