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] Only first artifact is found when using upload-artifact@v3 inside a container #441

Open
ababushk opened this issue Sep 18, 2023 · 1 comment
Labels
bug Something isn't working

Comments

@ababushk
Copy link

What happened?

When used inside a container and when a few paths provided, upload-artifact@v3 uploads only files found using the first glob provided.

What did you expect to happen?

All files are found using all the globs provided via multi-line string.

How can we reproduce it?

I've created minimal workflow file to reproduce the issue:

name: Upload artifacts issue demo
on:
  workflow_dispatch:
jobs:
  works-outside-container:
    name: Works outside container
    runs-on: ubuntu-20.04
    env:
      TEST_REPORTS_DIR: ${{ github.workspace }}/path/to/test/reports
    steps:
    - name: Create artifacts
      run: |
        echo "TEST_REPORTS_DIR (YAML expansion): ${{ env.TEST_REPORTS_DIR }}"
        echo "TEST_REPORTS_DIR (shell expansion): ${TEST_REPORTS_DIR}"
        mkdir -p ${TEST_REPORTS_DIR}
        echo "First test report" >> ${TEST_REPORTS_DIR}/first_test_report.txt
        echo "Second test report" >> ${TEST_REPORTS_DIR}/second_test_report.txt
    
    - name: Upload artifacts # two files will be in the archive produced
      uses: actions/upload-artifact@v3
      with:
        name: outside_container
        path: |
          ${{ env.TEST_REPORTS_DIR }}/first_test_report.txt
          ${{ env.TEST_REPORTS_DIR }}/second_test_report.txt
      
        if-no-files-found: 'error'


  doesnt-work-in-container:
    name: Doesn't work in container
    runs-on: ubuntu-20.04
    container:
      image: ubuntu:20.04
    env:
      TEST_REPORTS_DIR: ${{ github.workspace }}/path/to/test/reports
    steps:
    - name: Create artifacts
      run: |
        echo "TEST_REPORTS_DIR (YAML expansion): ${{ env.TEST_REPORTS_DIR }}"
        echo "TEST_REPORTS_DIR (shell expansion): ${TEST_REPORTS_DIR}"
        mkdir -p ${TEST_REPORTS_DIR}
        echo "First test report" >> ${TEST_REPORTS_DIR}/first_test_report.txt
        echo "Second test report" >> ${TEST_REPORTS_DIR}/second_test_report.txt
    
    - name: Upload artifacts # one file will be in the archive produced
      uses: actions/upload-artifact@v3
      with:
        name: inside_container
        path: |
          ${{ env.TEST_REPORTS_DIR }}/first_test_report.txt
          ${{ env.TEST_REPORTS_DIR }}/second_test_report.txt # will be ignored
      
        if-no-files-found: 'error'

In the first job the archive will contain two text files, in the second - only one. You can check the result here https://github.com/ababushk/githubactionstest/actions/runs/6226598794

Anything else we need to know?

It looks like it is connected to actions/runner#2058

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

@liskin
Copy link

liskin commented May 21, 2024

This is much more of an issue now that v3 is deprecated and we're supposed to migrate to upload-artifact@v4, which doesn't automatically merge artifacts and we're meant to supply multiple paths instead.

Also, bloody hell, due to #457 still not being fixed these files are just ignored silently. Brilliant.

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

2 participants