#Dagger call completes successfully locally but fails when run as a step via dagger-for-github action

1 messages Β· Page 1 of 1 (latest)

teal crypt
#

Hey team,

I have this function in Dagger:

func (f *FrCliDagger) Test(
    ctx context.Context,
    source *dagger.Directory,
) (string, error) {
    return dag.Container().
        From(fmt.Sprintf("golang:%s", goVersion)).
        WithDirectory(".", source).
        WithWorkdir(".").
        WithExec([]string{"go", "test", "./..."}).
        Stdout(ctx)
}

When I run it in the command like like this it completes successfully:

dagger call test --source .

When it gets executed via Github actions with the following config:

    - name: "Test"
      uses: dagger/dagger-for-github@v6
      with:
        verb: call
        args: test --source .
        cloud-token: ${{ secrets.************* }}

It fails with this error:

[...]
FrCliDagger.test DONE [32.6s]
?       fr-cli    [no test files]
?       fr-cli/commands    [no test files]
ok      fr-cli/tmutilreport    0.003s
A new release of dagger is available: v0.13.7 β†’ v0.14.0
To upgrade, see https://docs.dagger.io/install
https://github.com/dagger/dagger/releases/tag/v0.14.0
Error: Unable to process file command 'output' successfully.
Error: Invalid format '?       fr-cli/commands    [no test files]'

I've tried with dagger/dagger-for-github@v7 (and Dagger v0.14.0) and the same happens.

Any idea on what's wrong? The tests do complete and pass in Github actions, but seems like some of the output is being parsed/executed and it fails.

I've noticed some recent changes in the Dagger Github action code, but I'm not sure if its related. Here: https://github.com/dagger/dagger-for-github/compare/v6.14.0...v7.0.0#diff-1243c5424efaaa19bd8e813c5e6f6da46316e63761421b3e5f5c8ced9a36e6b6

Thanks

GitHub

GitHub Action for Dagger. Contribute to dagger/dagger-for-github development by creating an account on GitHub.

astral palm
#

Hi @teal crypt πŸ‘‹

Could it be that you don't have a checkout step in your GH Actions workflow yaml file?

jobs:
  version:
    runs-on: "ubuntu-latest"
    steps:
      - uses: actions/checkout@v4

If not, your source code may not be on the runner where dagger is running

astral palm
#

Or if that's not it, maybe you could try a version of the action before that change you referenced, like v5 or the commit just before tests were added f5cc786d3e6bb40b853ce2bb737f7d89004a15f8:

- name: "Test"
      uses: dagger/dagger-for-github@f5cc786d3e6bb40b853ce2bb737f7d89004a15f8
      with:
        verb: call
        args: test --source .
        cloud-token: ${{ secrets.************* }}
        version: "0.14.0"
teal crypt
teal crypt
# astral palm Or if that's not it, maybe you could try a version of the action before that cha...

I have tried the commit just before the tests were added, which I think it is ad6a4e308a42fb2cf9be8b060f9aba9d57d4c9aa not f5cc786d3e6bb40b853ce2bb737f7d89004a15f8 as you suggested, as per the list of commits here: https://github.com/dagger/dagger-for-github/commits/v7.0.0.

Commit ad6a4e308a42fb2cf9be8b060f9aba9d57d4c9aa works fine βœ… :

jobs:
  test_and_build:
    name: Test and Build
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v4
    - name: "Test"
      uses: dagger/dagger-for-github@ad6a4e308a42fb2cf9be8b060f9aba9d57d4c9aa
      with:
        verb: call
        args: test --source .
        cloud-token: ${{ secrets.*************** }}
        version: "0.14.0"

Any commit more recent than that (starting with 33170d0344e79de0ebf7dabbe7c565d0b407c730) does not ❌ and fails with the same error I mentioned in my first post.

#

Thanks a lot @astral palm for your reply, greatly appreciated. I have answered them inline above ☝️

#

Wondering if the captured stdout that includes lines starting with ? (like ? fr-cli/commands [no test files]) might invalidate the format expected by GitHub for processing output commands. πŸ€”

dull silo
#

Seems like some users have tripped in the past with the output

#

@astral palm could an option here be to use the GITHUB_OUTPUT conditionally instead of just returning the stdout of the exec step automatically?

#

Seems like action outputs have some limitations which can be easily ran into 😬

astral palm
#

Yep. Should pull in @grizzled forge since he added it

grizzled forge
#

Yup, on my radar salute I'll look into it asap when I'm back in front of a keyboard πŸ™‚

grizzled forge
#

But it should be possible to get the multiline file output properly, I think we should be able to handle this properly.

If anyone has a public repro, that would help, otherwise, I'm sure I can get it working πŸŽ‰

#

In the meantime, you can use the older version of the action and use the version field to select the version that you need manually

brazen cosmos
teal crypt
grizzled forge
#

@astral palm are you good if I cut a v7.0.1? i'm guessing you're a bit busy today πŸ˜„

astral palm
#

Let’s do it!

grizzled forge
#

πŸŽ‰ will go for it then πŸ˜„

#

should be done πŸŽ‰