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

[bug] Upload of artifacts fail on Windows if empty files included #281

Closed
mkht opened this issue Dec 8, 2021 · 9 comments
Closed

[bug] Upload of artifacts fail on Windows if empty files included #281

mkht opened this issue Dec 8, 2021 · 9 comments
Labels
bug Something isn't working

Comments

@mkht
Copy link

mkht commented Dec 8, 2021

What happened?

When .gitkeep is included in the list of files to be uploaded, actions/upload-artifact will fail with error.
This may only happen on windows-latest runners. ubuntu-latest seems to be fine.
This has been occurring since today (2021/12/08).
Yesterday (2021/12/07) was fine.

Error: Unexpected response. Unable to upload chunk to https://pipelines.actions.githubusercontent.com/R72NorkoW9ZqUdNNnkQJ7wZXzUBqqBP6BKGnI5jkEJDBXVD3cp/_apis/resources/Containers/17385241?itemPath=artifact1%5C.gitkeep
##### Begin Diagnostic HTTP information #####
Status Code: 400
Status Message: Bad Request
Header Information: {
  "cache-control": "no-store,no-cache",
  "pragma": "no-cache",
  "transfer-encoding": "chunked",
  "content-type": "application/json; charset=utf-8",
  "strict-transport-security": "max-age=2592000",
  "x-tfs-processid": "5868939c-6677-454c-8ba5-a6a3f6dd88ad",
  "activityid": "5b5c5588-a9ef-412d-891c-e6f9e9a34a57",
  "x-tfs-session": "5b5c5588-a9ef-412d-891c-e6f9e9a34a57",
  "x-vss-e2eid": "5b5c5588-a9ef-412d-891c-e6f9e9a34a57",
  "x-vss-senderdeploymentid": "13a19993-c6bc-326c-afb4-32c5519f46f0",
  "x-frame-options": "SAMEORIGIN",
  "x-cache": "CONFIG_NOCACHE",
  "x-msedge-ref": "Ref A: EBFE4D5B86A44CE792391F4FD8D6E1E7 Ref B: BN3EDGE0913 Ref C: 2021-12-08T10:20:16Z",
  "date": "Wed, 08 Dec 2021 10:20:15 GMT"
}
###### End Diagnostic HTTP information ######
Warning: Aborting upload for D:\a\testartifact\testartifact\Folder1\.gitkeep due to failure
##[debug]deleting temporary gzip file C:\Users\RUNNER~1\AppData\Local\Temp\tmp-5132-tBLrtZS66WVd
##[debug]File: 1/2. D:\a\testartifact\testartifact\Folder1\.gitkeep took 45.090 milliseconds to finish upload
Error: aborting artifact upload

What did you expect to happen?

The artifact upload should be successful.

How can we reproduce it?

I have created a simple repository to reproduce this issue, please see the workflow log.
Uploading Folder1 which contains .gitkeep fails and uploading Folder2 which does not contain it succeeds.
https://github.com/mkht/testartifact/runs/4455738308

workflow yaml

name: test

on:
  workflow_dispatch:
    branches:
      - main

jobs:
  Build:
    runs-on: windows-latest
    timeout-minutes: 10
    defaults:
      run:
        shell: pwsh

    steps:
      - uses: actions/checkout@v2

      - name: create test dir & file (with .gitkeep)
        run: |
          New-Item -Path ./Folder1 -ItemType Directory -Force
          New-Item -Path ./Folder1/.gitkeep -ItemType File -Force
          'test1' | Out-File -FilePath ./Folder1/test1.txt -Force

      - name: create test dir & file (without .gitkeep)
        run: |
          New-Item -Path ./Folder2 -ItemType Directory -Force
          'test2' | Out-File -FilePath ./Folder2/test2.txt -Force

      - name: upload with .gitkeep
        uses: actions/upload-artifact@v2
        if: always()
        with:
          name: artifact1
          path: Folder1

      - name: upload without .gitkeep
        uses: actions/upload-artifact@v2
        if: always()
        with:
          name: artifact2
          path: Folder2

Anything else we need to know?

No response

What version of the action are you using?

v2

What are your runner environments?

window

Are you on GitHub Enterprise Server? If so, what version?

No response

@mkht mkht added the bug Something isn't working label Dec 8, 2021
@ferpasri
Copy link

ferpasri commented Dec 9, 2021

Is .gitkeep an empty file? 0kb

I have same error with a specific test of my tool that creates an empty log file 0kb

@mkht
Copy link
Author

mkht commented Dec 9, 2021

Yes. .gitkeep is an empty.

@t1m0thyj
Copy link

Seeing this same issue when uploading a folder that includes an empty file. Only started failing on Windows builds this week, and still uploads fine on the Ubuntu and macOS GHA runners.

@astafan8
Copy link

seeing similar issue with .nojakyll file on our repo, https://github.com/QCoDeS/Qcodes/runs/4485121681?check_suite_focus=true. only on Windows build, only recently.

@lilyinstarlight
Copy link

lilyinstarlight commented Dec 10, 2021

We are experiencing the same issue with uploads involving empty files on Windows. It looks like actions/toolkit#748 (which was included in the recent 0.6.0 release of @actions/artifact and 2.3.0 of this action) includes edge case handling for Windows + empty files, since apparently named pipes can't be detected via a stat in msys2. It could possibly be related, but I don't see an immediately obvious reason that change would cause an issue (pinging @zregvart and @konradpabjan just in case though)

@ForNeVeR
Copy link

The workaround is to switch to v2.2.4:

- uses: actions/upload-artifact@v2
+ uses: actions/upload-artifact@v2.2.4

@konradpabjan
Copy link
Collaborator

Yup, this bug unfortunately is related the changes in actions/toolkit and named pipes. We'll work on a fix. For the time being though you can pin to an older version of the action as a workaround.

@konradpabjan konradpabjan changed the title [bug] Upload of artifacts fails if .gitkeep is included [bug] Upload of artifacts fail on Windows if empty files included Dec 10, 2021
zregvart added a commit to zregvart/toolkit that referenced this issue Dec 10, 2021
Seems that folk are having issues with uploading 0-byte files from
Windows agents. This effectively removes the support for Windows for
uploading from named files that, due to `isFIFO` returning `false` on
Windows for named pipes created using MSYS2's `mkfifo` command, resorted
to checking if the file size is 0 - a common trait of named pipes.

See actions/upload-artifact#281
zregvart added a commit to zregvart/toolkit that referenced this issue Dec 10, 2021
Seems that folk are having issues with uploading 0-byte files from
Windows agents. This effectively removes the support for Windows for
uploading from named files that, due to `isFIFO` returning `false` on
Windows for named pipes created using MSYS2's `mkfifo` command, resorted
to checking if the file size is 0 - a common trait of named pipes.

See actions/upload-artifact#281
zacharee added a commit to zacharee/SamloaderKotlin that referenced this issue Dec 10, 2021
Unnvaldr added a commit to altmp/altv-docs that referenced this issue Dec 11, 2021
ForNeVeR added a commit to ForNeVeR/AvaloniaRider that referenced this issue Dec 12, 2021
ForNeVeR added a commit to ForNeVeR/AvaloniaRider that referenced this issue Dec 12, 2021
wizjany added a commit to EngineHub/WorldEdit that referenced this issue Dec 13, 2021
bakaoh added a commit to bakaoh/windeploynunchuk that referenced this issue Dec 14, 2021
zregvart added a commit to zregvart/toolkit that referenced this issue Dec 14, 2021
Seems that folk are having issues with uploading 0-byte files from
Windows agents. This effectively removes the support for Windows for
uploading from named files that, due to `isFIFO` returning `false` on
Windows for named pipes created using MSYS2's `mkfifo` command, resorted
to checking if the file size is 0 - a common trait of named pipes.

See actions/upload-artifact#281
zregvart added a commit to zregvart/toolkit that referenced this issue Dec 14, 2021
Seems that folk are having issues with uploading 0-byte files from
Windows agents. This effectively removes the support for Windows for
uploading from named files that, due to `isFIFO` returning `false` on
Windows for named pipes created using MSYS2's `mkfifo` command, resorted
to checking if the file size is 0 - a common trait of named pipes.

See actions/upload-artifact#281
konradpabjan pushed a commit to actions/toolkit that referenced this issue Dec 14, 2021
Seems that folk are having issues with uploading 0-byte files from
Windows agents. This effectively removes the support for Windows for
uploading from named files that, due to `isFIFO` returning `false` on
Windows for named pipes created using MSYS2's `mkfifo` command, resorted
to checking if the file size is 0 - a common trait of named pipes.

See actions/upload-artifact#281
@konradpabjan
Copy link
Collaborator

With the latest release (the v2 tag has been updated), this issue has been fixed

@SingingBush
Copy link

This is not fixed. I am using @v2 for upload and download and still getting these 400 errors on about 2/3 builds (ubuntu).

With the provided path, there will be 2 files uploaded
Starting artifact upload
For more detailed logs during the artifact upload process, enable step-debugging: https://docs.github.com/actions/monitoring-and-troubleshooting-workflows/enabling-debug-logging#enabling-step-debug-logging
Artifact name is valid!
Container for artifact "jarfile" successfully created. Starting upload of file(s)
Uploaded /home/runner/work/my-project/my-project/target/my-project.jar (15.6%) bytes 0:8388607
Uploaded /home/runner/work/my-project/my-project/target/my-project.jar (31.3%) bytes 8388608:16777215
Uploaded /home/runner/work/my-project/my-project/target/my-project.jar (47.0%) bytes 16777216:25165823
Uploaded /home/runner/work/my-project/my-project/target/my-project.jar (62.7%) bytes 25165824:33554431
Uploaded /home/runner/work/my-project/my-project/target/my-project.jar (78.4%) bytes 33554432:41943039
Uploaded /home/runner/work/my-project/my-project/target/my-project.jar (94.1%) bytes 41943040:50331647
Error: Unexpected response. Unable to upload chunk to https://pipelines.actions.githubusercontent.com/*********************************************/_apis/resources/Containers/21858787?itemPath=jarfile%2Fmy-project.jar
##### Begin Diagnostic HTTP information #####
Status Code: 400
Status Message: Bad Request
Header Information: {
  "cache-control": "no-store,no-cache",
  "pragma": "no-cache",
  "transfer-encoding": "chunked",
  "content-type": "application/json; charset=utf-8",
  "strict-transport-security": "max-age=2592000",
  "x-tfs-processid": "d8af23ce-588c-46a9-9000-4d0cfdbc911b",
  "activityid": "e7e648cb-0b34-4d32-b7ff-8de1cdb757a2",
  "x-tfs-session": "e7e648cb-0b34-4d32-b7ff-8de1cdb757a2",
  "x-vss-e2eid": "e7e648cb-0b34-4d32-b7ff-8de1cdb757a2",
  "x-vss-senderdeploymentid": "13a19993-c6bc-326c-afb4-32c5519f46f0",
  "x-frame-options": "SAMEORIGIN",
  "x-cache": "CONFIG_NOCACHE",
  "x-msedge-ref": "Ref A: 2F9A7A2AEBD94F43AF3CBD3E6A1A3FBE Ref B: SN4AA2022305021 Ref C: 2022-02-01T10:47:51Z",
  "date": "Tue, 01 Feb 2022 10:47:50 GMT"
}
###### End Diagnostic HTTP information ######
Warning: Aborting upload for /home/runner/work/my-project/my-project/target/my-project.jar due to failure
Error: aborting artifact upload
Total size of all the files uploaded is 50344975 bytes

worldlight425 added a commit to worldlight425/toolkit that referenced this issue Feb 22, 2023
Seems that folk are having issues with uploading 0-byte files from
Windows agents. This effectively removes the support for Windows for
uploading from named files that, due to `isFIFO` returning `false` on
Windows for named pipes created using MSYS2's `mkfifo` command, resorted
to checking if the file size is 0 - a common trait of named pipes.

See actions/upload-artifact#281
at-wat pushed a commit to at-wat/actions-toolkit that referenced this issue Aug 31, 2023
Seems that folk are having issues with uploading 0-byte files from
Windows agents. This effectively removes the support for Windows for
uploading from named files that, due to `isFIFO` returning `false` on
Windows for named pipes created using MSYS2's `mkfifo` command, resorted
to checking if the file size is 0 - a common trait of named pipes.

See actions/upload-artifact#281
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

8 participants