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

Implement follow-symlinks boolean action input #201

Draft
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

p--b
Copy link

@p--b p--b commented May 10, 2021

This commit implements a new boolean input to the action,
follow-symlinks. This option configures whether the glob expansion
will follow any symlinks it finds when determining the set of of files
to be archived into the artifact.

The default value of the option, which preserves the existing behaviour,
is true. When set to true, symbolic links will be be followed and expanded.
If false, symbolic links will be included in the archived artifact verbatim.

Users may wish to set this option to false if their artifact contains
internally-referencing symlinks which would result in significant bloat
(and semantic change!) in the source files when the artifact is created.

Resolves: #93.

p--b added 2 commits May 10, 2021 12:01
This commit implements a new boolean input to the action,
`follow-symlinks`. This option configures whether the glob expansion
will follow any symlinks it finds when determining the set of of files
to be archived into the artifact.

The default value of the option, which preserves the existing behaviour,
is `true`. When set to true, symbolic links will be be followed and expanded
If `false`, symbolic links will be included in the archived artifact verbatim.

Users may wish to set this option to false if their artifact contains
internally-referencing symlinks which would result in significant bloat
(and semantic change!) in the source files when the artifact is created.

Resolves: actions#93.
@p--b p--b requested a review from a team as a code owner May 10, 2021 11:09
@p--b p--b marked this pull request as draft May 10, 2021 12:10
@p--b
Copy link
Author

p--b commented May 10, 2021

Having just tried this out in a (long and slow) pipeline that generates lots of symlinks, upstream at https://github.com/actions/toolkit/ throws an error if passed a symlink to ArtifactClient.uploadArtifact(...);

Error: EISDIR: illegal operation on a directory, read
Emitted 'error' event on ReadStream instance at:
    at internal/fs/streams.js:167:12
    at FSReqCallback.wrapper [as oncomplete] (fs.js:470:5) {
  errno: -21,
  code: 'EISDIR',
  syscall: 'read'
}

In turn I believe this is because of this:

https://github.com/actions/toolkit/blob/cac7db2d19f7a7e48fe1ec608fc99bc1786a858e/packages/artifact/src/internal/upload-gzip.ts#L43

It would need to be passed fs.constants.O_RDONLY | fs.constants.O_SYMLINK to its flags options property in order to not traverse the symlink. If I get round to it I'll file an issue over there, after which this PR might become useful. Sorry for the noise.

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.

support symlinks
1 participant