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

Only rebuild daily if a package changed #15

Closed
wants to merge 1 commit into from
Closed

Conversation

james-w
Copy link
Contributor

@james-w james-w commented Feb 2, 2017

When the build is triggered by CRON check whether any of
the packages changed before building each version.

This will prevent wasting build time and pushing new versions
if nothing has changed.

The builds triggered by new master revisions will still
push new versions, so any changes to the scripts will result
in a new image.

@chipironcin
Copy link
Contributor

So, daily builds will only be pushed if packages have been updated and manually triggered builds and builds triggered by changes in the repo will push a new version because it implies something changed in the source code.

Is that right?

This approach is more simple than #12 and #14 and will avoid rebuilding BUT it relies on Travis "cron" build type and logical assumptions:

  • If it is not cron triggered, is because there is a change = push
  • If it is cron triggered, check all package versions. If there is a change = push

#14 is always pushing as they are reproducible builds. It has a reliable way of checking if there are changes.
Here you are just avoiding rebuild/push if nothing changed.

Reproducible builds are not useful right now but it is a good way to ensure anything that changes will be pushed. Also they dont rely on the type of build (cron or triggered by change).
In the other hand, this one values simplicity. We dont currently need reproducible builds, but just to know when to push a new version.

If someone ever wants to run the scripts locally and push them to a container hub, it would be better to have reproducible builds. If Travis changes its API, or dissapear or whatever, we lose our hability to detect wether to push or not.

I would still go with #14 but it is a hard decission, I will let others jump in and give their opinion on this :)

@chipironcin chipironcin mentioned this pull request Feb 2, 2017
@james-w
Copy link
Contributor Author

james-w commented Feb 2, 2017

Hi,

To be clear, I am proposing landing both #14 and this one. This will solve the problem of
pushing a new image every day even if nothing changed. The other will mean that
if nothing changes on a push build then it will at least use the same layer as the previous
push. I can't yet produce exactly the same image, just the same layers.

So, daily builds will only be pushed if packages have been updated and manually triggered builds and
builds triggered by changes in the repo will push a new version because it implies something changed
in the source code.

Is that right?

Yes, that is right.

I think this does a good job of only building when it is likely that a different image will be produced.
I think that is good enough.

The reproduciblity would mean that when that was wrong (e.g. someone pushes just a README change) then the layer would be re-used even though we pushed an image when we didn't
need to. Plus it is cool.

As for relying on the travis type, there's no way to set an env var in travis for just a cron build, otherwise I would name the variable something not related to travis and set it just for those builds.

When the build is triggered by CRON check whether any of
the packages changed before building each version.

This will prevent wasting build time and pushing new versions
if nothing has changed.

The builds triggered by new master revisions will still
push new versions, so any changes to the scripts will result
in a new image.
@chipironcin
Copy link
Contributor

I see, if you manage to reproduce the same image in #14, will this PR be still necessary?
If the image is fully reproducible, pushing will make no harm, right?

@james-w
Copy link
Contributor Author

james-w commented Feb 6, 2017

Yeah, if the image is fully reproducible then pushing will make no changes. However:

  1. The image isn't fully reproducible today. We can reproduce the layers, but not the image at the moment.
  2. This would still skip the effort of building if we knew that there would be no changes.

@chipironcin
Copy link
Contributor

That effort is nothing as we already triggered a build in Travis, we are just saving a few minutes. I would like to make #14 fully image reproducible. Let me know if I can help with it

@james-w james-w closed this Feb 23, 2017
@carrodher carrodher deleted the check-before-build branch March 16, 2021 09:49
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