fix: #182 - support symlinks in workspace
This commit is contained in:
parent
6c4e7b9fde
commit
8c290994c1
3 changed files with 10 additions and 2 deletions
|
@ -350,12 +350,18 @@ func (cr *containerReference) copyDir(dstPath string, srcPath string) common.Exe
|
|||
}
|
||||
|
||||
// return on non-regular files (thanks to [kumo](https://medium.com/@komuw/just-like-you-did-fbdd7df829d3) for this suggested update)
|
||||
if !fi.Mode().IsRegular() {
|
||||
linkName := fi.Name()
|
||||
if fi.Mode()&os.ModeSymlink == os.ModeSymlink {
|
||||
linkName, err = os.Readlink(file)
|
||||
if err != nil {
|
||||
return errors.WithMessagef(err, "unable to readlink %s", file)
|
||||
}
|
||||
} else if !fi.Mode().IsRegular() {
|
||||
return nil
|
||||
}
|
||||
|
||||
// create a new dir/file header
|
||||
header, err := tar.FileInfoHeader(fi, fi.Name())
|
||||
header, err := tar.FileInfoHeader(fi, linkName)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
|
1
pkg/runner/testdata/workdir/canary-link
vendored
Symbolic link
1
pkg/runner/testdata/workdir/canary-link
vendored
Symbolic link
|
@ -0,0 +1 @@
|
|||
canary
|
1
pkg/runner/testdata/workdir/push.yml
vendored
1
pkg/runner/testdata/workdir/push.yml
vendored
|
@ -6,6 +6,7 @@ jobs:
|
|||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- run: ls -alFt /github/workspace/workdir
|
||||
- run: '[[ "$(pwd)" == "/github/workspace/workdir" ]]'
|
||||
working-directory: workdir
|
||||
|
||||
|
|
Loading…
Reference in a new issue