upload-artifact icon indicating copy to clipboard operation
upload-artifact copied to clipboard

Artifact JSON files contaminated with log prints

Open adidevocean8 opened this issue 5 years ago • 2 comments

Describe the bug Artifacts content contain log prints of the GitHub action process

Version

  • V2

Environment

  • Linux

How to reproduce

Create a workflow with the following steps :

      - name: Terraform Plan
        id: plan
        if: github.event_name == 'pull_request'
        run: |
          terraform plan -out=plan.out
          terraform show -json plan.out > plan.json

      - name: Save plan json
        if: github.event_name == 'pull_request'
        uses: actions/upload-artifact@v2
        with:
          name: tf-plan-json
          path: |
            plan.json

Additional context

Example of logs contained in the file

image

image

adidevocean8 avatar Oct 22 '21 16:10 adidevocean8

Hello,

It could be a solution if you use the setup-terraform action from hashicorp as it has an option terraform_wrapper: false which in result will filter out those lines(more accurately it will not generate those)

    - name: Setup Terraform
      uses: hashicorp/setup-terraform@v1
      with:
          terraform_version: 1.0.9
          terraform_wrapper: false

Src: https://stackoverflow.com/questions/66496105/how-can-i-remove-all-the-extraneous-output-from-redirected-output-in-github-acti

TF action: https://github.com/hashicorp/setup-terraform

kolopka avatar Nov 21 '21 15:11 kolopka

Worked!

adidevocean8 avatar Jan 16 '22 10:01 adidevocean8