actions / upload-artifact

MIT License
3.16k stars 710 forks source link

[bug] intermittent "Create Artifact Container failed" artifact name is not valid #490

Closed codymaust closed 8 months ago

codymaust commented 9 months ago

What happened?

when invoking the actions/upload-artifact@v3 action with a valid artifact name, we intermittently are seeing the following error:

example 1:

Create Artifact Container failed: The artifact name tfplan-root_dev-pr508-run59-attempt1.plan is not valid

after rerunning the job, the artifact was successfully uploaded

example 2:

Create Artifact Container failed: The artifact name tfplan-root_prod-pr508-run59-attempt2.plan is not valid

after rerunning the job, the artifact was successfully uploaded

With the provided path, there will be 1 file 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!
Create Artifact Container - Error is not retryable
##### Begin Diagnostic HTTP information #####
Status Code: 400
Status Message: Bad Request
Header Information: {
  "content-length": "209",
  "connection": "close",
  "content-type": "application/json; charset=utf-8",
  "date": "Fri, 22 Dec 2023 17:42:25 GMT",
  "server": "Kestrel",
  "cache-control": "no-store,no-cache",
  "pragma": "no-cache",
  "strict-transport-security": "max-age=2592000",
  "x-tfs-processid": "f39bf4d1-96e0-4d1c-863a-6cbbae4d75a0",
  "activityid": "15b0cd28-378e-43f8-a1c5-023e9bd42379",
  "x-tfs-session": "15b0cd28-378e-43f8-a1c5-023e9bd42379",
  "x-vss-e2eid": "15b0cd28-378e-43f8-a1c5-023e9bd42379",
  "x-vss-senderdeploymentid": "6074703f-c195-632a-bd61-21691fc86fa5",
  "x-frame-options": "SAMEORIGIN"
}
###### End Diagnostic HTTP information ######
##### Begin Diagnostic HTTP information #####
Status Code: 400
Status Message: Bad Request
Header Information: {
  "content-length": "209",
  "connection": "close",
  "content-type": "application/json; charset=utf-8",
  "date": "Fri, 22 Dec 2023 17:42:25 GMT",
  "server": "Kestrel",
  "cache-control": "no-store,no-cache",
  "pragma": "no-cache",
  "strict-transport-security": "max-age=2592000",
  "x-tfs-processid": "f39bf4d1-96e0-4d1c-863a-6cbbae4d75a0",
  "activityid": "15b0cd28-378e-43f8-a1c5-023e9bd42379",
  "x-tfs-session": "15b0cd28-378e-43f8-a1c5-023e9bd42379",
  "x-vss-e2eid": "15b0cd28-378e-43f8-a1c5-023e9bd42379",
  "x-vss-senderdeploymentid": "6074703f-c195-632a-bd61-21691fc86fa5",
  "x-frame-options": "SAMEORIGIN"
}
###### End Diagnostic HTTP information ######
Error: Create Artifact Container failed: The artifact name tfplan-root_prod-pr508-run59-attempt2.plan is not valid. Request URL https://pipelinesghubeus4.actions.githubusercontent.com/2hnEdjJ1BUqfQ5oHiQHkvBEz2dTGrIdEZNesehtHrR1pZa80NH/_apis/pipelines/workflows/7301969287/artifacts?api-version=6.0-preview

What did you expect to happen?

the artifact is uploaded successfully all the time

How can we reproduce it?

name: minimal issue reproducing

on:
  workflow_call:
    inputs:
      ENVIRONMENT:
        description: "The target GitHub Environment name"
        required: true
        type: string

jobs:
  plan:
    name: reproduce the error
    environment: ${{ inputs.ENVIRONMENT }}
    runs-on: ubuntu-20.04
    timeout-minutes: 60
    steps:
      - name: plan
        id: plan
        continue-on-error: true
        run: |
          planFileArtifact="tfplan-${{inputs.ENVIRONMENT}}-pr${{github.event.pull_request.number}}-run${{github.run_number}}-attempt${{github.run_attempt}}.plan"
          echo "PLAN_FILE_ARTIFACT=${planFileArtifact}" >> "$GITHUB_OUTPUT"

      - name: Upload plan artifact
        if: ${{ steps.plan.outputs.PLAN_FILE_PATH != '' }}
        uses: actions/upload-artifact@v3
        with:
          name: ${{ steps.plan.outputs.PLAN_FILE_ARTIFACT }}
          path: ${{ steps.plan.outputs.PLAN_FILE_PATH }}
          retention-days: 5

Anything else we need to know?

  1. if i re-run the worfklow job, it succeeds the next time
    • a rerun in my case will increment the artifact name (i.e. artifact-attempt-1, artifact-attempt-2, and so on)
  2. our workflow was working fine for a month or so, and then in the past week this error has cropped up
    • we have not changed our workflow file

What version of the action are you using?

v3

What are your runner environments?

linux

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

No response

konradpabjan commented 8 months ago

@codymaust V4 just shipped. I recommend moving over to the newest version as it is a complete rewrite with a host of improvements and the artifact creation logic is different so this error won't happen.

Moving to v4 is the solution her as v1-v3 aren't going to get much attention. There were a host of bugs & issues with the older versions that no longer apply with v4.

Is there any reason why you would have to still use @v3?

codymaust commented 8 months ago

hi @konradpabjan ! thanks for the reply

we've upgraded to v4

marking this as closed, but will reopen if it resurfaces