stealthybox / container-builder-github-ci-status

Google Cloud Function responds to PubSub events on the cloud-builds topic to update GitHub CI status.
MIT License
23 stars 4 forks source link

Not collapsing multiple tests to the latest test #8

Closed max-sixty closed 5 years ago

max-sixty commented 5 years ago

We recently deployed the most recent version of the function to one of our projects

Unfortunately we're now seeing earlier failures remain as a separate failing test, rather than collapsing all tests together, and only showing the latest result

image

This includes branches & PRs that were only created since the redeploy

potential ref https://github.com/stealthybox/container-builder-github-ci-status/issues/6. Though I hadn't seen this problem in earlier version of the function

Anything I could look at to get around this?

Thank you!

stealthybox commented 5 years ago

This looks like expected behavior. (That's the first 8 chars of your build ID) If you don't add tags to your build definition, it falls back to using the ID. Otherwise, if you have multiple pipelines, they will incorrectly stack on each other.

Here's the code snippet that's doing that: https://github.com/stealthybox/container-builder-github-ci-status/blob/aa35321/index.js#L49-L52

Solution is to add tags to your cloudbuild.yaml:

tags:
- api
- frontend
- lint

I'm going to close this, but if you have suggestions on another way to automatically name the builds, let me know! Using the step names would probably be way too long.

Cheers.

max-sixty commented 5 years ago

Could we use the branch name?

stealthybox commented 5 years ago

No, you can run multiple build triggers that perform different operations on a single branch/commit. ( build, test, lint, deploy might all be run from different build triggers )

The status name is used to differentiate that.

max-sixty commented 5 years ago

Just to come back on this - using tags: ['${TAG_NAME}${BRANCH_NAME}'] works exactly as I had hoped.

Thanks for the pointer @stealthybox

stealthybox commented 5 years ago

OH WOW; I didn't know you could interpolate into tags! That's super useful for something I was just looking at.

I'm very glad that works :+1: