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

feat: use Dockerhub API to poll for digest change #19

Merged
merged 25 commits into from
Aug 3, 2021

Conversation

qbiqing
Copy link
Contributor

@qbiqing qbiqing commented Jul 30, 2021

  • Use Dockerhub API (docs) instead of checking manifest from Docker registry (docs)
    so each poll does not count as an image pull. This is needed as we got warning from
    docker support of exceeding docker rate limits.
  • Mock Dockerhub server in tests.

@qbiqing qbiqing requested a review from xtrntr July 30, 2021 01:38
@xtrntr xtrntr requested a review from guangie88 July 30, 2021 01:39
@qbiqing qbiqing force-pushed the feat--webhook-dockerhub branch 4 times, most recently from f6f41c5 to ec25202 Compare July 30, 2021 05:47
@qbiqing qbiqing force-pushed the feat--webhook-dockerhub branch 5 times, most recently from bf322dd to ba5b63c Compare August 2, 2021 05:47
@qbiqing qbiqing force-pushed the feat--webhook-dockerhub branch from ba5b63c to 6ad435a Compare August 2, 2021 05:54
@qbiqing
Copy link
Contributor Author

qbiqing commented Aug 2, 2021

Also tried to get integration test to run in CI. The main difficulty is to run Docker-in-Docker. I tried the following:

  • First, naively install Docker in the test image. I do feel like that defeats the point of using alpine because we have to install docker, and openrc. Getting docker to start is also pretty unergonomic (can't use service or rc-service gliderlabs/docker-alpine#183 (comment)). Plus this blog post introduces a lot of other issues with using Docker in Docker. So I decided to follow his advice and try mounting the Docker socket as a volume.
  • I found this Codefresh guide which seems pretty useful. However I ran into quite some trouble following it. I tried to mount the volumes directly in the freestyle step but it didn't work. Also tried the lpipeline way (https://github.com/dsaidgovsg/lpipeline/blob/cceb826a9bb3a03ee5bcdc0c3833cbec121ef85e/codefresh-integration.yml#L122) yet /codefresh/volume/var/run/docker.sock was not found. I think it might be because as the guide says, the Docker daemon is not exposed in freestyle step on SaaS environments for security reasons.
  • Then I tried launching docker under a composition step as suggested. However, now Codefresh composition does not support volumes. Found this thread which explains the error (thanks @xtrntr for starting it!) and also posted a follow-up comment.

In conclusion I think the Docker-to-Docker setup may not be very compatible with Codefresh since they don't seem to expose the Docker daemon without some kind of customization of the runtime environment.

@qbiqing qbiqing force-pushed the feat--webhook-dockerhub branch from a0c6e5d to 2257367 Compare August 2, 2021 06:51
@xtrntr
Copy link
Contributor

xtrntr commented Aug 3, 2021

In conclusion I think the Docker-to-Docker setup may not be very compatible with Codefresh since they don't seem to expose the Docker daemon without some kind of customization of the runtime environment.

Thanks @qbiqing for documenting why the docker-in-docker approach failed 👍

@qbiqing qbiqing force-pushed the feat--webhook-dockerhub branch from b444da3 to 9af56f4 Compare August 3, 2021 01:58
@qbiqing qbiqing force-pushed the feat--webhook-dockerhub branch from 9af56f4 to 9dd4251 Compare August 3, 2021 02:02
@qbiqing
Copy link
Contributor Author

qbiqing commented Aug 3, 2021

Wrt to running docker-in-docker in CI, Codefresh support has replied the thread, so I think I will continue experimenting in another PR.

@qbiqing qbiqing force-pushed the feat--webhook-dockerhub branch from dcd31a0 to df2557a Compare August 3, 2021 10:26
Copy link
Contributor

@xtrntr xtrntr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks for this!

@qbiqing qbiqing merged commit bb6d093 into master Aug 3, 2021
@qbiqing qbiqing deleted the feat--webhook-dockerhub branch August 3, 2021 10:42
@qbiqing
Copy link
Contributor Author

qbiqing commented Aug 16, 2021

Updated note on using DinD for integration test: https://community.codefresh.io/t/mounting-docker-socket-in-composition-step/615/2

Short answer: not possible with SaaS codefresh

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants