Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rework tasks to give more context about the check that was made. #74

Merged
merged 6 commits into from
Aug 30, 2017

Conversation

Natim
Copy link
Contributor

@Natim Natim commented Aug 28, 2017

Fixes #53
Fixes #58
Fixes #66

@Natim Natim requested a review from glasserc August 28, 2017 15:45
status = resp.status != 404
return {
"status": status and "exists" or "missing",
"message": "Checking archive.mozilla.org release publication",
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Exists
A repository with that release version exists in https://archive.mozilla.org/pub/firefox/releases/55.0/

Missing
No repository found for that version number: https://archive.mozilla.org/pub/firefox/releases/

Choose a reason for hiding this comment

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

Should the Exists message include a version number? (If so, probably "exists at" instead of "exists in".) Also, I don't know if "repository" is the right word -- maybe packages or archives.


return {
"status": status and "exists" or "missing",
"message": "Checking archive.mozilla.org nightly publication",
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Exists
The archive exists in nightly latest-date

Missing
The archive doesn't exists for this version in nightly latest-date

Exists
The archive exists in nightly latest-date-l10n

Missing
The archive doesn't exists for this version in nightly latest-date-l10n

Choose a reason for hiding this comment

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

The archive doesn't exist, or even No archive exists. I'd also like to add a noun to "nightly latest-date" because I still feel like my understanding of what it is is a little incomplete; maybe "nightly latest-date symlink" or "nightly latest-date mirror"?

else:
return {
"status": "missing",
"message": "No archive-date checks for {} releases".format(channel.value.lower()),
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Differentiate archive-date and archive-date-l10n here.

status = resp.status != 404
return {
"status": status and "exists" or "missing",
"message": "Checking bedrock for release note publication",
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Exists
Release notes were found for that version.

Missing
No release notes were published for that version.

Error
We were unable to contact bedrock. (HTTP 503 - Service unavailable)

Choose a reason for hiding this comment

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

How about changing that version to version {version}?

return True
return {
"status": "missing",
"message": "No security advisories for {} releases".format(channel.value.lower()),
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Missing
No security advisories publication for (beta|nightly) releases

Choose a reason for hiding this comment

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

Ah, this one tricked me for a second because I thought it meant they hadn't been published "yet", but actually they are not published as part of the process for these channels. It's correct as-is but maybe to make it stronger, how about Publication of security advisories does not happen for ... or Security advisories are never published for ...?

status = build_version_id(last_release) >= build_version_id(version)
return {
"status": status and "exists" or "missing",
"message": "Checking bedrock for security advisories publication",
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Exists
Securities advisories for release were published until version 55.0

Missing
Securities advisories for release were published until version 55.0

Error
We were unable to contact bedrock. (HTTP 503 - Service unavailable)

Choose a reason for hiding this comment

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

Security advisories. Also I'd probably change until into up to or through.

status = build_version_id(last_release) >= build_version_id(version)
return {
"status": status and "exists" or "missing",
"message": "Checking bedrock for download links publication",
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Exists
The download links for release have been published with version 55.0

Missing
The download links for release have been published with version 55.0

Error
We were unable to contact bedrock (HTTP 408 - Timeout)

Choose a reason for hiding this comment

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

Published with? I feel like this should be published for, but maybe I don't understand what the actual step of the release process is.

status = '{}-{}'.format(product, version) in body['releases']
return {
"status": status and "exists" or "missing",
"message": "Checking product-details for the release version",
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Exists
We found product-details information about that version : {JSON STRING}

Missing
We did not found product-details information about that version

Error
We were unable to contact product-details (HTTP 503 - Service unavailable)

Choose a reason for hiding this comment

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

I'm pretty sure "that version" is correct but you might want to change it to version {version}. Also, no space before colon in English.

@Natim Natim added this to In Progress in Version 0.2.0 Aug 28, 2017
Copy link

@glasserc glasserc left a comment

Choose a reason for hiding this comment

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

I reviewed the messages in your comments, hope that's what I was supposed to do!

@@ -8,6 +8,9 @@ API Changelog
- Add archive-date and archive-date-l10n checks for nightly
- Add the ongoing-versions endpoint
- Add the list of checks for a given version endpoint.
- Add archive-date and archive-date-l10n nightly endpoints.

Choose a reason for hiding this comment

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

I think this is covered (above).

status = resp.status != 404
return {
"status": status and "exists" or "missing",
"message": "Checking archive.mozilla.org release publication",

Choose a reason for hiding this comment

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

Should the Exists message include a version number? (If so, probably "exists at" instead of "exists in".) Also, I don't know if "repository" is the right word -- maybe packages or archives.


return {
"status": status and "exists" or "missing",
"message": "Checking archive.mozilla.org nightly publication",

Choose a reason for hiding this comment

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

The archive doesn't exist, or even No archive exists. I'd also like to add a noun to "nightly latest-date" because I still feel like my understanding of what it is is a little incomplete; maybe "nightly latest-date symlink" or "nightly latest-date mirror"?

status = resp.status != 404
return {
"status": status and "exists" or "missing",
"message": "Checking bedrock for release note publication",

Choose a reason for hiding this comment

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

How about changing that version to version {version}?

return True
return {
"status": "missing",
"message": "No security advisories for {} releases".format(channel.value.lower()),

Choose a reason for hiding this comment

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

Ah, this one tricked me for a second because I thought it meant they hadn't been published "yet", but actually they are not published as part of the process for these channels. It's correct as-is but maybe to make it stronger, how about Publication of security advisories does not happen for ... or Security advisories are never published for ...?

status = build_version_id(last_release) >= build_version_id(version)
return {
"status": status and "exists" or "missing",
"message": "Checking bedrock for security advisories publication",

Choose a reason for hiding this comment

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

Security advisories. Also I'd probably change until into up to or through.

status = build_version_id(last_release) >= build_version_id(version)
return {
"status": status and "exists" or "missing",
"message": "Checking bedrock for download links publication",

Choose a reason for hiding this comment

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

Published with? I feel like this should be published for, but maybe I don't understand what the actual step of the release process is.

status = '{}-{}'.format(product, version) in body['releases']
return {
"status": status and "exists" or "missing",
"message": "Checking product-details for the release version",

Choose a reason for hiding this comment

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

I'm pretty sure "that version" is correct but you might want to change it to version {version}. Also, no space before colon in English.

Copy link
Contributor

@leplatrem leplatrem left a comment

Choose a reason for hiding this comment

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

If we centralize the task response in a function, we should use it everywhere.

Also, I have the feeling that having status as a boolean is very limiting. Will be hard to cover incomplete for example. Plus, the status strings are duplicated everywhere.
Maybe it's time to use a sort of Enum for status, and use it as much as possible.

"link": link
}
else:
return {
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: superflous else

"status": "missing",
"message": missing_message,
"link": link
}
Copy link
Contributor

Choose a reason for hiding this comment

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

what about this way ?

return {
   "status": "exists" if status else "missing",
   "message": exists_message if status else missing_message,
   "link": link
}

@@ -23,3 +23,19 @@ def heartbeat_factory(url):
return True
return False
return heartbeat


def build_task_response(status, exists_message, missing_message, link):
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: exists vs. missing.. shouldn't it be existing ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That's the name of the statuses.

status = build_version_id(last_release) >= build_version_id(version)

exists_message = "The archive exists at {}".format(url)
missing_message = "No archive exists at {}".format(url)
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: no archive found ?

"status": "missing",
"message": "No archive-date checks for {} releases".format(channel.value.lower()),
"link": url
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Should use build_task_response() here, otherwise it's weird

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Why? The build_task_response is to return a different message depending on a boolean, in that case it is always missing.

"message": "Security advisories are never published for {} releases".format(
channel.value.lower()),
"link": url
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Should use build_task_reponse() here too

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Let's discuss that it seems that we don't have the same vision of what build_task_response is for

"status": status and "exists" or "missing",
"message": "Checking product-details for the nightly version",
"link": 'https://product-details.mozilla.org/1.0/{}_versions.json'.format(product)
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Ditto


with get_session() as session:
url = 'https://product-details.mozilla.org/1.0/{}.json'.format(product)
async with session.get(url) as resp:
if resp.status != 200:
msg = 'Product Details info not available ({})'.format(resp.status)
msg = 'We were unable to contact product-details (HTTP {})'.format(resp.status)
Copy link
Contributor

Choose a reason for hiding this comment

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

"To contact" is not properly true here (the server responded something). The original error message was better.

"status": Status.EXISTS.value if status else Status.MISSING.value,
"message": exists_message if status else missing_message,
"link": link
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Why not use build_task_response(status, message, link) above then ?

"message": "No archive-date checks for {} releases".format(channel.value.lower()),
"link": url
}
return build_task_response(
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: superflous else

}


def build_task_response_from_bool(status, exists_message, missing_message, link):
Copy link
Contributor

Choose a reason for hiding this comment

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

You could keep only one helper if you change the signature to:

def build_task_response(status, link, message, fail_message=None):
     if isinstance(status, bool):
         message = message if status else fail_message
     ...

@Natim Natim merged commit 543af2b into master Aug 30, 2017
@Natim Natim deleted the 58-add-links-to-tasks branch August 30, 2017 12:29
@Natim Natim moved this from In Progress to Complete in Version 0.2.0 Aug 30, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
No open projects
Development

Successfully merging this pull request may close these issues.

None yet

3 participants