Skip to content

Conversation

@ostrolucky
Copy link
Contributor

@ostrolucky ostrolucky commented Apr 22, 2018

So I have tested this one out on my fork, seems it works like a charm.

Here's what you got to do in Travis:

  • Define DOCKERHUB_LOGIN and DOCKERHUB_PASSWORD environment variables
  • Add a cron job

Notes:

@jakzal
Copy link
Owner

jakzal commented Apr 23, 2018

Thanks for working on this!

Makefile Outdated
.PHONY: build-alpine


NIGHTLY_TAG := jakzal/phpqa:nightly-$(shell date +%y%m%d)
Copy link
Owner

Choose a reason for hiding this comment

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

Shall we just use latest and alpine? These are meant for the latest versions of both image flavours.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No, I did it this way because I want a way to lock to specific version. Otherwise, same image pulled down later will get you tools with higher version, incompatible with your project.

Copy link
Owner

Choose a reason for hiding this comment

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

Hm.. this is not how daily builds usually work, so I got confused :) There's usually one (latest) daily build available.

I usually create tags right after new features or fixes are merged, and then a merge triggers a build.

How would creating a tag each day improve the situation for you? I'm worried we'd be generating lots of tags on docker hub.

Copy link
Contributor Author

@ostrolucky ostrolucky Apr 23, 2018

Choose a reason for hiding this comment

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

Generating lot of tags on docker hub is not a problem, I did mention this in OG post in this PR. But yes, it would be nice to optimize this later to NOT create new tag if nothing changed (no new versions of packages). But I suggest to do it later and not complicate this at this stage.

Here's how it improves situation for me:

  1. New patch release of Easy Coding Standard has been released which solves some issues I have
  2. There is no new release of phpqa (no, new releases are definitely not done often enough), but there is new nightly build, so I just require jakzal/phpqa:nightly-currentday
  3. New major release of Easy Coding Standard has been released, which changes configuration format from .neon to .yaml
  4. Build of my project is triggered again
  5. Nothing is broken because I've locked to nightly-currentday instead of :latest

Makefile Outdated
NIGHTLY_TAG := jakzal/phpqa:nightly-$(shell date +%y%m%d)
build-nightly:
docker build -t $(NIGHTLY_TAG) .
@docker login -u ${DOCKERHUB_LOGIN} -p ${DOCKERHUB_PASSWORD}
Copy link
Owner

Choose a reason for hiding this comment

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

Is the login/pass the only way? No tokens?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I don't think so

Copy link
Owner

Choose a reason for hiding this comment

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

There's a way to trigger builds on docker hub afterall: #48

Haven't tested it yet.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That approach couldn't be used because I want new tag based on %currentday.


NIGHTLY_TAG := jakzal/phpqa:nightly-$(shell date +%y%m%d)
build-nightly:
docker build -t $(NIGHTLY_TAG) .
Copy link
Owner

Choose a reason for hiding this comment

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

Since the image was already built in the current job we could probably push that one instead of building it again.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Don't worry this doesn't build it from scratch. It reuses all layers and just slaps new tag on it, it's quick. Didn't find a way how to do it differently

Copy link
Owner

Choose a reason for hiding this comment

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

Perhaps creating a new tag and pushing it would work. The Current way does take ~3min for some reason.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That's weird, it was quick for me. Of course provided other build steps were run before.

@ostrolucky
Copy link
Contributor Author

Did some more digging, it really looks like there is no way to create custom tags when building via their API.

Regarding login credentials, quay.io allows to login via token. But I don't think this is worth migration. They also don't say anything about usage limits.

@ostrolucky
Copy link
Contributor Author

Anything new? Or are you uncomfortable going forward? If that is so, let me know and I will create fork.

@jakzal
Copy link
Owner

jakzal commented May 1, 2018

I'll review this soon. Thanks again! 🍺

@jakzal
Copy link
Owner

jakzal commented May 1, 2018

FYI: https://forums.docker.com/t/is-there-a-max-number-of-tags-that-i-can-push-to-docker-hub-registry/1760/2

is there a limit on how many tags we can keep or is it unlimited?

The answer is going to change over time. Right now, there is no programmatic limit on the number of tags you can have, but there is a practical limit.

Some docker operations and Hub UI operations try to query all the tags at once, and that query can time out if there are too many tags. I’ve seen this happen some times at around the 100 mark when there really are 100+ different images. If you have multiple tags on the same image then you can probably go higher.

So in the near term I would suggest removing your older tags to keep below 100 unique images.

Over time we’ll improve the behavior of the APIs so they don’t time out or they page their results better, or we may put programmatic limits in place (if we did something like this, we’d let people know ahead of time and help those with lots of tags migrate).

@jakzal
Copy link
Owner

jakzal commented May 1, 2018

Ok, let's try it on jakzal/phpqa-nightly. I'm not comfortable with generating this many tags on the main repo. Especially for such an edge case.

In the same time we should work on:

@jakzal jakzal merged commit 87f72b9 into jakzal:master May 1, 2018
@jakzal
Copy link
Owner

jakzal commented May 1, 2018

Seems to work :) https://hub.docker.com/r/jakzal/phpqa-nightly/tags/

@jakzal jakzal mentioned this pull request Aug 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants