Add "bashbrew fetch" command by tianon · Pull Request #63 · docker-library/bashbrew · GitHub
Skip to content

Add "bashbrew fetch" command#63

Merged
tianon merged 2 commits into
docker-library:masterfrom
infosiftr:fetch
Jan 31, 2023
Merged

Add "bashbrew fetch" command#63
tianon merged 2 commits into
docker-library:masterfrom
infosiftr:fetch

Conversation

@tianon

@tianon tianon commented Jan 30, 2023

Copy link
Copy Markdown
Member

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 thread cmd/bashbrew/cmd-cat.go
Comment on lines +59 to +65

Copy link
Copy Markdown
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
Copy Markdown

@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