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

CI: local-bridge does not rebuild on new commit #629

Open
Thegaram opened this issue Mar 26, 2018 · 3 comments
Open

CI: local-bridge does not rebuild on new commit #629

Thegaram opened this issue Mar 26, 2018 · 3 comments
Labels

Comments

@Thegaram
Copy link
Contributor

I am building a local CI workflow based on self-ci, using the local git bridge.

The CI is running fine, but new commits are not picked up until I restart. The readme under local-bridge says: "DataKitCI can be configured to run the CI tests against the project each time a commit is made." What do I need to do to achieve this?

My config looks like this:

bridge:
  command: '--verbosity=debug --metadata-store tcp:datakit:5640 -v me/myproject:/data/repos/myproject'
  image: 'datakit/local-bridge'
  links:
    - datakit
  volumes:
    - '../myproject/.git:/data/repos/myproject/.git:ro'
ci:
  command: '--profile=localhost --metadata-store tcp:datakit:5640 --web-ui=http://localhost:8080/ --canary=me/myproject/heads/master'
  build: .
  links:
    - datakit
  ports:
    - '8080:8080'
  volumes:
    - '../myproject/.git:/mnt/myproject/.git:ro'
    - '/secrets'
    - '/var/run/docker.sock:/var/run/docker.sock'
@talex5 talex5 added the area/ci label Mar 27, 2018
@talex5
Copy link
Contributor

talex5 commented Mar 27, 2018

It used to work, but maybe something changed. Maybe it's the same read-only :ro problem as before?

When it's working correctly, you should see https://github.com/moby/datakit/blob/master/bridge/local/sync.ml#L26 logging a message when something changes, followed by https://github.com/moby/datakit/blob/master/bridge/local/sync.ml#L38.

That will wake https://github.com/moby/datakit/blob/master/bridge/local/sync.ml#L105 and you should see https://github.com/moby/datakit/blob/master/bridge/local/sync.ml#L81. You should then see a new commit appear in the DataKit Git repository with the new head. The CI monitors this and should rebuild.

If on_change isn't being called, maybe something went wrong setting up the watch at https://github.com/moby/datakit/blob/master/bridge/local/sync.ml#L48.

@Thegaram
Copy link
Contributor Author

Thegaram commented Apr 3, 2018

I tried again with local-bridge compiled and run directly (without docker) and it works this way. It seems to be a docker related issue, my container was not picking up the changes from the mounted volumes. This might be related.

@Thegaram Thegaram closed this as completed Apr 3, 2018
@Thegaram
Copy link
Contributor Author

Thegaram commented Apr 4, 2018

Okay it seems like docker does in fact correctly mount volumes. I created a simple container:

FROM alpine:3.5
ENTRYPOINT ["watch", "-n1", "tail /data/.git/logs/refs/heads/master"]

And then ran it, mounting my git repo:

$ docker build -t testvolume -f MyDockerfile .
$ docker run -it --rm -v /path/to/my/repo:/data:ro testvolume

And it correctly picked up any new commit messages. @talex5 do you have any ideas why picking up changes works natively (Mac) but does not work in a container for the local bridge?

Command to run natively:

$ ./main.exe --metadata-store tcp:127.0.0.1:5640 -v me/myproject:/path/to/my/repo

Command to run in a container:

$ docker run -it --rm --network host -v /path/to/my/repo/.git:/data/repos/myproject/.git datakit/local-bridge --metadata-store tcp:127.0.0.1:5640 -v me/myproject:/data/repos/myproject

@Thegaram Thegaram reopened this Apr 4, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants