Skip to content

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

Closed
@mkht

Description

@mkht

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

Activity

added
bugSomething isn't working
on Dec 8, 2021
ferpasri

ferpasri commented on Dec 9, 2021

@ferpasri

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

mkht commented on Dec 9, 2021

@mkht
Author

Yes. .gitkeep is an empty.

t1m0thyj

t1m0thyj commented on Dec 10, 2021

@t1m0thyj

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

astafan8 commented on Dec 10, 2021

@astafan8

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

lilyinstarlight commented on Dec 10, 2021

@lilyinstarlight

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

ForNeVeR commented on Dec 10, 2021

@ForNeVeR

The workaround is to switch to v2.2.4:

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

konradpabjan commented on Dec 10, 2021

@konradpabjan
Contributor

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.

changed the title [-][bug] Upload of artifacts fails if .gitkeep is included[/-] [+][bug] Upload of artifacts fail on Windows if empty files included[/+] on Dec 10, 2021
added a commit that references this issue on Dec 10, 2021

28 remaining items

Loading
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @ForNeVeR@lilyinstarlight@SingingBush@astafan8@konradpabjan

        Issue actions

          [bug] Upload of artifacts fail on Windows if empty files included · Issue #281 · actions/upload-artifact