feat: refactor uploading and ignore processing#255
Merged
Conversation
c1f7dd1 to
b74dd82
Compare
This refactors the implementation for listing, ignoring, and uploading files. The previous implementation relied on the UploadHelper to process files and globs, and it led to a lot of translation between relative and absolute paths. It also added a lot of layers of indirection and a really tight coupling between the filesystem and the uploader. The new implementation pre-processes all files and ignores first, then delegates uploading on the complete list of files. This means the uploader does not need to behave differently when given a file versus a directory. This makes it easier to stub only the calls to storage.bucket.upload and truly exercise the entire pipeline in unit tests. As part of this refactor, I dropped the pMap dependency. We've been pinned at an old version of this dependency because the new version is incompatible. There's a new function, inParallel that executes Promises in parallel. I'll move it to actions-utils after more battle testing.
b74dd82 to
5f9eb66
Compare
Contributor
Author
|
@verbanicm @bharathkkb I pulled in the latest actions-utils bits so this is smaller. |
bharathkkb
approved these changes
Apr 25, 2022
Contributor
bharathkkb
left a comment
There was a problem hiding this comment.
Sorry for the delay! LGTM with some minor comments
|
@sethvargo Just a heads-up. We noticed that our frontend deployment broke today, making our files being served with an incorrect mime-type. It looks like the issue could be linked to this change. For us, the issue was that at least JS, and CSS files were served with - name: Upload Files
uses: google-github-actions/upload-cloud-storage@v0
with:
path: build-for-deploy
destination: our-frontend-bucket
parent: false
headers: |-
cache-control: private, max-age=0, no-transform |
|
This broke everything. |
Contributor
Author
|
Thanks for letting us know. Let's keep the conversation centralized in #258. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This refactors the implementation for listing, ignoring, and uploading files.
The previous implementation relied on the UploadHelper to process files and globs, and it led to a lot of translation between relative and absolute paths. It also added a lot of layers of indirection and a really tight coupling between the filesystem and the uploader.
The new implementation pre-processes all files and ignores first, then delegates uploading on the complete list of files. This means the uploader does not need to behave differently when given a file versus a directory. This makes it easier to stub only the calls to
storage.bucket.uploadand truly exercise the entire pipeline in unit tests.As part of this refactor, I dropped the
pMapdependency. We've been pinned at an old version of this dependency because the new version is incompatible. There's a new function,inParallelthat executes Promises in parallel. I'll move it to actions-utils after more battle testing.path.relative()d string #248