Skip to content
This repository was archived by the owner on Jul 30, 2018. It is now read-only.
This repository was archived by the owner on Jul 30, 2018. It is now read-only.

gocd-agent Auto Register not working #22

@holybit

Description

@holybit

Tried setting agent auto register properties a few ways with the 16.1.0 image but nothing is working. Running docker engine 1.9.1.

Here is an example of building an image from gocd/gocd-agent:16.1.0 with a properties files, but somehow the agent is removing the properties file.

# Basic Docker files for this experiment
$ ls -1
Dockerfile
autoregister.properties
docker-compose.yml

$ cat autoregister.properties
agent.auto.register.key=23456789abcdef

$ cat docker-compose.yml
gocd-agent-test:
  build: .
  restart: always
  container_name: gocd-agent-test
  environment:
     - GO_SERVER=gocd.efp.local
  ports:
     - 8153:8153
     - 8154:8154

$ cat Dockerfile
FROM gocd/gocd-agent:16.1.0

COPY autoregister.properties /var/lib/go-agent/config/autoregister.properties
RUN chown go:go /var/lib/go-agent/config/autoregister.properties

# I use docker-compose to run a build
$ docker-compose build
Building gocd-agent-test
Step 1 : FROM gocd/gocd-agent:16.1.0
 ---> 0aada6d4d4f9
Step 2 : COPY autoregister.properties /var/lib/go-agent/config/autoregister.properties
 ---> b46ba3316b82
Removing intermediate container 995c1663ea46
Step 3 : RUN chown go:go /var/lib/go-agent/config/autoregister.properties
 ---> Running in 31c4d255c23b
 ---> 6a4d26762ece
Removing intermediate container 31c4d255c23b
Successfully built 6a4d26762ece

# The resultant image from the build
$ docker images
REPOSITORY                                TAG                 IMAGE ID            CREATED             VIRTUAL SIZE
efpvoltrongocdagentdind_gocd-agent-test   latest              6a4d26762ece        2 minutes ago       455.5 MB
gocd/gocd-agent                           16.1.0              0aada6d4d4f9        3 weeks ago         455.5 MB
docker/compose                            1.5.2               a1614be747d3        10 weeks ago        58.6 MB

# If I run the container I just built the properties file exists
$ docker run -it --rm efpvoltrongocdagentdind_gocd-agent-test bash
root@14bdfe14c2df:/tmp# cat /var/lib/go-agent/config/autoregister.properties
agent.auto.register.key=23456789abcdef
root@14bdfe14c2df:/tmp# exit
exit

# Now I run the container in daemon mode
$ docker-compose up -d && docker logs -f gocd-agent-test
Creating gocd-agent-test
*** Running /etc/rc.local...
*** Booting runit daemon...
*** Runit started as PID 7
Starting Go Agent to connect to server gocd.efp.local ...
tail: unrecognized file system type 0x794c7630 for ‘/var/log/syslog’. please report this to bug-coreutils@gnu.org. reverting to polling
[Sat Feb 13 06:20:07 UTC 2016] using default settings from /etc/default/go-agent
logFile Environment Variable= null
Logging to go-agent-bootstrapper.log
0 [TouchLoopThread-2] INFO com.thoughtworks.go.agent.launcher.Lockfile  - Using lock file: /var/lib/go-agent/.agent-bootstrapper.running
194 [main] INFO com.thoughtworks.go.agent.launcher.ServerBinaryDownloader  - download started at Sat Feb 13 06:20:07 UTC 2016
201 [main] INFO com.thoughtworks.go.agent.launcher.ServerBinaryDownloader  - got server response at Sat Feb 13 06:20:07 UTC 2016
431 [main] INFO com.thoughtworks.go.agent.launcher.ServerBinaryDownloader  - pipe the stream to admin/agent at Sat Feb 13 06:20:08 UTC 2016
436 [main] INFO com.thoughtworks.go.util.PerfTimer  - Performance: Downloading new admin/agent with md5 signature: WF19vAJ7DYffVfYO6yT19A== took 245ms
438 [main] INFO com.thoughtworks.go.agent.common.util.JarUtil  - Attempting to load Go-Agent-Bootstrap-Class from agent.jar File:
439 [main] INFO com.thoughtworks.go.agent.common.util.JarUtil  - manifestClassKey: Go-Agent-Bootstrap-Class: com.thoughtworks.go.agent.AgentProcessParentImpl
442 [main] INFO com.thoughtworks.go.agent.AgentProcessParentImpl  - Agent is version: 16.1.0
558 [main] INFO com.thoughtworks.go.agent.launcher.ServerBinaryDownloader  - download started at Sat Feb 13 06:20:08 UTC 2016
564 [main] INFO com.thoughtworks.go.agent.launcher.ServerBinaryDownloader  - got server response at Sat Feb 13 06:20:08 UTC 2016
580 [main] INFO com.thoughtworks.go.agent.launcher.ServerBinaryDownloader  - pipe the stream to admin/agent-plugins.zip at Sat Feb 13 06:20:08 UTC 2016
581 [main] INFO com.thoughtworks.go.util.PerfTimer  - Performance: Downloading new admin/agent-plugins.zip with md5 signature: a267a82eacccce310ea197cb02b659c0 took 23ms
586 [main] INFO com.thoughtworks.go.agent.AgentProcessParentImpl  - Launching Agent with command: /usr/lib/jvm/java-7-openjdk-amd64/jre/bin/java -Dcruise.console.publish.interval=10 -Xms128m -Xmx256m -Djava.security.egd=file:/dev/./urandom -Dagent.launcher.version=Unknown -Dagent.plugins.md5=a267a82eacccce310ea197cb02b659c0 -Dagent.binary.md5=WF19vAJ7DYffVfYO6yT19A== -Dagent.launcher.md5=e9SXM6cdV5kSkpVEmymHIg== -jar agent.jar https://gocd.efp.local:8154/go/

$ docker ps -a
CONTAINER ID        IMAGE                                     COMMAND             CREATED             STATUS              PORTS                              NAMES
3ce830106a3c        efpvoltrongocdagentdind_gocd-agent-test   "/sbin/my_init"     32 seconds ago      Up 31 seconds       0.0.0.0:8153-8154->8153-8154/tcp   gocd-agent-test

# And exec into it. The properties file is not there.
$ docker exec -it gocd-agent-test bash
root@9b00561cc118:/tmp# ls /var/lib/go-agent/config/autoregister.properties
ls: cannot access /var/lib/go-agent/config/autoregister.properties: No such file or directory

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions