Skip to content
This repository has been archived by the owner on Feb 15, 2024. It is now read-only.

Update the Installable Build job status for Jetpack #90

Merged
merged 3 commits into from
Sep 7, 2021

Conversation

loremattei
Copy link
Contributor

@loremattei loremattei commented Sep 6, 2021

After #89 got merged, I've started noticing that the status of the Installable Build job for the Jetpack application doesn't get updated from pending (orange) to ready (green).

The reason is that this commit removed it from the list of the handled states.
My understanding, from the commit title, is that the goal was to avoid that Peril commented on the PR with the prompt to run the installable build for Jetpack.
I think we still want the state of the job to be green, because, otherwise, the PR remains in a pending state and, while it's still possible to merge the changes because the job is not required, this behaviour can create confusion.
My take is that the bug that #89 fixed was actually hiding this problem.

This PR should fix this problem. There are probably better ways to do this, and the test cases are not complete and strong, but since @jkmassel mentioned that with the migration to Buildkite this function will be integrated in the CI and won't be required anymore in Peril, I opted for a quick, minimal and easy solution.

@loremattei loremattei requested a review from a team September 6, 2021 10:41
Comment on lines 139 to 144
if (status.state == "pending" && HOLD_CONTEXTS.includes(status.context)) {
if (status.state == "pending" && HOLD_CONTEXTS.concat(HOLD_CONTEXTS_NO_COMMENT).includes(status.context)) {
await markStatusAsSuccess(status)
await createOrUpdateComment(status, `You can trigger an installable build for these changes by visiting CircleCI [here](${status.target_url}).`)
} else if (status.state == "success" && INSTALLABLE_BUILD_CONTEXTS.filter(s => status.context.match(s)).length > 0) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If I'm not mistaken, this is the only place where both HOLD_CONTEXTS and HOLD_CONTEXTS_NO_COMMENTS constants are used.

  • If that's intended, and the only place where they are used here they are concatenated, not sure what's the point of having them split in the first place?
  • Instead I think what you intended to do is to NOT call createOrUpdateComment for the case of HOLD_CONTEXTS_NO_COMMENTS?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, I didn't notice my last push failed 🤦! I guess this is what you get when you try to write some code while you have to respond to too many pings 😂

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah! That version was clearly doing nothing :-)

@AliSoftware AliSoftware requested review from jkmassel and a team September 6, 2021 12:25
Copy link
Contributor

@AliSoftware AliSoftware left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Aside from stylistic comment, LGTM, but I'll let @jkmassel approve since he's the one knowing what the original intent was here.

org/pr/installable-build.ts Outdated Show resolved Hide resolved
@loremattei loremattei merged commit 8f5592f into master Sep 7, 2021
@loremattei loremattei deleted the fix/jetpack-installable-builds branch September 7, 2021 15:39
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants