While working on a tool to autoscale GoCD agents, I happen to notice that BuildAssignmentService assigns a job to an agent but querying the agents API doesn't reflect the same.
2016-02-27 11:08:49,646 INFO [qtp515132998-26] BuildRepositoryRemoteImpl:106 - [Agent [5d0d5422798e, 172.17.0.3, d1130234-e5aa-43dc-a384-1a16f9a4679d, 56bb93ac-7493-4097-b136-8d93e157f926]] is reporting status and result [Completed, Passed] for [Build [test-no-env-long-running/9/defaultStage/1/defaultJob/42]]
2016-02-27 11:08:49,653 INFO [qtp515132998-26] Stage:218 - Stage is being completed by transition id: 239
2016-02-27 11:08:49,721 INFO [73@MessageListener for WorkFinder] BuildAssignmentService:115 - [Agent Assignment] Assigned job [JobIdentifier[test-no-env-short-1, 10, 10, defaultStage, 1, defaultJob, 43]] to agent [Agent [5d0d5422798e, 172.17.0.3, d1130234-e5aa-43dc-a384-1a16f9a4679d]]
2016-02-27 11:08:54,750 INFO [qtp515132998-26] GoConfigDao:194 - Config update request by anonymous is in queue - CompositeConfigCommand{commands=[UpdateAgentApprovalStatus{uuid='d1130234-e5aa-43dc-a384-1a16f9a4679d', denied=true}]}
2016-02-27 11:08:54,751 INFO [qtp515132998-26] GoConfigDao:198 - Config update request by anonymous is being processed
2016-02-27 11:08:54,758 INFO [qtp515132998-26] MagicalGoConfigXmlWriter:103 - [Serializing Config] Generating config partial.
2016-02-27 11:08:54,759 INFO [qtp515132998-26] GoFileConfigDataSource:247 - [Configuration Changed] Saving updated configuration.
2016-02-27 11:08:54,779 INFO [qtp515132998-26] CachedFileGoConfig:235 - About to notify config listeners
2016-02-27 11:08:54,781 INFO [qtp515132998-26] CachedFileGoConfig:243 - About to notify config listeners
2016-02-27 11:08:54,782 INFO [qtp515132998-26] BuildAssignmentService:172 - [Configuration Changed] Removing jobs for pipelines that no longer exist in configuration.
2016-02-27 11:08:54,784 INFO [qtp515132998-26] CachedFileGoConfig:251 - Finished notifying all listeners
2016-02-27 11:08:54,785 INFO [qtp515132998-26] CachedFileGoConfig:245 - Finished notifying all listeners
2016-02-27 11:08:54,786 INFO [qtp515132998-26] GoConfigDao:211 - Config update request by anonymous is completed
2016-02-27 11:08:54,810 INFO [qtp515132998-20] GoConfigDao:194 - Config update request by anonymous is in queue - CompositeConfigCommand{commands=[DeleteAgent{uuid='d1130234-e5aa-43dc-a384-1a16f9a4679d'}]}
2016-02-27 11:08:54,812 INFO [qtp515132998-20] GoConfigDao:198 - Config update request by anonymous is being processed
2016-02-27 11:08:54,819 INFO [qtp515132998-20] MagicalGoConfigXmlWriter:103 - [Serializing Config] Generating config partial.
2016-02-27 11:08:54,821 INFO [qtp515132998-20] GoFileConfigDataSource:247 - [Configuration Changed] Saving updated configuration.
2016-02-27 11:08:54,836 INFO [qtp515132998-20] CachedFileGoConfig:235 - About to notify config listeners
2016-02-27 11:08:54,837 INFO [qtp515132998-20] CachedFileGoConfig:243 - About to notify config listeners
From my tool's logs
16:38:54.750 scalar.go:98#Execute ▶ INFO 0044 Disabling the agent d1130234-e5aa-43dc-a384-1a16f9a4679d on Go Server
16:38:54.807 scalar.go:101#Execute ▶ DEBUG 0045 Checking if the disabled agent d1130234-e5aa-43dc-a384-1a16f9a4679d has started building
16:38:54.817 scalar.go:105#Execute ▶ DEBUG 0046 Disabled agent d1130234-e5aa-43dc-a384-1a16f9a4679d is in Idle state so deleting it
16:38:54.817 scalar.go:106#Execute ▶ INFO 0047 Deleting the agent d1130234-e5aa-43dc-a384-1a16f9a4679d on Go Server
16:38:55.216 docker.go:84#ScaleDown ▶ INFO 0048 Terminating agent d1130234-e5aa-43dc-a384-1a16f9a4679d created via Docker
The tool is running 5.30 hours ahead of the server TZ.
Notes
- I'm using the
travix/gocd-server docker image, running GoCD Version - 16.2.1(3027-07834a1f2ce79a13d42b03601698ef48f128a012)
- The tool first disables the agent and verifies if the agent has started building and if not, send a Delete request for the agent.
Any ideas on pointers on why is this happening?
BTW, when I increase the delay to 15 seconds or more, I don't see it happen often.
--