3 # 2. GoCD agent responds
4 # 3. GoCD agent is available on GoCD server using GoCD API
5 # 3.1. https://api.go.cd/current/#get-all-agents
8 serverUrl = "localhost:8153/go/api/agents";
9 header = "Accept: application/vnd.go.cd.v2+json";
12 import ./make-test-python.nix ({ pkgs, ...} : {
14 meta = with pkgs.lib.maintainers; {
15 maintainers = [ grahamc swarren83 ];
17 # gocd agent needs to register with the autoregister key created on first server startup,
18 # but NixOS module doesn't seem to allow to pass during runtime currently
26 virtualisation.memorySize = 2046;
27 services.gocd-agent = {
30 services.gocd-server = {
38 agent.wait_for_unit("gocd-server")
39 agent.wait_for_open_port(8153)
40 agent.wait_for_unit("gocd-agent")
41 agent.wait_until_succeeds(
42 "curl ${serverUrl} -H '${header}' | ${pkgs.jq}/bin/jq -e ._embedded.agents[0].uuid"
45 "curl ${serverUrl} -H '${header}' | ${pkgs.jq}/bin/jq -e ._embedded.agents[0].agent_state | grep Idle"