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

Find manifest for download by tags instead of commits #14025

Merged
merged 1 commit into from
Nov 22, 2018

Conversation

foolip
Copy link
Member

@foolip foolip commented Nov 12, 2018

This makes it possible to use ./wpt manifest on a checkout that is
more than 50 commits behind master. The downside is that it will require
more network requests if the most recent tag/tags don't have releases
uploaded.

Add more warnings to make it clearer why it goes wrong when it does.

return None


def download_manifest(manifest_path, tags_func, url_func, force=False):
Copy link
Member Author

Choose a reason for hiding this comment

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

The abstraction here becomes kind of pointless now, as using tags instead of commits makes this very likely GitHub specific. Just collapse the indirection?

Copy link
Contributor

Choose a reason for hiding this comment

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

Well the right indicrection would probably be a single function that did the equivalent of f = lambda x:url_func(tags_func()), although in practice we built the gecko equivalent of this at a higher level (perhaps incorrectly) so I don't mind. In any case, followup.

Copy link
Member Author

Choose a reason for hiding this comment

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

Alrighty, thanks!


def download_manifest(manifest_path, commits_func, url_func, force=False):
tags = []
for line in git("log", "--format=%D", "--max-count=%s" % max_count).split("\n"):
Copy link
Member

Choose a reason for hiding this comment

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

git describe --tags --match 'merge_pr_*' does basically this (this is supported back to ancient times)

Copy link
Member

Choose a reason for hiding this comment

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

or maybe that doesn't work if we need more than one? hmm

Copy link
Member Author

Choose a reason for hiding this comment

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

It won't get just the tags reachable from HEAD, or even the tags in tree order.

Copy link
Member Author

Choose a reason for hiding this comment

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

And yeah, also just one.

Copy link
Member Author

Choose a reason for hiding this comment

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

We could call it again using old_tag^1 of course. Possibly that would look nicer?

Copy link
Member Author

Choose a reason for hiding this comment

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

git describe --tags --match 'merge_pr_*' just tries to describe HEAD, man page says "Commit-ish object names to describe. Defaults to HEAD if omitted." Please provide exact command if you think there's a way :)

If we did want to call git describe many times to get from merge_pr_14054 (a merge commit) to merge_pr_14137 (the previous tag) then ^1 is the right thing unless an admin disables the master branch protection and pushes a merge commit to master with old master as the non-first parent and that push closes a PR such that it becomes tagged with merge_pr_*. And then all that would happen is that maybe an older version of the manifest were found. The only improvement would be git describe --tags all the parents and then pick the most recent tag. But then you're better off using git log to walk commits in date order as I've already done.

Copy link
Member

Choose a reason for hiding this comment

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

@foolip according to the man page I have here:

The command finds the most recent tag that is reachable from a commit. If the tag
points to the commit, then only the tag is shown. Otherwise, it suffixes the tag
name with the number of additional commits on top of the tagged object and the
abbreviated object name of the most recent commit.

On wptrunner_tlbc for example it currently gives merge_pr_13862-3-g2ed77c929e. Adding --abbrev=0 gets just the tag: merge_pr_13862.

See also the Search Strategy.

Copy link
Member Author

Choose a reason for hiding this comment

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

We want to find many tags though, not just the most recent, since the most recent tag might not have the manifest uploaded yet, and also occasionally manifest upload fails in the deploy step.

Copy link
Contributor

Choose a reason for hiding this comment

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

I think what's here is fine.

Copy link
Member

Choose a reason for hiding this comment

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

Right, indeed, which is why this doesn't work.


def download_manifest(manifest_path, commits_func, url_func, force=False):
tags = []
for line in git("log", "--format=%D", "--max-count=%s" % max_count).split("\n"):
Copy link
Contributor

Choose a reason for hiding this comment

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

I think what's here is fine.

return None


def download_manifest(manifest_path, tags_func, url_func, force=False):
Copy link
Contributor

Choose a reason for hiding this comment

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

Well the right indicrection would probably be a single function that did the equivalent of f = lambda x:url_func(tags_func()), although in practice we built the gecko equivalent of this at a higher level (perhaps incorrectly) so I don't mind. In any case, followup.

This makes it possible to use `./wpt manifest` on a checkout that is
more than 50 commits behind master. The downside is that it will require
more network requests if the most recent tag/tags don't have releases
uploaded.

Add more warnings to make it clearer why it goes wrong when it does.
@foolip foolip force-pushed the foolip/manifest-download-by-tag branch from 63cacb0 to 948619e Compare November 21, 2018 14:15
@jgraham jgraham merged commit 3657828 into master Nov 22, 2018
@foolip foolip deleted the foolip/manifest-download-by-tag branch February 1, 2019 15:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants