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

Add support for mutable branches (not recommended) #24

Open
nedtwigg opened this issue Jun 21, 2021 · 0 comments
Open

Add support for mutable branches (not recommended) #24

nedtwigg opened this issue Jun 21, 2021 · 0 comments
Labels
enhancement New feature or request

Comments

@nedtwigg
Copy link
Member

nedtwigg commented Jun 21, 2021

Blowdryer supports GitHub, GitLab, and Bitbucket in the following modes: COMMIT, TAG, and optionally TREE. The key property these modes share is that they are immutable. Blowdryer can compute the URL for any of these resources without making a network call, and once it has downloaded that URL, Blowdryer will never need to request it again. Immutable builds are a good practice, they let Blowdryer support fully offline builds, and it's a performance improvement as well.

Rather than basing your build on links to immutable scripts, you could base them instead on mutable scripts, e.g.

blowdryerSetup {
  github('acme/blowdryer-acme', 'branch', 'master')

The advantage of this would be that as the scripts in master improved, all of the builds which rely on them will also improve. But the downside is that your builds will no longer be reproducible. If you check out an old commit, the scripts at blowdryer-acme branch master might have changed, and so the build results will change. This will make it very difficult to track down regressions, because you can't tell if the changes came from the repo you're looking at, or from the repo you're pointing to from blowdryer.

build = f(repo) is easy to work with. Pointing to a mutable branch changes that to build = f(repo, current_time)

But I want to do it anyway

I am pretty sure this is a bad idea, but if you want to do it, I am happy to merge a PR which adds support for mutable branches. If you make such a PR, it should be implemented roughly along these lines:

public class BlowdryerSetup {
  ..
  public enum GitAnchorType { TAG, COMMIT, TREE } // no new branch mode

  public class GitHub {
      String anchor;
      GitAnchorType anchorType;
      ...
      public GitHub branchBuildNotReproducible(String branch) {
        anchorType = GitAnchorType.COMMIT;
        anchor = networkRequestLookupCommitSha(branch);
        return this;
      }
    }

And the usage would be

blowdryerSetup {
  github('acme/blowdryer-acme', 'TAG', 'UNUSED').branchBuildNotReproducible('master')

Basically, if you want to bring mutability into blowdryer, it should all be resolved within the blowdryerSetup block, so that the mutability doesn't ripple throughout the system.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant