-
Notifications
You must be signed in to change notification settings - Fork 101
Diff status code 1 should failed the check #2
Comments
Certainly, the If you want to use the status code in subsequent actions, use |
Thanks for the quick response.
Yes I would like to catch the status code in case of diff and failed to PR
action along with PR message.
I'm pretty new to Github actions, how can I used the outputs.status_code to
do that?
…On Sun, Dec 8, 2019, 17:59 youyo ***@***.***> wrote:
Certainly, the cdk diff command returns status code 1 if there is a
difference. However, the cdk command has been executed successfully. I
judge it as a success.
If you want to use the status code in subsequent actions, use
outputs.status_code.
outputs.status_code is available from v1.1.4 released a while ago.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#2?email_source=notifications&email_token=AAHVI63WXAOMQFONVFCR7U3QXUKV5A5CNFSM4JXZ7H22YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEGHCF3Q#issuecomment-562963182>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAHVI65EBALOLDBGHWTYWKDQXUKV5ANCNFSM4JXZ7H2Q>
.
|
Example here. If you want to execute an action when the status_code is 1, you can do this by writing |
Thanks @youyo. it works! I do spot other issues with this action return status code that are unexpected from the user perspective. for example:
or this:
both finish with success and mark the job as green |
Was able to resolve this issue by doing "npm install" for cdk directory. Please note the use of "working-directory" for cdk installation base path. And make sure you put this directive before cdk commands:
|
I also get a green success status when running diff, even when the exit code is a 1, and cdk deploy hasn't even run. I had some bugs in my python and exceptions were thrown, yet the jobs show as success. |
I am now seeing that the "cdk diff" command is returning an exit code of 0 when there is a diff and when there isn't a diff. Example output from latest aws cdk when there is a stack diff (echoing out cdk command exit code at bottom):
Example output from latest aws cdk when there isn't a stack diff (echoing out cdk command exit code at bottom):
I am trying to make my CD process fail if any of the cdk commands fail, and I do have the small change to fail the action on a cdk subcommand exit code 1 all ready to go (though I do still need to fork and open a PR). Commit where behavior changed: |
@dumastaylorPFG, I might have a problem with this resolution, my cdk diff command shows all of the differences and then finishes with this:
even when cdk diff is successful, I know that it's successful because when I run it locally it finishes with the same last difference, because of this, the action is failing when I have differences and it doesn't proceed to comment on the PR. For now I think I'll just use the previous action version |
If you need to bypass this feature, you can change the CDK's behavior with the feature flag:
in cdk.json (or ~/.cdk.json) as shown here
Alternatively, you can add
in the job step:
|
|
if there is a diff in the stack I expect the action act as the command line.
changes in the stack should fail the action
The text was updated successfully, but these errors were encountered: