pulumi/.github
Bryce Lampe d83d06faaf
ci: Fix ci-ok check on merge (#13750)
<!--- 
Thanks so much for your contribution! If this is your first time
contributing, please ensure that you have read the
[CONTRIBUTING](https://github.com/pulumi/pulumi/blob/master/CONTRIBUTING.md)
documentation.
-->

# Description

I'm not sure why `success()` and `failure()` don't work as expected
here, but the [needs
context](https://docs.github.com/en/actions/learn-github-actions/contexts#needs-context)
does do what we want.

Previously, if the CI job failed the job `ci-ok` job would still pass:
```
❯ act --detect-event
WARN  ⚠ You are using Apple M-series chip and you have not specified container architecture, you might encounter issues while running act. If so, try running it with '--container-architecture linux/amd64'. ⚠
[Merge/info] 🚀  Start image=ghcr.io/catthehacker/ubuntu:act-latest
[Merge/info]   🐳  docker pull image=ghcr.io/catthehacker/ubuntu:act-latest platform= username= forcePull=true
[Merge/info]   🐳  docker create image=ghcr.io/catthehacker/ubuntu:act-latest platform= entrypoint=["tail" "-f" "/dev/null"] cmd=[]
[Merge/info]   🐳  docker run image=ghcr.io/catthehacker/ubuntu:act-latest platform= entrypoint=["tail" "-f" "/dev/null"] cmd=[]
[Merge/info]  Run Main exit 0
[Merge/info]   🐳  docker exec cmd=[bash --noprofile --norc -e -o pipefail /var/run/act/workflow/0.sh] user= workdir=
[Merge/info]     Success - Main exit 0
[Merge/info] 🏁  Job succeeded
[Merge/CI  ] 🚀  Start image=ghcr.io/catthehacker/ubuntu:act-latest
[Merge/CI  ]   🐳  docker pull image=ghcr.io/catthehacker/ubuntu:act-latest platform= username= forcePull=true
[Merge/CI  ]   🐳  docker create image=ghcr.io/catthehacker/ubuntu:act-latest platform= entrypoint=["tail" "-f" "/dev/null"] cmd=[]
[Merge/CI  ]   🐳  docker run image=ghcr.io/catthehacker/ubuntu:act-latest platform= entrypoint=["tail" "-f" "/dev/null"] cmd=[]
[Merge/CI  ]  Run Main exit 1
[Merge/CI  ]   🐳  docker exec cmd=[bash --noprofile --norc -e -o pipefail /var/run/act/workflow/0.sh] user= workdir=
[Merge/CI  ]     Failure - Main exit 1
[Merge/CI  ] exitcode '1': failure
[Merge/CI  ] 🏁  Job failed
[Merge/ci-ok  ] 🚀  Start image=ghcr.io/catthehacker/ubuntu:act-latest
[Merge/ci-ok  ]   🐳  docker pull image=ghcr.io/catthehacker/ubuntu:act-latest platform= username= forcePull=true
[Merge/ci-ok  ]   🐳  docker create image=ghcr.io/catthehacker/ubuntu:act-latest platform= entrypoint=["tail" "-f" "/dev/null"] cmd=[]
[Merge/ci-ok  ]   🐳  docker run image=ghcr.io/catthehacker/ubuntu:act-latest platform= entrypoint=["tail" "-f" "/dev/null"] cmd=[]
[Merge/ci-ok  ]  Run Main CI succeeded
[Merge/ci-ok  ]   🐳  docker exec cmd=[bash --noprofile --norc -e -o pipefail /var/run/act/workflow/1.sh] user= workdir=
[Merge/ci-ok  ]     Success - Main CI succeeded
[Merge/ci-ok  ] 🏁  Job succeeded
Error: Job 'CI' failed
```

Now if CI fails we also see `ci-ok` fail as expected:
```
❯ act --detect-event
WARN  ⚠ You are using Apple M-series chip and you have not specified container architecture, you might encounter issues while running act. If so, try running it with '--container-architecture linux/amd64'. ⚠
[Merge/info] 🚀  Start image=ghcr.io/catthehacker/ubuntu:act-latest
[Merge/info]   🐳  docker pull image=ghcr.io/catthehacker/ubuntu:act-latest platform= username= forcePull=true
[Merge/info]   🐳  docker create image=ghcr.io/catthehacker/ubuntu:act-latest platform= entrypoint=["tail" "-f" "/dev/null"] cmd=[]
[Merge/info]   🐳  docker run image=ghcr.io/catthehacker/ubuntu:act-latest platform= entrypoint=["tail" "-f" "/dev/null"] cmd=[]
[Merge/info]  Run Main exit 0
[Merge/info]   🐳  docker exec cmd=[bash --noprofile --norc -e -o pipefail /var/run/act/workflow/0.sh] user= workdir=
[Merge/info]     Success - Main exit 0
[Merge/info] 🏁  Job succeeded
[Merge/CI  ] 🚀  Start image=ghcr.io/catthehacker/ubuntu:act-latest
[Merge/CI  ]   🐳  docker pull image=ghcr.io/catthehacker/ubuntu:act-latest platform= username= forcePull=true
[Merge/CI  ]   🐳  docker create image=ghcr.io/catthehacker/ubuntu:act-latest platform= entrypoint=["tail" "-f" "/dev/null"] cmd=[]
[Merge/CI  ]   🐳  docker run image=ghcr.io/catthehacker/ubuntu:act-latest platform= entrypoint=["tail" "-f" "/dev/null"] cmd=[]
[Merge/CI  ]  Run Main exit 1
[Merge/CI  ]   🐳  docker exec cmd=[bash --noprofile --norc -e -o pipefail /var/run/act/workflow/0.sh] user= workdir=
[Merge/CI  ]     Failure - Main exit 1
[Merge/CI  ] exitcode '1': failure
[Merge/CI  ] 🏁  Job failed
[Merge/ci-ok  ] 🚀  Start image=ghcr.io/catthehacker/ubuntu:act-latest
[Merge/ci-ok  ]   🐳  docker pull image=ghcr.io/catthehacker/ubuntu:act-latest platform= username= forcePull=true
[Merge/ci-ok  ]   🐳  docker create image=ghcr.io/catthehacker/ubuntu:act-latest platform= entrypoint=["tail" "-f" "/dev/null"] cmd=[]
[Merge/ci-ok  ]   🐳  docker run image=ghcr.io/catthehacker/ubuntu:act-latest platform= entrypoint=["tail" "-f" "/dev/null"] cmd=[]
[Merge/ci-ok  ]  Run Main Release failed
[Merge/ci-ok  ]   🐳  docker exec cmd=[bash --noprofile --norc -e -o pipefail /var/run/act/workflow/0.sh] user= workdir=
[Merge/ci-ok  ]     Failure - Main Release failed
[Merge/ci-ok  ] exitcode '1': failure
[Merge/ci-ok  ] 🏁  Job failed
Error: Job 'CI' failed
```

If release fails:
```
WARN  ⚠ You are using Apple M-series chip and you have not specified container architecture, you might encounter issues while running act. If so, try running it with '--container-architecture linux/amd64'. ⚠
[Merge/info] 🚀  Start image=ghcr.io/catthehacker/ubuntu:act-latest
[Merge/info]   🐳  docker pull image=ghcr.io/catthehacker/ubuntu:act-latest platform= username= forcePull=true
[Merge/info]   🐳  docker create image=ghcr.io/catthehacker/ubuntu:act-latest platform= entrypoint=["tail" "-f" "/dev/null"] cmd=[]
[Merge/info]   🐳  docker run image=ghcr.io/catthehacker/ubuntu:act-latest platform= entrypoint=["tail" "-f" "/dev/null"] cmd=[]
[Merge/info]  Run Main exit 0
[Merge/info]   🐳  docker exec cmd=[bash --noprofile --norc -e -o pipefail /var/run/act/workflow/0.sh] user= workdir=
[Merge/info]     Success - Main exit 0
[Merge/info] 🏁  Job succeeded
[Merge/CI  ] 🚀  Start image=ghcr.io/catthehacker/ubuntu:act-latest
[Merge/CI  ]   🐳  docker pull image=ghcr.io/catthehacker/ubuntu:act-latest platform= username= forcePull=true
[Merge/CI  ]   🐳  docker create image=ghcr.io/catthehacker/ubuntu:act-latest platform= entrypoint=["tail" "-f" "/dev/null"] cmd=[]
[Merge/CI  ]   🐳  docker run image=ghcr.io/catthehacker/ubuntu:act-latest platform= entrypoint=["tail" "-f" "/dev/null"] cmd=[]
[Merge/CI  ]  Run Main exit 0
[Merge/CI  ]   🐳  docker exec cmd=[bash --noprofile --norc -e -o pipefail /var/run/act/workflow/0.sh] user= workdir=
[Merge/CI  ]     Success - Main exit 0
[Merge/CI  ] 🏁  Job succeeded
[Merge/prepare] 🚀  Start image=ghcr.io/catthehacker/ubuntu:act-latest
[Merge/prepare]   🐳  docker pull image=ghcr.io/catthehacker/ubuntu:act-latest platform= username= forcePull=true
[Merge/prepare]   🐳  docker create image=ghcr.io/catthehacker/ubuntu:act-latest platform= entrypoint=["tail" "-f" "/dev/null"] cmd=[]
[Merge/prepare]   🐳  docker run image=ghcr.io/catthehacker/ubuntu:act-latest platform= entrypoint=["tail" "-f" "/dev/null"] cmd=[]
[Merge/prepare]  Run Main exit 1
[Merge/prepare]   🐳  docker exec cmd=[bash --noprofile --norc -e -o pipefail /var/run/act/workflow/0.sh] user= workdir=
[Merge/prepare]     Failure - Main exit 1
[Merge/prepare] exitcode '1': failure
[Merge/prepare] 🏁  Job failed
[Merge/ci-ok  ] 🚀  Start image=ghcr.io/catthehacker/ubuntu:act-latest
[Merge/ci-ok  ]   🐳  docker pull image=ghcr.io/catthehacker/ubuntu:act-latest platform= username= forcePull=true
[Merge/ci-ok  ]   🐳  docker create image=ghcr.io/catthehacker/ubuntu:act-latest platform= entrypoint=["tail" "-f" "/dev/null"] cmd=[]
[Merge/ci-ok  ]   🐳  docker run image=ghcr.io/catthehacker/ubuntu:act-latest platform= entrypoint=["tail" "-f" "/dev/null"] cmd=[]
[Merge/ci-ok  ]  Run Main Release failed
[Merge/ci-ok  ]   🐳  docker exec cmd=[bash --noprofile --norc -e -o pipefail /var/run/act/workflow/1.sh] user= workdir=
[Merge/ci-ok  ]     Failure - Main Release failed
[Merge/ci-ok  ] exitcode '1': failure
[Merge/ci-ok  ] 🏁  Job failed
Error: Job 'prepare' failed
```

And if everything passes:
```
❯ act --detect-event && echo success
WARN  ⚠ You are using Apple M-series chip and you have not specified container architecture, you might encounter issues while running act. If so, try running it with '--container-architecture linux/amd64'. ⚠
[Merge/info] 🚀  Start image=ghcr.io/catthehacker/ubuntu:act-latest
[Merge/info]   🐳  docker pull image=ghcr.io/catthehacker/ubuntu:act-latest platform= username= forcePull=true
[Merge/info]   🐳  docker create image=ghcr.io/catthehacker/ubuntu:act-latest platform= entrypoint=["tail" "-f" "/dev/null"] cmd=[]
[Merge/info]   🐳  docker run image=ghcr.io/catthehacker/ubuntu:act-latest platform= entrypoint=["tail" "-f" "/dev/null"] cmd=[]
[Merge/info]  Run Main exit 0
[Merge/info]   🐳  docker exec cmd=[bash --noprofile --norc -e -o pipefail /var/run/act/workflow/0.sh] user= workdir=
[Merge/info]     Success - Main exit 0
[Merge/info] 🏁  Job succeeded
[Merge/CI  ] 🚀  Start image=ghcr.io/catthehacker/ubuntu:act-latest
[Merge/CI  ]   🐳  docker pull image=ghcr.io/catthehacker/ubuntu:act-latest platform= username= forcePull=true
[Merge/CI  ]   🐳  docker create image=ghcr.io/catthehacker/ubuntu:act-latest platform= entrypoint=["tail" "-f" "/dev/null"] cmd=[]
[Merge/CI  ]   🐳  docker run image=ghcr.io/catthehacker/ubuntu:act-latest platform= entrypoint=["tail" "-f" "/dev/null"] cmd=[]
[Merge/CI  ]  Run Main exit 0
[Merge/CI  ]   🐳  docker exec cmd=[bash --noprofile --norc -e -o pipefail /var/run/act/workflow/0.sh] user= workdir=
[Merge/CI  ]     Success - Main exit 0
[Merge/CI  ] 🏁  Job succeeded
[Merge/prepare] 🚀  Start image=ghcr.io/catthehacker/ubuntu:act-latest
[Merge/prepare]   🐳  docker pull image=ghcr.io/catthehacker/ubuntu:act-latest platform= username= forcePull=true
[Merge/prepare]   🐳  docker create image=ghcr.io/catthehacker/ubuntu:act-latest platform= entrypoint=["tail" "-f" "/dev/null"] cmd=[]
[Merge/prepare]   🐳  docker run image=ghcr.io/catthehacker/ubuntu:act-latest platform= entrypoint=["tail" "-f" "/dev/null"] cmd=[]
[Merge/prepare]  Run Main exit 0
[Merge/prepare]   🐳  docker exec cmd=[bash --noprofile --norc -e -o pipefail /var/run/act/workflow/0.sh] user= workdir=
[Merge/prepare]     Success - Main exit 0
[Merge/prepare] 🏁  Job succeeded
[Merge/ci-ok  ] 🚀  Start image=ghcr.io/catthehacker/ubuntu:act-latest
[Merge/ci-ok  ]   🐳  docker pull image=ghcr.io/catthehacker/ubuntu:act-latest platform= username= forcePull=true
[Merge/ci-ok  ]   🐳  docker create image=ghcr.io/catthehacker/ubuntu:act-latest platform= entrypoint=["tail" "-f" "/dev/null"] cmd=[]
[Merge/ci-ok  ]   🐳  docker run image=ghcr.io/catthehacker/ubuntu:act-latest platform= entrypoint=["tail" "-f" "/dev/null"] cmd=[]
[Merge/ci-ok  ]  Run Main CI succeeded
[Merge/ci-ok  ]   🐳  docker exec cmd=[bash --noprofile --norc -e -o pipefail /var/run/act/workflow/2.sh] user= workdir=
[Merge/ci-ok  ]     Success - Main CI succeeded
[Merge/ci-ok  ] 🏁  Job succeeded
```

Fixes #13741

## Checklist

- [ ] I have run `make tidy` to update any new dependencies
- [ ] I have run `make lint` to verify my code passes the lint check
  - [ ] I have formatted my code using `gofumpt`

<!--- Please provide details if the checkbox below is to be left
unchecked. -->
- [ ] I have added tests that prove my fix is effective or that my
feature works
<!--- 
User-facing changes require a CHANGELOG entry.
-->
- [ ] I have run `make changelog` and committed the
`changelog/pending/<file>` documenting my change
<!--
If the change(s) in this PR is a modification of an existing call to the
Pulumi Cloud,
then the service should honor older versions of the CLI where this
change would not exist.
You must then bump the API version in
/pkg/backend/httpstate/client/api.go, as well as add
it to the service.
-->
- [ ] Yes, there are changes in this PR that warrants bumping the Pulumi
Cloud API version
<!-- @Pulumi employees: If yes, you must submit corresponding changes in
the service repo. -->
2023-08-21 23:04:33 +00:00
..
scripts Replace deprecated command with environment file 2023-02-20 11:14:39 +09:00
workflows ci: Fix ci-ok check on merge (#13750) 2023-08-21 23:04:33 +00:00
PULL_REQUEST_TEMPLATE.md Add routine checks to pull request template 2023-05-12 13:34:19 -07:00