Thanks to visit codestin.com
Credit goes to github.com

Skip to content

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

@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

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

    Issue actions