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

actions/download-artifact@v4 downloads wrong file #2433

Closed
malciin opened this issue Aug 22, 2024 · 4 comments · Fixed by #2505
Closed

actions/download-artifact@v4 downloads wrong file #2433

malciin opened this issue Aug 22, 2024 · 4 comments · Fixed by #2505
Assignees
Labels
backlog Those issues are on the roadmap kind/bug Something isn't working

Comments

@malciin
Copy link

malciin commented Aug 22, 2024

Bug report info

act version:            0.2.65
GOOS:                   windows
GOARCH:                 amd64
NumCPU:                 24
Docker host:            DOCKER_HOST environment variable is not set
Sockets found:
Config files:
        C:\Users\Marcin\AppData\Local\act\actrc:
                -P ubuntu-latest=node:16-buster-slim
                -P ubuntu-22.04=node:16-bullseye-slim
                -P ubuntu-20.04=node:16-buster-slim
                -P ubuntu-18.04=node:16-buster-slim
Build info:
        Go version:            go1.21.12
        Module path:           github.com/nektos/act
        Main version:          (devel)
        Main path:             github.com/nektos/act
        Main checksum:
        Build settings:
                -buildmode:           exe
                -compiler:            gc
                -ldflags:             -s -w -X main.version=0.2.65 -X main.commit=bda491e406db6c85865498ced18764bc00491a5e -X main.date=2024-08-01T02:22:32Z -X main.builtBy=goreleaser
                CGO_ENABLED:          0
                GOARCH:               amd64
                GOOS:                 windows
                GOAMD64:              v1
                vcs:                  git
                vcs.revision:         bda491e406db6c85865498ced18764bc00491a5e
                vcs.time:             2024-08-01T02:22:10Z
                vcs.modified:         false

Command used with act

act -P windows=-self-hosted -j test --artifact-server-path ./artifacts

Describe issue

I've found that actions/download-artifact@v4 can download invalid file (even tho name input parameter is specified) when running with -self-hosted flag.

If I use workflow like:

      - run: echo "b content" > b/file.txt
      # - uses: actions/upload-artifact@v4
      #   with:
      #     name: a
      #     path: ./a
      #     if-no-files-found: error
      - uses: actions/upload-artifact@v4
        with:
          name: b
          path: ./b
          if-no-files-found: error
      - uses: actions/download-artifact@v4
        with:
          name: b
          path: ./downloaded
      - run: cat downloaded/file.txt

it will correctly print b content, however if we uncomment these lines we'll get a warning:

::warning::Multiple artifacts found, defaulting to first. because of following following response:

{
    "artifacts": [
        {
            "workflowRunBackendId": "1",
            "workflowJobRunBackendId": "1",
            "databaseId": "1",
            "name": "a",
            "createdAt": "2024-08-22T17:37:41.104232900Z"
        },
        {
            "workflowRunBackendId": "1",
            "workflowJobRunBackendId": "1",
            "databaseId": "1",
            "name": "b",
            "createdAt": "2024-08-22T17:37:31.607801900Z"
        }
    ]
}

And cat downloaded/file.txt will print a content because it downloaded a artifact not the b artifact.

Link to GitHub repository

No response

Workflow content

name: Bugged

jobs:
  test:
    runs-on: windows
    steps:
      - run: |
          mkdir -p a
          mkdir -p b
      - run: echo "a content" > a/file.txt
      - run: echo "b content" > b/file.txt
      - uses: actions/upload-artifact@v4
        with:
          name: a
          path: ./a
          if-no-files-found: error
      - uses: actions/upload-artifact@v4
        with:
          name: b
          path: ./b
          if-no-files-found: error
      - uses: actions/download-artifact@v4
        with:
          name: b
          path: ./downloaded
      - run: cat downloaded/file.txt

Relevant log output

[Bugged/test]   💬  ::debug::Body: {%0A  "artifacts": [%0A    {%0A      "workflowRunBackendId": "1",%0A      "workflowJobRunBackendId": "1",%0A      "databaseId": "1",%0A      "name": "a",%0A      "createdAt": "2024-08-22T17:37:41.104232900Z"%0A    },%0A    {%0A      "workflowRunBackendId": "1",%0A      "workflowJobRunBackendId": "1",%0A      "databaseId": "1",%0A      "name": "b",%0A      "createdAt": "2024-08-22T17:37:31.607801900Z"%0A    }%0A  ]%0A}
[Bugged/test]   🚧  ::warning::Multiple artifacts found, defaulting to first.
[Bugged/test]   💬  ::debug::[Request] GetSignedArtifactURL http://192.168.31.59:34567/twirp/github.actions.results.api.v1.ArtifactService/GetSignedArtifactURL
[Bugged/test]   💬  ::debug::[Response] - 200
[Bugged/test]   💬  ::debug::Headers: {%0A  "content-type": "application/json;charset=utf-8",%0A  "date": "Thu, 22 Aug 2024 17:40:41 GMT",%0A  "content-length": "237"%0A}
[Bugged/test]   💬  ::debug::Body: {%0A  "signedUrl": "http://192.168.31.59:34567/twirp/github.actions.results.api.v1.ArtifactService/DownloadArtifact?sig=o_ckWtmUh0AtNWvkayk1-5nBauAc3xsTsRGgS21syzk=&expires=2024-08-22+20%253A40%253A41.2640052+%252B0200+CEST&artifactName=a&taskID=1"%0A}
| Redirecting to blob download url: http://192.168.31.59:34567/twirp/github.actions.results.api.v1.ArtifactService/DownloadArtifact
| Starting download of artifact to: C:\Users\Marcin\.cache\act\12edfb9afc9aa2b3\hostexecutor\downloaded
| (node:18208) [DEP0005] DeprecationWarning: Buffer() is deprecated due to security and usability issues. Please use the Buffer.alloc(), Buffer.allocUnsafe(), or Buffer.from() methods instead.
| (Use `node --trace-deprecation ...` to show where the warning was created)
| Artifact download completed successfully.
| Total of 1 artifact(s) downloaded
| Download artifact has finished successfully
[Bugged/test]   ✅  Success - Main actions/download-artifact@v4
[Bugged/test]   ⚙  ::set-output:: download-path=C:\Users\Marcin\.cache\act\12edfb9afc9aa2b3\hostexecutor\downloaded
[Bugged/test] ⭐ Run Main cat downloaded/file.txt
| a content
[Bugged/test]   ✅  Success - Main cat downloaded/file.txt
[Bugged/test] Cleaning up container for job test
[Bugged/test] 🏁  Job succeeded

Additional information

No response

@malciin malciin added the kind/bug Something isn't working label Aug 22, 2024
@malciin
Copy link
Author

malciin commented Aug 22, 2024

After investigating it a little more using v3 version rather than v4 for both actions/download-artifact & actions/upload-artifact fixes it:

#...
      - uses: actions/upload-artifact@v3
        with:
          name: a
          path: ./a
          if-no-files-found: error
      - uses: actions/upload-artifact@v3
        with:
          name: b
          path: ./b
          if-no-files-found: error
      - uses: actions/download-artifact@v3
        with:
          name: b
          path: ./downloaded
      - run: cat downloaded/file.txt

output:

[Bugged/test] ⭐ Run Main actions/download-artifact@v3
[Bugged/test]   💬  ::debug::Resolved path is C:\Users\Marcin\.cache\act\f64640ce210193ce\hostexecutor\downloaded
| Starting download for b
[Bugged/test]   💬  ::debug::Artifact Url: http://192.168.31.59:34567/_apis/pipelines/workflows/1/artifacts?api-version=6.0-preview
| Directory structure has been setup for the artifact
[Bugged/test]   💬  ::debug::Download file concurrency is set to 2
| Total number of files that will be downloaded: 2
[Bugged/test]   💬  ::debug::C:\Users\Marcin\.cache\act\f64640ce210193ce\hostexecutor\downloaded\b.zip size:(153) blksize:(4096) blocks:(0)
[Bugged/test]   💬  ::debug::C:\Users\Marcin\.cache\act\f64640ce210193ce\hostexecutor\downloaded\file.txt size:(24) blksize:(4096) blocks:(0)
| Artifact b was downloaded to C:\Users\Marcin\.cache\act\f64640ce210193ce\hostexecutor\downloaded
| Artifact download has finished successfully
[Bugged/test]   ✅  Success - Main actions/download-artifact@v3
[Bugged/test]   ⚙  ::set-output:: download-path=C:\Users\Marcin\.cache\act\f64640ce210193ce\hostexecutor\downloaded
[Bugged/test] ⭐ Run Main cat downloaded/file.txt
| b content
[Bugged/test]   ✅  Success - Main cat downloaded/file.txt
[Bugged/test] Cleaning up container for job test
[Bugged/test] 🏁  Job succeeded

@malciin malciin changed the title actions/download-artifact downloads wrong file on -self-hosted actions/download-artifact@v4 downloads wrong file on -self-hosted Aug 22, 2024
@roryabraham
Copy link

roryabraham commented Sep 19, 2024

I'm getting the same 🚧 ::warning::Multiple artifacts found, defaulting to first. on this workflow w/o -self-hosted:

on: push
jobs:
  test:
    runs-on: ubuntu-latest
    steps:
      - name: Create some files
        run: |
          mkdir -p /some/nested/folder
          echo "file1.txt" >> /some/nested/folder/file1.txt
          echo "file2.txt" >> /some/nested/folder/file2.txt
          mkdir -p /some/nested/folder/deeper
          echo "file3.txt" >> /some/nested/folder/deeper/file3.txt

      - name: Upload file1 artifact
        uses: actions/upload-artifact@v4
        with:
          name: file1
          path: /some/nested/folder/file1.txt

      - name: Upload file2 artifact
        uses: actions/upload-artifact@v4
        with:
          name: file2
          path: /some/nested/folder/file2.txt

      - name: Upload file3 artifact
        uses: actions/upload-artifact@v4
        with:
          name: file3
          path: /some/nested/folder/deeper/file3.txt

      - name: Download artifacts
        uses: actions/download-artifact@v4
        with:
          path: /etc/usr/artifacts
          pattern: file*
          merge-multiple: true

      - name: Print directory structure
        run: ls -R /etc/usr/artifacts

Run with: act --container-architecture linux/arm64 --artifact-server-path /tmp/artifacts -W .github/workflows/localTesting.yml

Full output:

act --container-architecture linux/arm64 --artifact-server-path /tmp/artifacts -W  .github/workflows/localTesting.yml
INFO[0000] Using docker host 'unix:///var/run/docker.sock', and daemon socket 'unix:///var/run/docker.sock' 
INFO[0000] Start server on http://192.168.4.170:34567   
[localTesting.yml/test] 🚀  Start image=ghcr.io/catthehacker/ubuntu:act-latest
[localTesting.yml/test]   🐳  docker pull image=ghcr.io/catthehacker/ubuntu:act-latest platform=linux/arm64 username= forcePull=true
[localTesting.yml/test] using DockerAuthConfig authentication for docker pull
[localTesting.yml/test]   🐳  docker create image=ghcr.io/catthehacker/ubuntu:act-latest platform=linux/arm64 entrypoint=["tail" "-f" "/dev/null"] cmd=[] network="host"
[localTesting.yml/test]   🐳  docker run image=ghcr.io/catthehacker/ubuntu:act-latest platform=linux/arm64 entrypoint=["tail" "-f" "/dev/null"] cmd=[] network="host"
[localTesting.yml/test]   🐳  docker exec cmd=[node --no-warnings -e console.log(process.execPath)] user= workdir=
[localTesting.yml/test]   ☁  git clone 'https://github.com/actions/upload-artifact' # ref=v4
[localTesting.yml/test]   ☁  git clone 'https://github.com/actions/upload-artifact' # ref=v4
[localTesting.yml/test]   ☁  git clone 'https://github.com/actions/upload-artifact' # ref=v4
[localTesting.yml/test]   ☁  git clone 'https://github.com/actions/download-artifact' # ref=v4
[localTesting.yml/test] ⭐ Run Main Create some files
[localTesting.yml/test]   🐳  docker exec cmd=[bash --noprofile --norc -e -o pipefail /var/run/act/workflow/0] user= workdir=
[localTesting.yml/test]   ✅  Success - Main Create some files
[localTesting.yml/test] ⭐ Run Main Upload file1 artifact
[localTesting.yml/test]   🐳  docker cp src=/Users/roryabraham/.cache/act/actions-upload-artifact@v4/ dst=/var/run/act/actions/actions-upload-artifact@v4/
[localTesting.yml/test]   🐳  docker exec cmd=[/opt/acttoolcache/node/18.20.4/arm64/bin/node /var/run/act/actions/actions-upload-artifact@v4/dist/upload/index.js] user= workdir=
[localTesting.yml/test]   💬  ::debug::followSymbolicLinks 'true'
[localTesting.yml/test]   💬  ::debug::implicitDescendants 'true'
[localTesting.yml/test]   💬  ::debug::omitBrokenSymbolicLinks 'true'
[localTesting.yml/test]   💬  ::debug::excludeHiddenFiles 'true'
[localTesting.yml/test]   💬  ::debug::followSymbolicLinks 'true'
[localTesting.yml/test]   💬  ::debug::implicitDescendants 'true'
[localTesting.yml/test]   💬  ::debug::matchDirectories 'true'
[localTesting.yml/test]   💬  ::debug::omitBrokenSymbolicLinks 'true'
[localTesting.yml/test]   💬  ::debug::excludeHiddenFiles 'true'
[localTesting.yml/test]   💬  ::debug::Search path '/some/nested/folder/file1.txt'
[localTesting.yml/test]   💬  ::debug::File:/some/nested/folder/file1.txt was found using the provided searchPath
| With the provided path, there will be 1 file uploaded
[localTesting.yml/test]   💬  ::debug::Root artifact directory is /some/nested/folder
| Artifact name is valid!
| Root directory input is valid!
[localTesting.yml/test]   💬  ::debug::Workflow Run Backend ID: 1
[localTesting.yml/test]   💬  ::debug::Workflow Job Run Backend ID: 1
[localTesting.yml/test]   💬  ::debug::[Request] CreateArtifact http://192.168.4.170:34567/twirp/github.actions.results.api.v1.ArtifactService/CreateArtifact
[localTesting.yml/test]   💬  ::debug::[Response] - 200
[localTesting.yml/test]   💬  ::debug::Headers: {%0A  "content-type": "application/json;charset=utf-8",%0A  "date": "Thu, 19 Sep 2024 01:17:47 GMT",%0A  "content-length": "251",%0A  "connection": "close"%0A}
[localTesting.yml/test]   💬  ::debug::Body: {%0A  "ok": true,%0A  "signedUploadUrl": "http://192.168.4.170:34567/twirp/github.actions.results.api.v1.ArtifactService/UploadArtifact?sig=R4btY98C2lF56q9rnRr0YMYk5-jqkwkAVuVtF5Y08G0=&expires=2024-09-18+19%253A17%253A47.096777+-0700+PDT&artifactName=file1&taskID=1"%0A}
[localTesting.yml/test]   💬  ::debug::Creating Artifact archive with compressionLevel: 6
[localTesting.yml/test]   💬  ::debug::Zip write high watermark value 8388608
[localTesting.yml/test]   💬  ::debug::Zip read high watermark value 8388608
[localTesting.yml/test]   💬  ::debug::Uploading artifact zip to blob storage with maxConcurrency: 192, bufferSize: 8388608
| Beginning upload of artifact content to blob storage
[localTesting.yml/test]   💬  ::debug::Zip stream for upload has ended.
[localTesting.yml/test]   💬  ::debug::Zip stream for upload has finished.
| Uploaded bytes 144
| Finished uploading artifact content to blob storage!
| SHA256 hash of uploaded artifact zip is db513bc03bc6f4bb01c2945a028102ec022d408737e6f26e5f16554e4706190d
| Finalizing artifact upload
[localTesting.yml/test]   💬  ::debug::[Request] FinalizeArtifact http://192.168.4.170:34567/twirp/github.actions.results.api.v1.ArtifactService/FinalizeArtifact
[localTesting.yml/test]   💬  ::debug::[Response] - 200
[localTesting.yml/test]   💬  ::debug::Headers: {%0A  "content-type": "application/json;charset=utf-8",%0A  "date": "Thu, 19 Sep 2024 01:17:47 GMT",%0A  "content-length": "28",%0A  "connection": "close"%0A}
[localTesting.yml/test]   💬  ::debug::Body: {%0A  "ok": true,%0A  "artifactId": "1"%0A}
| Artifact file1.zip successfully finalized. Artifact ID 1
| Artifact file1 has been successfully uploaded! Final size is 144 bytes. Artifact ID is 1
| Artifact download URL: https://github.com/Expensify/App/actions/runs/1/artifacts/1
[localTesting.yml/test]   ✅  Success - Main Upload file1 artifact
[localTesting.yml/test]   ⚙  ::set-output:: artifact-id=1
[localTesting.yml/test]   ⚙  ::set-output:: artifact-url=https://github.com/Expensify/App/actions/runs/1/artifacts/1
[localTesting.yml/test] ⭐ Run Main Upload file2 artifact
[localTesting.yml/test]   🐳  docker cp src=/Users/roryabraham/.cache/act/actions-upload-artifact@v4/ dst=/var/run/act/actions/actions-upload-artifact@v4/
[localTesting.yml/test]   🐳  docker exec cmd=[/opt/acttoolcache/node/18.20.4/arm64/bin/node /var/run/act/actions/actions-upload-artifact@v4/dist/upload/index.js] user= workdir=
[localTesting.yml/test]   💬  ::debug::followSymbolicLinks 'true'
[localTesting.yml/test]   💬  ::debug::implicitDescendants 'true'
[localTesting.yml/test]   💬  ::debug::omitBrokenSymbolicLinks 'true'
[localTesting.yml/test]   💬  ::debug::excludeHiddenFiles 'true'
[localTesting.yml/test]   💬  ::debug::followSymbolicLinks 'true'
[localTesting.yml/test]   💬  ::debug::implicitDescendants 'true'
[localTesting.yml/test]   💬  ::debug::matchDirectories 'true'
[localTesting.yml/test]   💬  ::debug::omitBrokenSymbolicLinks 'true'
[localTesting.yml/test]   💬  ::debug::excludeHiddenFiles 'true'
[localTesting.yml/test]   💬  ::debug::Search path '/some/nested/folder/file2.txt'
[localTesting.yml/test]   💬  ::debug::File:/some/nested/folder/file2.txt was found using the provided searchPath
| With the provided path, there will be 1 file uploaded
[localTesting.yml/test]   💬  ::debug::Root artifact directory is /some/nested/folder
| Artifact name is valid!
| Root directory input is valid!
[localTesting.yml/test]   💬  ::debug::Workflow Run Backend ID: 1
[localTesting.yml/test]   💬  ::debug::Workflow Job Run Backend ID: 1
[localTesting.yml/test]   💬  ::debug::[Request] CreateArtifact http://192.168.4.170:34567/twirp/github.actions.results.api.v1.ArtifactService/CreateArtifact
[localTesting.yml/test]   💬  ::debug::[Response] - 200
[localTesting.yml/test]   💬  ::debug::Headers: {%0A  "content-type": "application/json;charset=utf-8",%0A  "date": "Thu, 19 Sep 2024 01:17:47 GMT",%0A  "content-length": "251",%0A  "connection": "close"%0A}
[localTesting.yml/test]   💬  ::debug::Body: {%0A  "ok": true,%0A  "signedUploadUrl": "http://192.168.4.170:34567/twirp/github.actions.results.api.v1.ArtifactService/UploadArtifact?sig=AMHRISsGVfX3t7gUCx9o6tu4vskXi4qpMZZX8ZvCjTw=&expires=2024-09-18+19%253A17%253A47.609526+-0700+PDT&artifactName=file2&taskID=1"%0A}
[localTesting.yml/test]   💬  ::debug::Creating Artifact archive with compressionLevel: 6
[localTesting.yml/test]   💬  ::debug::Zip write high watermark value 8388608
[localTesting.yml/test]   💬  ::debug::Zip read high watermark value 8388608
[localTesting.yml/test]   💬  ::debug::Uploading artifact zip to blob storage with maxConcurrency: 192, bufferSize: 8388608
| Beginning upload of artifact content to blob storage
[localTesting.yml/test]   💬  ::debug::Zip stream for upload has ended.
[localTesting.yml/test]   💬  ::debug::Zip stream for upload has finished.
| Uploaded bytes 144
| Finished uploading artifact content to blob storage!
| SHA256 hash of uploaded artifact zip is 3f94f7e3657456e81c8be997984cd61851af9ee007403971b8b07abed0aaee9b
| Finalizing artifact upload
[localTesting.yml/test]   💬  ::debug::[Request] FinalizeArtifact http://192.168.4.170:34567/twirp/github.actions.results.api.v1.ArtifactService/FinalizeArtifact
[localTesting.yml/test]   💬  ::debug::[Response] - 200
[localTesting.yml/test]   💬  ::debug::Headers: {%0A  "content-type": "application/json;charset=utf-8",%0A  "date": "Thu, 19 Sep 2024 01:17:47 GMT",%0A  "content-length": "28",%0A  "connection": "close"%0A}
[localTesting.yml/test]   💬  ::debug::Body: {%0A  "ok": true,%0A  "artifactId": "1"%0A}
| Artifact file2.zip successfully finalized. Artifact ID 1
| Artifact file2 has been successfully uploaded! Final size is 144 bytes. Artifact ID is 1
| Artifact download URL: https://github.com/Expensify/App/actions/runs/1/artifacts/1
[localTesting.yml/test]   ✅  Success - Main Upload file2 artifact
[localTesting.yml/test]   ⚙  ::set-output:: artifact-id=1
[localTesting.yml/test]   ⚙  ::set-output:: artifact-url=https://github.com/Expensify/App/actions/runs/1/artifacts/1
[localTesting.yml/test] ⭐ Run Main Upload file3 artifact
[localTesting.yml/test]   🐳  docker cp src=/Users/roryabraham/.cache/act/actions-upload-artifact@v4/ dst=/var/run/act/actions/actions-upload-artifact@v4/
[localTesting.yml/test]   🐳  docker exec cmd=[/opt/acttoolcache/node/18.20.4/arm64/bin/node /var/run/act/actions/actions-upload-artifact@v4/dist/upload/index.js] user= workdir=
[localTesting.yml/test]   💬  ::debug::followSymbolicLinks 'true'
[localTesting.yml/test]   💬  ::debug::implicitDescendants 'true'
[localTesting.yml/test]   💬  ::debug::omitBrokenSymbolicLinks 'true'
[localTesting.yml/test]   💬  ::debug::excludeHiddenFiles 'true'
[localTesting.yml/test]   💬  ::debug::followSymbolicLinks 'true'
[localTesting.yml/test]   💬  ::debug::implicitDescendants 'true'
[localTesting.yml/test]   💬  ::debug::matchDirectories 'true'
[localTesting.yml/test]   💬  ::debug::omitBrokenSymbolicLinks 'true'
[localTesting.yml/test]   💬  ::debug::excludeHiddenFiles 'true'
[localTesting.yml/test]   💬  ::debug::Search path '/some/nested/folder/deeper/file3.txt'
[localTesting.yml/test]   💬  ::debug::File:/some/nested/folder/deeper/file3.txt was found using the provided searchPath
| With the provided path, there will be 1 file uploaded
[localTesting.yml/test]   💬  ::debug::Root artifact directory is /some/nested/folder/deeper
| Artifact name is valid!
| Root directory input is valid!
[localTesting.yml/test]   💬  ::debug::Workflow Run Backend ID: 1
[localTesting.yml/test]   💬  ::debug::Workflow Job Run Backend ID: 1
[localTesting.yml/test]   💬  ::debug::[Request] CreateArtifact http://192.168.4.170:34567/twirp/github.actions.results.api.v1.ArtifactService/CreateArtifact
[localTesting.yml/test]   💬  ::debug::[Response] - 200
[localTesting.yml/test]   💬  ::debug::Headers: {%0A  "content-type": "application/json;charset=utf-8",%0A  "date": "Thu, 19 Sep 2024 01:17:48 GMT",%0A  "content-length": "251",%0A  "connection": "close"%0A}
[localTesting.yml/test]   💬  ::debug::Body: {%0A  "ok": true,%0A  "signedUploadUrl": "http://192.168.4.170:34567/twirp/github.actions.results.api.v1.ArtifactService/UploadArtifact?sig=J3IExk9ZIPqwJAIx0e63hKOi4hqA9kNe0u96dpM9A30=&expires=2024-09-18+19%253A17%253A48.118761+-0700+PDT&artifactName=file3&taskID=1"%0A}
[localTesting.yml/test]   💬  ::debug::Creating Artifact archive with compressionLevel: 6
[localTesting.yml/test]   💬  ::debug::Zip write high watermark value 8388608
[localTesting.yml/test]   💬  ::debug::Zip read high watermark value 8388608
[localTesting.yml/test]   💬  ::debug::Uploading artifact zip to blob storage with maxConcurrency: 192, bufferSize: 8388608
| Beginning upload of artifact content to blob storage
[localTesting.yml/test]   💬  ::debug::Zip stream for upload has ended.
[localTesting.yml/test]   💬  ::debug::Zip stream for upload has finished.
| Uploaded bytes 144
| Finished uploading artifact content to blob storage!
| SHA256 hash of uploaded artifact zip is bbd18902d7f7cb502bee8f426be23a03ca7d177290f5a50057409df427fba2f4
| Finalizing artifact upload
[localTesting.yml/test]   💬  ::debug::[Request] FinalizeArtifact http://192.168.4.170:34567/twirp/github.actions.results.api.v1.ArtifactService/FinalizeArtifact
[localTesting.yml/test]   💬  ::debug::[Response] - 200
[localTesting.yml/test]   💬  ::debug::Headers: {%0A  "content-type": "application/json;charset=utf-8",%0A  "date": "Thu, 19 Sep 2024 01:17:48 GMT",%0A  "content-length": "28",%0A  "connection": "close"%0A}
[localTesting.yml/test]   💬  ::debug::Body: {%0A  "ok": true,%0A  "artifactId": "1"%0A}
| Artifact file3.zip successfully finalized. Artifact ID 1
| Artifact file3 has been successfully uploaded! Final size is 144 bytes. Artifact ID is 1
| Artifact download URL: https://github.com/Expensify/App/actions/runs/1/artifacts/1
[localTesting.yml/test]   ✅  Success - Main Upload file3 artifact
[localTesting.yml/test]   ⚙  ::set-output:: artifact-id=1
[localTesting.yml/test]   ⚙  ::set-output:: artifact-url=https://github.com/Expensify/App/actions/runs/1/artifacts/1
[localTesting.yml/test] ⭐ Run Main Download artifacts
[localTesting.yml/test]   🐳  docker cp src=/Users/roryabraham/.cache/act/actions-download-artifact@v4/ dst=/var/run/act/actions/actions-download-artifact@v4/
[localTesting.yml/test]   🐳  docker exec cmd=[/opt/acttoolcache/node/18.20.4/arm64/bin/node /var/run/act/actions/actions-download-artifact@v4/dist/index.js] user= workdir=
[localTesting.yml/test]   💬  ::debug::Resolved path is /etc/usr/artifacts
[localTesting.yml/test]   💬  ::debug::Workflow Run Backend ID: 1
[localTesting.yml/test]   💬  ::debug::Workflow Job Run Backend ID: 1
[localTesting.yml/test]   💬  ::debug::[Request] ListArtifacts http://192.168.4.170:34567/twirp/github.actions.results.api.v1.ArtifactService/ListArtifacts
[localTesting.yml/test]   💬  ::debug::[Response] - 200
[localTesting.yml/test]   💬  ::debug::Headers: {%0A  "content-type": "application/json;charset=utf-8",%0A  "date": "Thu, 19 Sep 2024 01:17:48 GMT",%0A  "content-length": "459",%0A  "connection": "close"%0A}
[localTesting.yml/test]   💬  ::debug::Body: {%0A  "artifacts": [%0A    {%0A      "workflowRunBackendId": "1",%0A      "workflowJobRunBackendId": "1",%0A      "databaseId": "1",%0A      "name": "file1",%0A      "size": "96",%0A      "createdAt": "2024-09-19T00:58:13.830104161Z"%0A    },%0A    {%0A      "workflowRunBackendId": "1",%0A      "workflowJobRunBackendId": "1",%0A      "databaseId": "1",%0A      "name": "file2",%0A      "size": "96",%0A      "createdAt": "2024-09-19T00:58:14.358588875Z"%0A    },%0A    {%0A      "workflowRunBackendId": "1",%0A      "workflowJobRunBackendId": "1",%0A      "databaseId": "1",%0A      "name": "file3",%0A      "size": "96",%0A      "createdAt": "2024-09-19T00:58:14.875335622Z"%0A    }%0A  ]%0A}
| Found 3 artifact(s)
[localTesting.yml/test]   💬  ::debug::Found 3 artifacts in run
| Filtering artifacts by pattern 'file*'
[localTesting.yml/test]   💬  ::debug::Filtered from 3 to 3 artifacts
| Preparing to download the following artifacts:
| - file1 (ID: 1, Size: 96)
| - file2 (ID: 1, Size: 96)
| - file3 (ID: 1, Size: 96)
[localTesting.yml/test]   💬  ::debug::Artifact destination folder does not exist, creating: /etc/usr/artifacts
[localTesting.yml/test]   💬  ::debug::Artifact destination folder does not exist, creating: /etc/usr/artifacts
[localTesting.yml/test]   💬  ::debug::Artifact destination folder does not exist, creating: /etc/usr/artifacts
[localTesting.yml/test]   💬  ::debug::Workflow Run Backend ID: 1
[localTesting.yml/test]   💬  ::debug::Workflow Job Run Backend ID: 1
[localTesting.yml/test]   💬  ::debug::[Request] ListArtifacts http://192.168.4.170:34567/twirp/github.actions.results.api.v1.ArtifactService/ListArtifacts
[localTesting.yml/test]   💬  ::debug::Workflow Run Backend ID: 1
[localTesting.yml/test]   💬  ::debug::Workflow Job Run Backend ID: 1
[localTesting.yml/test]   💬  ::debug::[Request] ListArtifacts http://192.168.4.170:34567/twirp/github.actions.results.api.v1.ArtifactService/ListArtifacts
[localTesting.yml/test]   💬  ::debug::Workflow Run Backend ID: 1
[localTesting.yml/test]   💬  ::debug::Workflow Job Run Backend ID: 1
[localTesting.yml/test]   💬  ::debug::[Request] ListArtifacts http://192.168.4.170:34567/twirp/github.actions.results.api.v1.ArtifactService/ListArtifacts
[localTesting.yml/test]   💬  ::debug::[Response] - 200
[localTesting.yml/test]   💬  ::debug::Headers: {%0A  "content-type": "application/json;charset=utf-8",%0A  "date": "Thu, 19 Sep 2024 01:17:48 GMT",%0A  "content-length": "459",%0A  "connection": "close"%0A}
[localTesting.yml/test]   💬  ::debug::Body: {%0A  "artifacts": [%0A    {%0A      "workflowRunBackendId": "1",%0A      "workflowJobRunBackendId": "1",%0A      "databaseId": "1",%0A      "name": "file1",%0A      "size": "96",%0A      "createdAt": "2024-09-19T00:58:13.830104161Z"%0A    },%0A    {%0A      "workflowRunBackendId": "1",%0A      "workflowJobRunBackendId": "1",%0A      "databaseId": "1",%0A      "name": "file2",%0A      "size": "96",%0A      "createdAt": "2024-09-19T00:58:14.358588875Z"%0A    },%0A    {%0A      "workflowRunBackendId": "1",%0A      "workflowJobRunBackendId": "1",%0A      "databaseId": "1",%0A      "name": "file3",%0A      "size": "96",%0A      "createdAt": "2024-09-19T00:58:14.875335622Z"%0A    }%0A  ]%0A}
[localTesting.yml/test]   🚧  ::warning::Multiple artifacts found, defaulting to first.
[localTesting.yml/test]   💬  ::debug::[Request] GetSignedArtifactURL http://192.168.4.170:34567/twirp/github.actions.results.api.v1.ArtifactService/GetSignedArtifactURL
[localTesting.yml/test]   💬  ::debug::[Response] - 200
[localTesting.yml/test]   💬  ::debug::Headers: {%0A  "content-type": "application/json;charset=utf-8",%0A  "date": "Thu, 19 Sep 2024 01:17:48 GMT",%0A  "content-length": "459",%0A  "connection": "close"%0A}
[localTesting.yml/test]   💬  ::debug::Body: {%0A  "artifacts": [%0A    {%0A      "workflowRunBackendId": "1",%0A      "workflowJobRunBackendId": "1",%0A      "databaseId": "1",%0A      "name": "file1",%0A      "size": "96",%0A      "createdAt": "2024-09-19T00:58:13.830104161Z"%0A    },%0A    {%0A      "workflowRunBackendId": "1",%0A      "workflowJobRunBackendId": "1",%0A      "databaseId": "1",%0A      "name": "file2",%0A      "size": "96",%0A      "createdAt": "2024-09-19T00:58:14.358588875Z"%0A    },%0A    {%0A      "workflowRunBackendId": "1",%0A      "workflowJobRunBackendId": "1",%0A      "databaseId": "1",%0A      "name": "file3",%0A      "size": "96",%0A      "createdAt": "2024-09-19T00:58:14.875335622Z"%0A    }%0A  ]%0A}
[localTesting.yml/test]   🚧  ::warning::Multiple artifacts found, defaulting to first.
[localTesting.yml/test]   💬  ::debug::[Request] GetSignedArtifactURL http://192.168.4.170:34567/twirp/github.actions.results.api.v1.ArtifactService/GetSignedArtifactURL
[localTesting.yml/test]   💬  ::debug::[Response] - 200
[localTesting.yml/test]   💬  ::debug::Headers: {%0A  "content-type": "application/json;charset=utf-8",%0A  "date": "Thu, 19 Sep 2024 01:17:48 GMT",%0A  "content-length": "459",%0A  "connection": "close"%0A}
[localTesting.yml/test]   💬  ::debug::Body: {%0A  "artifacts": [%0A    {%0A      "workflowRunBackendId": "1",%0A      "workflowJobRunBackendId": "1",%0A      "databaseId": "1",%0A      "name": "file1",%0A      "size": "96",%0A      "createdAt": "2024-09-19T00:58:13.830104161Z"%0A    },%0A    {%0A      "workflowRunBackendId": "1",%0A      "workflowJobRunBackendId": "1",%0A      "databaseId": "1",%0A      "name": "file2",%0A      "size": "96",%0A      "createdAt": "2024-09-19T00:58:14.358588875Z"%0A    },%0A    {%0A      "workflowRunBackendId": "1",%0A      "workflowJobRunBackendId": "1",%0A      "databaseId": "1",%0A      "name": "file3",%0A      "size": "96",%0A      "createdAt": "2024-09-19T00:58:14.875335622Z"%0A    }%0A  ]%0A}
[localTesting.yml/test]   🚧  ::warning::Multiple artifacts found, defaulting to first.
[localTesting.yml/test]   💬  ::debug::[Request] GetSignedArtifactURL http://192.168.4.170:34567/twirp/github.actions.results.api.v1.ArtifactService/GetSignedArtifactURL
[localTesting.yml/test]   💬  ::debug::[Response] - 200
[localTesting.yml/test]   💬  ::debug::Headers: {%0A  "content-type": "application/json;charset=utf-8",%0A  "date": "Thu, 19 Sep 2024 01:17:48 GMT",%0A  "content-length": "237",%0A  "connection": "close"%0A}
[localTesting.yml/test]   💬  ::debug::Body: {%0A  "signedUrl": "http://192.168.4.170:34567/twirp/github.actions.results.api.v1.ArtifactService/DownloadArtifact?sig=PcMfjNmQw6fvnIHCb7GSXviUeEObL0ylpUWy1oEJpe8=&expires=2024-09-18+19%253A17%253A48.571129+-0700+PDT&artifactName=file1&taskID=1"%0A}
| Redirecting to blob download url: http://192.168.4.170:34567/twirp/github.actions.results.api.v1.ArtifactService/DownloadArtifact
| Starting download of artifact to: /etc/usr/artifacts
[localTesting.yml/test]   💬  ::debug::[Response] - 200
[localTesting.yml/test]   💬  ::debug::Headers: {%0A  "content-type": "application/json;charset=utf-8",%0A  "date": "Thu, 19 Sep 2024 01:17:48 GMT",%0A  "content-length": "237",%0A  "connection": "close"%0A}
[localTesting.yml/test]   💬  ::debug::Body: {%0A  "signedUrl": "http://192.168.4.170:34567/twirp/github.actions.results.api.v1.ArtifactService/DownloadArtifact?sig=hzN56kXIL86ZxbYvlF_WWjkxM8s2UVwFLyim_NXTLGk=&expires=2024-09-18+19%253A17%253A48.571808+-0700+PDT&artifactName=file1&taskID=1"%0A}
| Redirecting to blob download url: http://192.168.4.170:34567/twirp/github.actions.results.api.v1.ArtifactService/DownloadArtifact
| Starting download of artifact to: /etc/usr/artifacts
[localTesting.yml/test]   💬  ::debug::[Response] - 200
[localTesting.yml/test]   💬  ::debug::Headers: {%0A  "content-type": "application/json;charset=utf-8",%0A  "date": "Thu, 19 Sep 2024 01:17:48 GMT",%0A  "content-length": "237",%0A  "connection": "close"%0A}
[localTesting.yml/test]   💬  ::debug::Body: {%0A  "signedUrl": "http://192.168.4.170:34567/twirp/github.actions.results.api.v1.ArtifactService/DownloadArtifact?sig=UJN_SgAE_8JALq5Pueh1nsRgqd8FxCTuE5TfNA-Rslc=&expires=2024-09-18+19%253A17%253A48.572473+-0700+PDT&artifactName=file1&taskID=1"%0A}
| Redirecting to blob download url: http://192.168.4.170:34567/twirp/github.actions.results.api.v1.ArtifactService/DownloadArtifact
| Starting download of artifact to: /etc/usr/artifacts
| (node:87) [DEP0005] DeprecationWarning: Buffer() is deprecated due to security and usability issues. Please use the Buffer.alloc(), Buffer.allocUnsafe(), or Buffer.from() methods instead.
| (Use `node --trace-deprecation ...` to show where the warning was created)
| Artifact download completed successfully.
| Artifact download completed successfully.
| Artifact download completed successfully.
| Total of 3 artifact(s) downloaded
| Download artifact has finished successfully
[localTesting.yml/test]   ✅  Success - Main Download artifacts
[localTesting.yml/test]   ⚙  ::set-output:: download-path=/etc/usr/artifacts
[localTesting.yml/test] ⭐ Run Main Print directory structure
[localTesting.yml/test]   🐳  docker exec cmd=[bash --noprofile --norc -e -o pipefail /var/run/act/workflow/5] user= workdir=
| /etc/usr/artifacts:
| file1.txt
[localTesting.yml/test]   ✅  Success - Main Print directory structure
[localTesting.yml/test] Cleaning up container for job test
[localTesting.yml/test] 🏁  Job succeeded

As you can see, only file1.txt is downloaded, but I think it's a 🐛 with act. Confirmed it works as expected if I switch actions/download-artifact to v3

@ChristopherHX ChristopherHX self-assigned this Sep 26, 2024
@ChristopherHX ChristopherHX added the backlog Those issues are on the roadmap label Sep 26, 2024
@malciin malciin changed the title actions/download-artifact@v4 downloads wrong file on -self-hosted actions/download-artifact@v4 downloads wrong file Sep 27, 2024
@ChristopherHX
Copy link
Contributor

This is now the most high priority item of my backlog work starts soon.

Problem

All artifacts have the same id and downloading is using the id when merging multiple artifacts

Todo find a way to provide id's from artifact name or change directory structure

Then create a test to enshure this works correctly.

Gitea and runner.server versions of the backend are using database id's those have been stripped away while porting

@ChristopherHX
Copy link
Contributor

Please test #2505, pr checks contain binaries if needed

@mergify mergify bot closed this as completed in #2505 Oct 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backlog Those issues are on the roadmap kind/bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants