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

Pipeline was not running over EC2 Elastic Agent #20

Open
ppshein opened this issue Sep 26, 2021 · 7 comments · May be fixed by #25
Open

Pipeline was not running over EC2 Elastic Agent #20

ppshein opened this issue Sep 26, 2021 · 7 comments · May be fixed by #25

Comments

@ppshein
Copy link

ppshein commented Sep 26, 2021

I configured EC2 Elastic Agent plugin and attached with pipeline. Whenever I triggered pipeline, that plugin create EC2 instance and installed Elastic Agent in it but pipeline/jobs was not running and it kept showing unassigned agent and following logs even I found Elastic Agent name in Agent tab.

[go] Received request to create an instance for MY-PIPELINE/10/qa-repository/1/qa-run at 2021-09-26 10:44:59 +00:00
[go] Successfully created new instance i-03ec7648c31ebcdd3 in subnet-0eff9c4808b084349
[go] Received request to create an instance for MY-PIPELINE/10/qa-repository/1/qa-run at 2021-09-26 10:46:59 +00:00
[go] The number of instances currently running is currently at the maximum permissible limit, "1". Not creating more instances for jobs: MY-PIPELINE/4/qa-repository/1/qa-run, MY-PIPELINE/5/qa-repository/1/qa-run, MY-PIPELINE/6/qa-repository/1/qa-run, MY-PIPELINE/7/qa-repository/1/qa-run, MY-PIPELINE/8/qa-repository/1/qa-run, MY-PIPELINE/10/qa-repository/1/qa-run.
@VadymIriusRisk
Copy link

Hi,
I'd suggest you looking into the logs of the elastic agent. It could be caused by a lot of reasons, like no agent auto-approval configured, network connectivity issues, etc.

@jdavisp3
Copy link

jdavisp3 commented Oct 8, 2021

I'm running into this as well, trying to figure out the cause. I have one pipeline working fine and one where the agent never seems to pick up the job and I can't figure out what's different. Same elastic profile. It starts the instance and the agent gets all the way to registering with the server and getting the cookie. After that, nothing and eventually the instance is torn down and another one started.

@jdavisp3
Copy link

jdavisp3 commented Oct 8, 2021

One difference I note is that I see [Should Assign Work] Processing should assign work request for job messages from the plugin in the working pipeline but not for the non-working pipeline.

@jdavisp3
Copy link

Another difference -- the working pipeline was not in an environment and the non-working one is. Taking the non-working one out of an environment allowed it to work and the agent actually got the task scheduled to it. Still investigating, but this seems like a good clue.

@jdavisp3
Copy link

After more testing it seems pretty clear the issue is that pipelines in a GoCD Environment do not get scheduled when using this plugin. Simply taking the pipeline out of the Environment will work around the problem. I think this must be a bug in this plugin -- the ECS elastic plugin does not exhibit this behavior, for example.

@VadymIriusRisk
Copy link

This plugin does not have GoCD environments feature implemented yet, it should not work.

@vladimirtiukhtin
Copy link

The solution to it is rather simple: in "elastic profile" tab add the following string to user data field
echo agent.auto.register.environments={{ name of the desired env }} >> /var/lib/go-agent/config/autoregister.properties

@chadlwilson chadlwilson linked a pull request Apr 26, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants