Repository navigation
ci: open SignatureBot PRs as an App and read signature history from git - #1014
Open
pjhartlieb wants to merge 4 commits into
Open
pjhartlieb wants to merge 4 commits into
pjhartlieb wants to merge 4 commits into
Conversation
read-sources used DNSBOT_TOKEN, a personal token, because pull requests opened with the workflow token start no workflows, and dev requires checks. The SignatureBot App's installation token starts them too, lasts an hour and reaches baddns only. Its key lives in the signature-bot environment, which only stable (where the schedule runs) can use, so pull request workflows can't read it. The signature-test comment uses the workflow token, which already has pull-requests: write.
…o dev signature-history pushed a hash to dev after every merged signature PR. dev now requires a pull request with checks and no bypass, so that push is refused, and a pull request opened by the workflow token would never get its checks. A merged signature is already in dev's history, so read-sources now treats content as seen when it equals any earlier version of the file on dev. signature_history.txt stays as the frozen record of earlier hashes. No push and no extra pull request per merge.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## dev #1014 +/- ##
=======================================
Coverage 99.05% 99.05%
=======================================
Files 28 28
Lines 2437 2437
=======================================
Hits 2414 2414
Misses 23 23 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Reading history from git recognised a signature only while the bot's own commit stayed in dev's history, which holds for merge commits but not for squash merges, so an edited signature could be proposed again in its original form. A record has to be the content the bot proposed, at the time it proposed it. Each SignatureBot PR now adds the hash of the content it proposes to baddns/signatures/history/<signature>.sha256. The line merges with the PR; editing the signature, in the PR or later, never changes it. One file per signature, so concurrent bot PRs never conflict. signature_history.txt is still read. seen_on_dev and the full-history checkout are removed. signature-test tests only the signature .yml. history/ is backfilled from the bot's own commit of every merged SignatureBot PR (141 versions).
Contributor
Author
|
Round 2, for the point-in-time concern: the earlier replay used
|
A person reviews and merges every SignatureBot PR, so it goes through the same checks as any other PR into dev. Skipping the job would also most likely leave dev's required "python / passed" unreported on bot PRs: a skipped reusable-workflow caller reports as "python", not the nested check. signature-test.yml still runs on the bot's PRs as an extra check.
Contributor
Author
|
Agreed. SignatureBot PRs now run the full test suite: b90b140 drops the skip from |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changed
dev now requires a pull request with checks and no bypass (#1013). Two parts of the SignatureBot didn't fit that:
signature-history.ymlpushed a hash to dev after every merged signature PR. That push is refused now, and opening a pull request instead doesn't work: one opened with the workflow token starts no workflows, so its required checks never report. It would also add a second PR to every signature merge.read-sources.ymlopened the signature PRs withDNSBOT_TOKEN, a personal token, because that is what makes their CI start.This PR:
signature-history.yml. Instead, each signature PR records its own history: the bot adds the hash of the content it proposes tobaddns/signatures/history/<signature>.sha256, in the same PR. The line merges with the PR, so nothing runs after a merge: no push, no extra PR. It records what the bot proposed at that time, so editing the signature, in the PR or later, never brings the original back. One file per signature, so concurrent bot PRs never conflict.signature_history.txtis still read.history/is backfilled from the bot's own commit of every merged SignatureBot PR.bls-signaturebotApp. PRs it opens start CI like before. Its token lasts an hour and reaches baddns only; the key is in thesignature-botenvironment, which onlystable(where the schedule runs) can use, so pull request workflows can't read it. The workflow token drops tocontents: read.signature-test.ymlposts its result comment with the workflow token (it already haspull-requests: write), and tests only the signature.yml, not the history files. No workflow usesDNSBOT_TOKENafter this.One PR per signature, reviewed and merged by a person, as today. The schedule runs
stable's copy ofread-sources.yml, so this takes effect at the next promotion;DNSBOT_TOKENis removed after that.Validation
On
ci/signaturebot(7031117):The seen check, taken verbatim from
read-sources.yml, against the content of each SignatureBot PR as the bot proposed it (its own commit, before any edit):Two bot branches from the same base: merging one, then merging dev into the other, does not conflict.
Read Sources runs take 1 to 2 minutes (last 30 runs), well inside the App token's hour.