Skip to content
This repository was archived by the owner on Mar 27, 2024. It is now read-only.

How to use output from GitHub Action with --output? #410

Closed
MPV opened this issue Dec 15, 2023 · 2 comments
Closed

How to use output from GitHub Action with --output? #410

MPV opened this issue Dec 15, 2023 · 2 comments

Comments

@MPV
Copy link
Contributor

MPV commented Dec 15, 2023

Expected behavior

I'd like to be able to run the GitHub Action for container-diff using the --output flag, so I can pass/use the output from the command in other

Actual behavior

Using the action (as in the steps below) triggers:

container-diff diff daemon://my.domain/my/repo:latest daemon://my.domain/my/repo:3401858ca10b2df5cbdb4341b75e4b9051e89722 --type=file  --output="container-diff-file.txt

...which gives:

cat: container-diff-file.txt: No such file or directory
Error: Process completed with exit code 1.

Information

  • container-diff version: v0.17.0 (0695621)
  • Operating system: Linux (via GitHub Actions)

Steps to reproduce the behavior

  1. Run the GitHub Action for container-diff with the --output flag, as per below:

For example:

      - name: Run container-diff analyze
        if: github.event_name == 'pull_request'
        uses: GoogleContainerTools/container-diff/actions@0695621c48497a11a893a8fc0af7965c674123da
        with:
          command: analyze          
          args: daemon://${{ env.IMAGE }}:${{ github.sha }} --output="container-diff-analyze.txt"

      - name: Publish container-diff analyze
        run: |
          echo '## `container-diff analyze`' > "${GITHUB_STEP_SUMMARY}"
          echo '```' >> "${GITHUB_STEP_SUMMARY}"
          cat container-diff-analyze.txt >> "${GITHUB_STEP_SUMMARY}"
          echo '```' >> "${GITHUB_STEP_SUMMARY}"

...or...

      - name: Pull latest for comparison
        if: github.event_name == 'pull_request'
        run: docker pull ${{ env.IMAGE }}:latest

      - name: Run container-diff diff file
        if: github.event_name == 'pull_request'
        uses: GoogleContainerTools/container-diff/actions@0695621c48497a11a893a8fc0af7965c674123da
        with:
          command: diff          
          args: daemon://${{ env.IMAGE }}:latest daemon://${{ env.IMAGE }}:${{ github.sha }} --type=file  --output="container-diff-file.txt"

Other info/context

Back in this PR:

...we added a Dockerfile for running container-diff, which may be a contributing factor to the problem and hiding the complexity/errors of using container-diff like this. It could also just be that I'm not yet understanding what's causing the issue just yet, happy to learn why this kind of issue might occur.

@MPV
Copy link
Contributor Author

MPV commented Dec 15, 2023

I'm trying variants of this, but I haven't yet succeeded.

For example by trying to write to a file in ${GITHUB_WORKSPACE}, I just get:

      - name: Run container-diff analyze
        if: github.event_name == 'pull_request'
        uses: GoogleContainerTools/container-diff/actions@0695621c48497a11a893a8fc0af7965c674123da
        with:
          command: analyze          
          args: daemon://${{ env.IMAGE }}:${{ github.sha }} --output="${GITHUB_WORKSPACE}/container-diff-analyze.txt"
container-diff diff daemon://my.domain/my/repo:latest daemon://my.domain/my/repo:3401858ca10b2df5cbdb4341b75e4b9051e89722 --type=file  --output="${GITHUB_WORKSPACE}/container-diff-analyze.txt"
time="2023-12-15T09:53:30Z" level=error msg="invalid argument"
time="2023-12-[15](https://github.com/my.org/my-repo/actions/runs/7220505570/job/19673561383#step:14:16)T09:53:30Z" level=error msg="invalid argument"

@MPV
Copy link
Contributor Author

MPV commented Dec 15, 2023

Never mind, I got this working now using ./ (--output=./container-diff-analyze.txt), as I saw in the README now:

@MPV MPV closed this as completed Dec 15, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant