Skip to content

[app_dart] Differentiate 404s from other HTTP exceptions on GitHub files#1150

Merged
fluttergithubbot merged 6 commits intoflutter:masterfrom
CaseyHillers:ci-yaml-config
Apr 13, 2021
Merged

[app_dart] Differentiate 404s from other HTTP exceptions on GitHub files#1150
fluttergithubbot merged 6 commits intoflutter:masterfrom
CaseyHillers:ci-yaml-config

Conversation

@CaseyHillers
Copy link
Contributor

@CaseyHillers CaseyHillers commented Apr 8, 2021

  • Refactor remoteFileContent to githubFileContent
    • Only return response content if file was a 200 response
    • Throw NotFoundException on 404s
    • Throw HttpException on remaining exceptions
    • Allows for customized responses where it may be okay if a config file does not exist, otherwise it should be a hard failure
  • If DeviceLab manifest.yaml 404s, return default response
  • Retrieve .ci.yaml and store it in cache for future use

Issues

flutter/flutter#76140

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Looking at the prod logs, I'm not sure devicelab/manifest.yaml and *_builders.json use the null response. I opt to make it a hard failure, but I can come back and fix them to return default responses if needed.

Copy link
Contributor

Choose a reason for hiding this comment

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

In what situation would this happen? And should we trigger some sort of alert if we hit this?

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 would only happen during a GitHub CDN outage (which we haven't faced issues with). The implementers of this function don't catch this error, so it would surface as an increased error rate in cocoon (we already use error tracking dashboards)

Copy link
Contributor

Choose a reason for hiding this comment

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

What happens if NotFoundException?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

If NotFoundException, we should create an empty config. This case is expected when we remove the existing configs (devicelab/manifest.yaml, *_builders.json) or when a release branch is created without .ci.yaml.

Copy link
Contributor

Choose a reason for hiding this comment

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

What happens if NotFoundException?

Copy link
Contributor

Choose a reason for hiding this comment

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

Do we want to add a try catch block to unblock this API in case of exception?

Copy link
Contributor

Choose a reason for hiding this comment

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

Same for line 191 final YamlMap yaml = await loadDevicelabManifest(commit);

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We retry HttpExceptions. I added back the fails safes for *_builder.json and .ci.yaml to not fail if we can't load those configs with logging to see how common it is.

Copy link
Contributor

Choose a reason for hiding this comment

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

Ditto. a / needed?

Copy link
Contributor

Choose a reason for hiding this comment

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

this is actually the format that githubFileContent expects.

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 updated the format as if everything passes a leading slash, githubFileContent should just add it.

@godofredoc godofredoc added the waiting for tree to go green Merge PR when tree becomes green via fluttergithubbot label Apr 9, 2021
@fluttergithubbot
Copy link

This pull request is not suitable for automatic merging in its current state.

  • Please get at least one approved review before re-applying this label. Reviewers: If you left a comment approving, please use the "approve" review action instead.

@fluttergithubbot fluttergithubbot removed the waiting for tree to go green Merge PR when tree becomes green via fluttergithubbot label Apr 9, 2021
Copy link
Contributor

@keyonghan keyonghan left a comment

Choose a reason for hiding this comment

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

LGTM.

@CaseyHillers
Copy link
Contributor Author

This has been at 50% of prod traffic for 4 hours, and I haven't seen any issues (other than unrelated auth warnings #1158). The HttpException flows require longer soak time, so i'll land this in the current state and follow up if we can remove the logic.

@CaseyHillers CaseyHillers added the waiting for tree to go green Merge PR when tree becomes green via fluttergithubbot label Apr 13, 2021
@fluttergithubbot fluttergithubbot merged commit 7c25bf0 into flutter:master Apr 13, 2021
@CaseyHillers CaseyHillers deleted the ci-yaml-config branch September 7, 2021 18:39
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.

5 participants