Skip to content

Conversation

@CaseyHillers
Copy link
Contributor

This adds a check to all Cocoon scheduled presubmits that validates the ci.yaml + validates all builds were scheduled.

If .ci.yaml does not exist, it will pass as it uses an empty SchedulerConfig.

Issues

flutter/flutter#82303

request.headers.set('X-GitHub-Event', 'pull_request');
});

test('Exception is raised when no builders available', () async {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is no longer true as there's always at least one check we generate on presubmit

commitSha: commitSha,
);
} catch (e) {
exception = e;
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we log this exception?

Copy link
Contributor

Choose a reason for hiding this comment

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

we should also only catch a more specific type of Exception, rather than everything.

Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I added a log.

We could catch FormatException and HttpException for ci.yaml related issues, but I figured if there's an issue in scheduling the LUCI builds (anywhere), we should mark it as failed. That way people will retry the presubmit instead of having a forever pending checkrun. WDYT?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Moved to catch on FormatException. If another exception fails, this will leave the ci.yaml validation as pending.

Copy link
Contributor

Choose a reason for hiding this comment

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

Will the exception bubbling up lead to a stronger signal that monitoring will detect? If not, then I suppose there's no advantage to disambiguating FormatExceptions.

);
} else {
// Failure when validating ci.yaml
await githubChecksService.githubChecksUtil.updateCheckRun(
Copy link
Contributor

Choose a reason for hiding this comment

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

we can move this part to the catch section and remove the if - then - else

Copy link
Contributor Author

Choose a reason for hiding this comment

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

catch blocks cannot be async which is why this is separated

// Update validate ci.yaml check
if (exception == null) {
// Success in validating ci.yaml
await githubChecksService.githubChecksUtil.updateCheckRun(
Copy link
Contributor

Choose a reason for hiding this comment

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

We can add this to the end of the try block and remove the if - then else.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is separate to minimize the code the try block deals with (only scheduler config validation + schedule builds), otherwise we would silently fail on quota issues

@CaseyHillers CaseyHillers added the waiting for tree to go green Merge PR when tree becomes green via fluttergithubbot label May 21, 2021
@fluttergithubbot fluttergithubbot merged commit abf5290 into flutter:master May 21, 2021
@CaseyHillers CaseyHillers deleted the ci-yaml-check branch November 3, 2021 18:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

waiting for tree to go green Merge PR when tree becomes green via fluttergithubbot

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants