'how to configure jenkins with ecs build agent? container stops after first build and connection between master and node breaks up
I am trying to set up jenkins with ECS to run build agents. My jenkins is running on an EC2 Linux instance and I have created an EC2 cluster in ECS, in which agents are running fine.
Under "Jenkins -> Manage Jenkins", I configured things as follows:
- I used ECS plugin and set the details under manage "jenkins -> clouds". Values are:
Name: ecstestingecs cluster: triallabel: testingdockerimage: cloudbees/jnlp-slave-with-java-build-toolsfilesystem root: /home/jenkinsmemory: 2048Cpu units: 1- The Jnlp port is set to 5000
To run the build, I used the 'testing' label as mentioned above. When I start building the output is :
Started by user ashwin
Building remotely on ForECS-2f657a4fcfe3 (testing) in workspace /home/jenkins/workspace/testing12
[testing12] $ /bin/sh -xe /tmp/jenkins1810584247774234437.sh
+ whoami
jenkins
Finished: SUCCESS
And, when i click on ForECS (container name): it prompts:
this agent is offline because Jenkins failed to launch the agent process on it
java -jar agent.jar -jnlpUrl http://ip:8080/computer/ForECS-2f657a4fcfe3/slave-agent.jnlp -secret xxxxxxxx
When I run the above command, the node starts running for 10 seconds and disconnnects itself.
The agent container logs :
Mar 27, 2019 4:06:00 PM hudson.remoting.jnlp.Main createEngine
INFO: Setting up agent: ForECS-2f657a4fcfe3
Mar 27, 2019 4:06:00 PM hudson.remoting.jnlp.Main$CuiListener <init>
INFO: Jenkins agent is running in headless mode.
16:06:00.662 INFO [GridLauncherV3.parse] - Selenium server version: 3.141.59, revision: e82be7d358
Mar 27, 2019 4:06:00 PM hudson.remoting.Engine startEngine
INFO: Using Remoting version: 3.27
Mar 27, 2019 4:06:00 PM hudson.remoting.Engine startEngine
WARNING: No Working Directory. Using the legacy JAR Cache location: /home/jenkins/.jenkins/cache/jars
16:06:00.782 INFO [GridLauncherV3.lambda$buildLaunchers$3] - Launching a standalone Selenium Server on port 4444
Mar 27, 2019 4:06:00 PM hudson.remoting.jnlp.Main$CuiListener status
INFO: Locating server among [http://3.82.152.154:8080/]
Mar 27, 2019 4:06:00 PM org.jenkinsci.remoting.engine.JnlpAgentEndpointResolver resolve
INFO: Remoting server accepts the following protocols: [JNLP4-connect, Ping]
Mar 27, 2019 4:06:00 PM hudson.remoting.jnlp.Main$CuiListener status
INFO: Agent discovery successful
Agent address: 3.82.152.154
Agent port: 5000
Identity: b2:be:51:65:ee:0b:1a:85:63:3b:32:92:05:8c:9c:eb
Mar 27, 2019 4:06:00 PM hudson.remoting.jnlp.Main$CuiListener status
INFO: Handshaking
Mar 27, 2019 4:06:00 PM hudson.remoting.jnlp.Main$CuiListener status
INFO: Connecting to 3.82.152.154:5000
Mar 27, 2019 4:06:00 PM hudson.remoting.jnlp.Main$CuiListener status
INFO: Trying protocol: JNLP4-connect
2019-03-27 16:06:00.834:INFO::main: Logging initialized @410ms to org.seleniumhq.jetty9.util.log.StdErrLog
Mar 27, 2019 4:06:00 PM hudson.remoting.jnlp.Main$CuiListener status
INFO: Remote identity confirmed: b2:be:51:65:ee:0b:1a:85:63:3b:32:92:05:8c:9c:eb
16:06:01.069 INFO [WebDriverServlet.<init>] - Initialising WebDriverServlet
16:06:01.187 INFO [SeleniumServer.boot] - Selenium Server is up and running on port 4444
Mar 27, 2019 4:06:01 PM hudson.remoting.jnlp.Main$CuiListener status
INFO: Connected
Mar 27, 2019 4:06:05 PM hudson.remoting.jnlp.Main$CuiListener status
INFO: Terminated
I found the number of executors in default docker image is 1, is it could be the reason for container to be stopped?
How do I make containers stay running and connected ?
In short : what is the correct way to set up an ECS build agent?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
