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 "bashbrew fetch" command #63

Merged
merged 2 commits into from
Jan 31, 2023
Merged

Conversation

tianon
Copy link
Member

@tianon tianon commented Jan 30, 2023

In many, many, many scripts I have encoded the horrible assumption that ArchDockerFroms will ensure our Git repository is fetched (which is a side-effect of that function). With the implementation of Builder: oci-import, that side effect is not necessary for returning an accurate result in these new images. Instead of working around this in bad ways, I've decided to finally bite the bullet and add an explicit bashbrew fetch command that can make sure all the underlying Git commits are fully fetched into the local cache.

In many, many, many scripts I have encoded the horrible assumption that `ArchDockerFroms` will ensure our Git repository is fetched (which is a side-effect of that function).  With the implementation of `Builder: oci-import`, that side effect is not necessary for returning an accurate result in these new images.  Instead of working around this in bad ways, I've decided to finally bite the bullet and add an explicit `bashbrew fetch` command that can make sure all the underlying Git commits are fully fetched into the local cache.
This not only returns the path to the "git cache" directory, but ensures it is initialized and that `git` commands against it will generally succeed.
Comment on lines +59 to +65
"gitCache": func() (string, error) {
err := ensureGitInit()
if err != nil {
return "", err
}
return gitCache(), nil
},
Copy link
Member Author

Choose a reason for hiding this comment

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

This one added function covers at least 95% of the cases where I set BASHBREW_CACHE in scripts 🙈

It also removes the need for bashbrew from hello-world that I do in a lot of those place (whose purpose is just to make sure ensureGitInit has been invoked 😭).

@codecov-commenter
Copy link

Codecov Report

Merging #63 (cec429f) into master (5990ace) will not change coverage.
The diff coverage is n/a.

📣 This organization is not using Codecov’s GitHub App Integration. We recommend you install it so Codecov can continue to function properly for your repositories. Learn more

@@           Coverage Diff           @@
##           master      #63   +/-   ##
=======================================
  Coverage   73.10%   73.10%           
=======================================
  Files           7        7           
  Lines         714      714           
=======================================
  Hits          522      522           
  Misses        162      162           
  Partials       30       30           

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@tianon tianon merged commit 82fa443 into docker-library:master Jan 31, 2023
@tianon tianon deleted the fetch branch January 31, 2023 16:50
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.

3 participants