fix: file labels in GitLab releases, to ensure they're unique.#267
fix: file labels in GitLab releases, to ensure they're unique.#267EvanCarroll wants to merge 1 commit intosemantic-release:masterfrom
Conversation
b33ed93 to
9be4ada
Compare
|
The force pushes are all commit message. I linked it to the issues and fixed some typos. |
|
It may be worth documenting too, but you would use this feature like this Now all things found in |
Previously GitLab lables were just the basename for files uploaded as
part of the release. This is problematic because GitLab doesn't allow
conflicting labels -- a condition that could be caused by uploading a
release with two files by the same name in different directories. This
would generate a 409 Conflict error.
This changes the labels for files uploaded as part of a release to the
name relative to pkgRoot, or the package.
A project may look like this
pkg
pkg \ foo \ baz
pkg \ bar \ baz
This would previously result in two conflicting labels of 'baz'. Now you
would have {"foo/baz", "bar/baz"} with no conflict.
GitHub issues: semantic-release#265, semantic-release#158
bc284ca to
04f20f2
Compare
|
I rebased this can I get some input on it? |
|
This PR has been stale for nearly two years now, so I'm closing it. Feel free to send a new PR if you want this 🙇 |
|
It was stale because you never gave any input on it lol. Despite being asked by others in the same issues #265 (comment) |
|
Ha wow, too ambitious in cleaning up. Sorry! @EvanCarroll I'll review tomorrow or early next week. Can you rebase once more? 🙇 |
| // - other properties of the original asset definition | ||
| const {filepath, ...others} = asset; | ||
| return globbed.map(file => ({...others, path: file, label: basename(file)})); | ||
| return globbed.map(file => ({...others, path: file, label: path.relative(pkgRoot || '.', file)})); |
There was a problem hiding this comment.
Should we consider this a breaking change?
There was a problem hiding this comment.
@fgreinacher I wouldn't unless generating duplicate labels was support somewhere and things depended o nit. Honestly don't know. Seems weird. Imagine creating a listing of files in multiple directories and losing the directory they were in, that was the old behavior. So the labels would collide and the SCM would reject the operation.
| : 'https://gitlab.com'); | ||
|
|
||
| return { | ||
| pkgRoot, |
There was a problem hiding this comment.
I understand you are mirroring the NPM plugin here, but the concept of a package does not really exist for the GitLab plugin.
What about assetBasePath or assetRootPath?
There was a problem hiding this comment.
Also please add some documentation 🙇
| pkgRoot: undefined, | ||
| } | ||
| ); | ||
| }); |
There was a problem hiding this comment.
Can you add some test cases for the new option? Especially weird cases like when the asset is not within the base/root path or when the base/root path is somehow malformed/does not exist.
| module.exports = async ({pkgRoot, cwd}, assets) => { | ||
| return uniqWith( |
There was a problem hiding this comment.
This can stay an arrow function, no?
There was a problem hiding this comment.
@fgreinacher I'm confused. It's still an arrow function
fgreinacher
left a comment
There was a problem hiding this comment.
Thanks @EvanCarroll and sorry that I somewhat missed that this is ready for review.
I left some comments :)
|
@EvanCarroll Do you still want to tackle this? If not someone else could take over. |
|
@EvanCarroll shall somebody else take over for you or do you want to continue here? |
|
I think somebody else needs to take over here. |
|
Please, take it over. I'm not adding tests for this. If you want to add tests to a project that didn't previously have them, that's another issue imho. Besides I have to maintain a forks of all of the bugs I've fixed in the semantic-release projects anyway. |
Previously GitLab lables were just the basename for files uploaded as
part of the release. This is problematic because GitLab doesn't allow
conflicting labels -- a condition that could be caused by uploading a
release with two files by the same name in different directories. This
would generate a 409 Conflict error.
This changes the labels for files uploaded as part of a release to the
name relative to pkgRoot, or the package.
A project may look like this
pkg
pkg \ foo \ baz
pkg \ bar \ baz
This would previously result in two conflicting labels of 'baz'. Now you
would have {"foo/baz", "bar/baz"} with no conflict.
GitHub issues: #265, #158