Cannot use continue-on-error in a job that uses a reusabale workflow #77915
Replies: 7 comments 9 replies
-
|
In Handling failures described two configuration options
Did you test release:
needs: [xyz]
if: ${{ needs.xyz.outputs.abc != '[]' }}
strategy:
fail-fast: false
matrix:
path: ${{ fromJSON(needs.xyz.outputs.abc) }} |
Beta Was this translation helpful? Give feedback.
-
|
I’ll try modifying my if statements further.
From: Air ***@***.***>
Date: Friday, February 9, 2024 at 12:48 AM
To: community/community ***@***.***>
Cc: Chris Lohl ***@***.***>, Comment ***@***.***>
Subject: Re: [community/community] Cannot use continue-on-error in a job that uses a reusabale workflow (Discussion #77915)
Hopefully, these workflows reflect in general your configuration
Even, if build (func-b) and build (func-c) failed, these jobs marked as passed because we use job.build.continue-on-error: true inside reusable-build.yml workflow at job level and entire workflow go further and execute deploy where same things is happening.
The latest step in reuable workflows is commented and provided just as an example how we can execute it in case of need - condition if: success() || failure() is required.
Screenshot.2024-02-09.at.09.45.56.png (view on web)<https://github.com/community/community/assets/88528265/25f3c816-c88e-4520-a4c4-de3495de2e4f> example
caller.yml
name: Caller
on:
workflow_dispatch:
jobs:
plan:
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.setup.outputs.matrix }}
steps:
- id: setup
uses: ***@***.***/use-python-dockerfile
with:
matrix: |
app:
- func-a
- func-b
- func-c
build:
needs: [plan]
strategy:
fail-fast: false
matrix: ${{ fromJson(needs.plan.outputs.matrix) }}
uses: ./.github/workflows/reusable-build.yml
with:
app: ${{ matrix.app }}
deploy:
needs: [plan, build]
strategy:
fail-fast: false
matrix: ${{ fromJson(needs.plan.outputs.matrix) }}
uses: ./.github/workflows/reusable-deploy.yml
with:
app: ${{ matrix.app }}
reusable-build.yml
name: Reusable - Build
on:
workflow_call:
inputs:
app:
type: string
jobs:
build:
continue-on-error: true
runs-on: ubuntu-latest
steps:
- name: Show app
run: echo "App is ${{ inputs.func }}"
- name: Exit
run: |
[[ "${{ inputs.app }}" != "func-a" ]] && exit 1 || exit 0
# - name: Status
# if: success() || failure()
# run: echo "Test passed"
reusable-deploy.yml
name: Reusable - Deploy
on:
workflow_call:
inputs:
app:
type: string
jobs:
deploy:
continue-on-error: true
runs-on: ubuntu-latest
steps:
- name: Show app
run: echo "App is ${{ inputs.func }}"
- name: Exit
run: |
[[ "${{ inputs.app }}" != "func-a" ]] && exit 1 || exit 0
# - name: Status
# if: success() || failure()
# run: echo "Test passed"
—
Reply to this email directly, view it on GitHub<#77915 (reply in thread)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/AZMCTGLCMXT44BMFCIDKAYTYSXIFFAVCNFSM6AAAAABAHG3CHCVHI2DSMVQWIX3LMV43SRDJONRXK43TNFXW4Q3PNVWWK3TUHM4DIMJVHA3DE>.
You are receiving this because you commented.Message ID: ***@***.***>
|
Beta Was this translation helpful? Give feedback.
-
|
🕒 Discussion Activity Reminder 🕒 This Discussion has been labeled as dormant by an automated system for having no activity in the last 60 days. Please consider one the following actions: 1️⃣ Close as Out of Date: If the topic is no longer relevant, close the Discussion as 2️⃣ Provide More Information: Share additional details or context — or let the community know if you've found a solution on your own. 3️⃣ Mark a Reply as Answer: If your question has been answered by a reply, mark the most helpful reply as the solution. Note: This dormant notification will only apply to Discussions with the Thank you for helping bring this Discussion to a resolution! 💬 |
Beta Was this translation helpful? Give feedback.
-
|
This really needs an easy fix |
Beta Was this translation helpful? Give feedback.
-
|
Another minimal example of this deficiency we came across is: name: Parent Workflow
on:
workflow_dispatch:
jobs:
call-child:
uses: ./.github/workflows/child.yml
# This is currently unsupported
# continue-on-error: true
on-success:
needs: call-child
if: ${{ needs.call-child.result == 'success' }}
runs-on: ubuntu-latest
steps:
- run: echo "Do something in response to success"
on-failure:
needs: call-child
# `!cancelled()` needed for this to run regardless of earlier failure
if: ${{ !cancelled() && needs.call-child.result == 'failure' }}
runs-on: ubuntu-latest
steps:
- run: echo "Do something in response to failure"The workaround with While it is technically possible to refactor the child job to use inputs & outputs as a side channel for error reporting, that would be significantly more complicated that just being able to set this flag like the docs indicate should be possible. |
Beta Was this translation helpful? Give feedback.
-
|
Another example of why this would be useful, is when the child workflow belongs to a concurrency group, and we want the parent workflow to be marked successful if the child was preempted. For example: name: Build+Deploy
on:
push: <snip>
jobs:
build: <snip>
deploy:
needs: build
# this workflow has `concurrency.group` set to some constant string (we only want one deploy in-flight at a time,
# and we're OK with skipping `deploy` if multiple commits happen in rapid succession)
# If another workflow preempts our `deploy` call,
# we want the overall build+deploy workflow to be marked as successful.
uses: ./.github/workflows/deploy.yml
# currently unsupported option
continue-on-error: true
# fail the workflow if the deploy failed, since we had continue-on-error
check-deploy:
needs: deploy
steps:
- name: Check deploy result
run: |
if test ${{ needs.deploy.result }} = 'failed'; then
echo 'Deploy was unsuccessful'
exit 1
fi(obviously, it would be even better if we had an option like |
Beta Was this translation helpful? Give feedback.
-
|
I have a very simple use case I cannot solve because |
Beta Was this translation helpful? Give feedback.



Uh oh!
There was an error while loading. Please reload this page.
-
Select Topic Area
Question
Body
I have a job in a workflow that uses a matrix and a reusable workflow. The workflow runs fine. But I wanted to configure continue-on-error for the job so that if one of the matrix jobs fails, the rest will continue. But seems I cannot add this property to the job. I get the error "Property continue-on-error is not allowed". Following is my job.
Beta Was this translation helpful? Give feedback.
All reactions