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

Have the cherry-pick script do every relevant milestone #18975

Merged
merged 5 commits into from
May 11, 2023

Conversation

thejcannon
Copy link
Member

@thejcannon thejcannon commented May 11, 2023

Now it will make a cherry to the target milestone and every milestone after it (defined by the order of milestone creation).

The next step is to have this be run in a GitHub Action 🥳

@thejcannon thejcannon added the category:internal CI, fixes for not-yet-released features, etc. label May 11, 2023
@thejcannon thejcannon requested review from stuhood, kaos and benjyw May 11, 2023 01:56
Copy link
Contributor

@huonw huonw left a comment

Choose a reason for hiding this comment

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

Woohoo, automation!

build-support/bin/cherry_pick.sh Outdated Show resolved Hide resolved
build-support/bin/cherry_pick.sh Outdated Show resolved Hide resolved
build-support/bin/cherry_pick.sh Outdated Show resolved Hide resolved
Copy link
Member

@kaos kaos left a comment

Choose a reason for hiding this comment

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

🚀

build-support/bin/cherry_pick.sh Show resolved Hide resolved
@benjyw
Copy link
Contributor

benjyw commented May 11, 2023

Automate all the things!

@thejcannon thejcannon merged commit 714e85f into pantsbuild:main May 11, 2023
@thejcannon thejcannon deleted the cherry-harder branch May 11, 2023 20:31
fi
fi

# NB: Find all milestones >= $TARGET_MILESTONE by having GH list them, then uses awk to trim the
Copy link
Contributor

Choose a reason for hiding this comment

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

For the record, this much was clear all along. what wasn't clear was why that awk incantation achieves this. Assume that the reader understands piping and stuff, but doesn't know awk, because who does?

Copy link
Member Author

Choose a reason for hiding this comment

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

Like 80% of any bash script is unintelligible symbols for me. I don't think we should be documenting how each line works. 🤷‍♂️

And it's kinda over-cliched at this point, but if you ask ChatGPT what it does it actually gives a nice summary 😉

Copy link
Contributor

Choose a reason for hiding this comment

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

We expect people to have some basic bash familiarity, but awk is very rarely used and is especially unintelligible. And if we're relying on some non-obvious bashisms then I would expect to document those too.

Plus, if ChatGPT generated this then that makes me more nervous, not less...

What is the argument against more documentation here? "You can always go futz with ChatGPT or RTFM" doesn't seem like the most reader-friendly approach?

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 just feels a bit cherry-picked (pun intended). We aren't explaining graphQL, or the while IFS= read -r REVIEWER; do PR_CREATE_CMD+=(--reviewer "$REVIEWER"); done <<< "$REVIEWERS" line (which I don't understand, but meh I get the intent and this is a script)

nodes {title}
}
}
}' --jq .data.repository.milestones.nodes.[].title | awk "/$TARGET_MILESTONE/{p=1}p" -)
Copy link
Contributor

Choose a reason for hiding this comment

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

So here's what's unclear: Why are we using $TARGET_MILESTONE as a regex? It is intended to be a literal string. And why are we searching for it as the pattern? And what does the action do? That apparent magic is what I think needs documenting.

Copy link
Member Author

Choose a reason for hiding this comment

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

Ah ok that's much more explicit if a concern

Copy link
Contributor

Choose a reason for hiding this comment

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

From my testing, this appears to rely on the fact that the milestones are returned in increasing order, so that must be verified as a property of the API (or if not, we must sort), and must be documented.

Copy link
Member Author

Choose a reason for hiding this comment

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

They're in that order because we create them in that order. I can't imagine we'd be making milestones for later branches before earlier ones

Copy link
Contributor

Choose a reason for hiding this comment

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

And just generally explaining the awk program would be really helpful.

Copy link
Contributor

Choose a reason for hiding this comment

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

And yet if we do, this will fail in a very unpredictable and undocumented way. And sort is free, as is documenting why.

Copy link
Member Author

Choose a reason for hiding this comment

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

sort isn't correct though, right?

$ gh api graphql -F owner=":owner" -F name=":repo" -f query='
>   query ListMilestones($name: String!, $owner: String!) {
>     repository(owner: $owner, name: $name) {
>       milestones(last: 10) {
>         nodes {title}
>       }
>     }
>   }' --jq .data.repository.milestones.nodes.[].title | sort
2.10.x
2.11.x
2.12.x
2.13.x
2.14.x
2.15.x
2.16.x
2.17.x
2.8.x
2.9.x

Copy link
Member Author

Choose a reason for hiding this comment

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

Oh hot damn there's a version sort?!?!?!?!

-V, --version-sort natural sort of (version) numbers within text

AlexTereshenkov pushed a commit to AlexTereshenkov/pants that referenced this pull request May 12, 2023
…8975)

Now it will make a cherry to the target milestone and every milestone
after it (defined by the order of milestone creation).

The next step is to have this be run in a GitHub Action 🥳
@stuhood stuhood mentioned this pull request May 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
category:internal CI, fixes for not-yet-released features, etc.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants