runner icon indicating copy to clipboard operation
runner copied to clipboard

Annotations from composite actions are not correctly created

Open konradpabjan opened this issue 2 years ago • 4 comments

Describe the bug Only a single annotation gets created in composite actions. Every single annotation (error, warning, notice) with the exception of the last one gets ignored

To Reproduce

Steps to reproduce the behavior:

  1. Create a simple composite actions that generates annotations
name: 'Annotation example'
description: Test annotations
runs:
  using: "composite"
  steps:
    - run: echo Hello there once!
      shell: bash
    - name: Testing the Error Workflow Command
      run: echo "::error::Testing error"
      shell: bash
    - run: echo Hello there
      shell: bash
    - name: Testing the Error Workflow Command
      run: echo "::error::Testing error"
      shell: bash
    - name: Testing the Error Workflow Command
      run: echo "::warning::Testing warning"
      shell: bash
    - name: Testing the Error Workflow Command
      run: echo "::notice::Testing notice"
      shell: bash
  1. Run the workflow from another repository (or locally)

Expected behavior Every single annotation gets created.

Runner Version and Platform

Version of your runner? 2.288.1

Tested using Linux but probably busted for everything

What's not working?

Here is an example run: https://github.com/konradpabjan/Testing2/actions/runs/1958916121

Currently at most only one gets created and it's always the last one

image

Job Log Output

☝️ Only the notice annotations is created while the other annotations do not show up. In the logs though the behavior is expected

image

Runner and Worker's Diagnostic Logs

Not provided since I used hosted for testing, but it should be easy to get with the repro

konradpabjan avatar Mar 09 '22 18:03 konradpabjan

HI @konradpabjan, Thanks for filing this issue! I am reproducing it now and I will get back to you as soon as possible!

ruvceskistefan avatar Mar 10 '22 08:03 ruvceskistefan

Resolved by https://github.com/actions/runner/pull/2116

thboop avatar Sep 09 '22 18:09 thboop

I know it might be strange to ask, but I have found the issue what I do not want to be fixed. This issue is the same but only for the same type of the print:

runs:
  using: "composite"
  steps:
    - shell: bash
      run: echo "::notice::111"
    - shell: bash
      run: echo "::notice::222"
    - shell: bash
      run: echo "::notice::333"

Only the last 333 does show as an annotation.

The reason is that, I have found the case where it can be used for prints patching at the last always executed step.

To do so I use buffering to reprint all annotations at the end of the composite action:

    - name: flush print annotations
      if: always()
      shell: bash
      run: |
        .../flush-print-annotations.sh

If the only last step does the annotation print, then I can go and patch the buffer for links like:

github.com/OWNER/REPO/tree/master/... by github.com/OWNER/REPO/tree/COMMIT_HASH/...

    - name: flush print annotations
      if: always()
      shell: bash
      run: |
        .../patch-print-annotations.sh
        .../flush-print-annotations.sh

Because COMMIT_HASH becomes known not immediately and half of the links to a repo can be printed from a script when script does not know about COMMIT_HASH yet. In other words such behaviour is good for annotations patching or detailing.

andry81 avatar Sep 20 '22 01:09 andry81

@konradpabjan @thboop Are you seeing this as resolved? I am still seeing the issue where only the last annotation gets printed. I am using a self-hosted runner in case that matters.

I can provide steps to reproduce if needed.

weineran avatar Dec 06 '22 18:12 weineran

@andry81 fyi ... A fix is planned for the bug described here.

see https://github.com/actions/runner/pull/2311

jww3 avatar Apr 07 '23 08:04 jww3

@andry81 fyi ... A fix is planned for the bug described here.

see #2311

@jww3 Does that mean the fix will destroy the annotations patch feature?

andry81 avatar Apr 07 '23 15:04 andry81

@andry81 I believe the behavior you're describing was a side-effect of the bug and not an actual feature.

jww3 avatar Jun 26 '23 09:06 jww3

All PRs have been merged. I've verified the original bug as reported is now fixed.

jww3 avatar Jun 26 '23 09:06 jww3