Skip to content

Conversation

@dscho
Copy link
Member

@dscho dscho commented Mar 11, 2025

There are two situations when the upload-snapshot workflow needs to be triggered:

  1. For regular updates of Git for Windows:
    1. A regular git-for-windows/git PR is merged, which means that main is updated.
    2. This triggers a tag-git workflow run with the snapshot flag set to true.
    3. Once that tag-git run completes, GitForWindowsHelper triggers git-artifacts workflow runs for x86_64, aarch64 and i686 each.
    4. Once the last of these three git-artifacts runs completes with success, GitForWindowsHelper triggers the upload-snapshot workflow run.
  2. For "Rebase to <git-version>" PRs:
    1. In those PRs, to "branch-deploy", a /git-artifacts slash command triggers the tag-git workflow, this time with snapshot set to false.
    2. Just like above, once the tag-git run completes successfully, the git-artifacts workflow runs are triggered.
    3. After the last of these three git-artifacts runs completes with success, the PR author is expected to run the manual tests.
    4. Once the installer is validated, the PR author publishes the artifacts via /release.
    5. This triggers the release-git workflow, which creates a new GitHub Release, among other things.
    6. Once the release-git workflow run concludes successfully, GitForWindowsHelper "merges" the PR by updating the main ref.
    7. This triggers a push webhook event, which GitForWindowsHelper needs to handle by triggering the upload-snapshot workflow run.

The difference between these two situations is, of course, that in the latter case, there are already the release artifacts, while in the former case, snapshot artifacts first need to be built.

Those code paths are slightly different; The snapshot artifacts case requires a far longer cascade which GitForWindowsHelper needs orchestrate by reacting to 5 webhook events (push, tag-git completion, 3x git-artifacts completion).

The "easier" code path is the one where the release artifacts are already there, and the upload-snapshot workflow run can be triggered immediately after the push event. However, that code path was broken, so that when the v2.48.1 PR was "merged", no upload-snapshot workflow run was triggered. My analysis was incorrect and I missed that there probably had been a push event. Based on my incorrect conclusion, I opened #124.

Since essentially the same code path was still responsible to handle the release artifacts scenario, unsurprisingly no upload-snapshot was triggered since #124 was merged. Meaning: We miss snapshots for v2.49.0-rc0 and v2.49.0-rc1 (and we missed v2.49.0-rc2 until I worked on this PR and ran the steps manually to upload the v2.49.0-rc2 snapshot by way of proving that my fixes are correct this time).

When I realized that the v2.49.0-rc2 snapshot had not been uploaded, I investigated, and found two webhook events that resulted in failure: the push one (which I had assumed would not trigger on updating a ref), and the workflow_run.complete one (handling the completed release-git workflow run, logic which I introduced in #124).

This here PR fixes those woes, and then reverts the change introduced in #124 to avoid double-triggering the upload-snapshot workflow run.

This closes git-for-windows/git#5482

dscho added 7 commits March 11, 2025 17:07
Using `tag-git` would overwrite the existing one!

Signed-off-by: Johannes Schindelin <[email protected]>
The `getToken()` method does not need any parameters when being called
in `slash-commands.js` because there, the `owner`/`repo` values are
obvious. But when triggering an `upload-snapshot` workflow, we are
juggling three different repositories, therefore we absolutely need to
specify for which repository the token needs to target.

This was the _actual_ reason why the `upload-snapshot` run was not
triggered after v2.48.1 was released, the conclusions I drew in
#124 were
incorrect.

Signed-off-by: Johannes Schindelin <[email protected]>
When handling a `push` event on `git-for-windows/git`, it is necessary
to validate that the `tag-git` Check Run has the information needed to
determine the `git-artifacts` runs.

If that information is not there (e.g. because `tag-git` was
accidentally updated and now contains invalid/unparseable data), we
should error out earlier.

Signed-off-by: Johannes Schindelin <[email protected]>
When a `push` wants to trigger a new snapshot to be uploaded using
already-built Git artifacts (which is the case when Git for Windows'
"Rebase to <git-version>" PRs are "merged" by updating the `main` ref),
after verifying that there is a valid `tag-git` Check Run,
GitForWindowsHelper wants to find the associated `git-artifacts`
workflow runs.

They can be identified using the `tag-git` _workflow_ run, though, i.e.
the ID of the workflow as run in `git-for-windows-automation`, not the
mirrored _Check Run_ in `git-for-windows/git`.

Signed-off-by: Johannes Schindelin <[email protected]>
It is the `git-for-windows` org, not the `git` one in which the
`git-for-windows-automation` workflows live and run...

Signed-off-by: Johannes Schindelin <[email protected]>
…sions"

A couple of weeks ago, when I analyzed why no `upload-snapshots`
workflow run was triggered after "merging" the v2.48.1 PR (for details,
see #124),
I concluded mistakenly that updating the `main` ref would not issue a
`push` webhook event.

However, the `push` webhook event _is_ triggered. It was simply not
handled correctly.

Now that I fixed these issues over the course of the preceding commits,
it will work. And therefore the code added in above-mentioned PR needs
to be dropped lest two `upload-snapshot` workflow runs are triggered to
run concurrently.

This reverts commit c2b466e (snapshot uploading: do upload the regular
Git for Windows versions, 2025-02-13).

Signed-off-by: Johannes Schindelin <[email protected]>
In 64b47fb (test-pr-comment-delivery: have an explicit way to avoid
triggering runs, 2025-02-13), I modified the script so that no workflow
runs would be triggered accidentally.

The idea was to avoid changing state on github.com while debugging
webhook event deliveries on my local machine, even though information
may need to be looked up on github.com using the GitHub App credentials.

What I missed was that there are more ways to mess up said state, e.g.
by queuing Check Runs.

This actually happened to me, where an accidentally-incorrect `tag-git`
label was used when queuing the Check Run for an `upload-snapshot`
workflow run, and it overwrote the existing one, but the existing one
was very much needed to figure out which `git-artifacts` runs to use,
and it took me over an hour to reconstruct everything into a healthy
shape.

Let's prevent future mishaps like that.

Signed-off-by: Johannes Schindelin <[email protected]>
@dscho dscho requested review from mjcheetham and rimrul March 11, 2025 17:11
@dscho dscho self-assigned this Mar 11, 2025
dscho added a commit to git-for-windows/git-snapshots that referenced this pull request Mar 11, 2025
There has been a problem with the `upload-snapshot` workflow, fixed in
git-for-windows/gfw-helper-github-app#128, that
prevented the v2.49.0-rc* releases from being added.

I manually ran the automation for -rc2, but for -rc0 and -rc1 I want to
use a different approach: I want to cross-link to the existing releases
in `git-for-windows/git`.

The new `--backfill-release=<tag-name>` option allows just that.

Signed-off-by: Johannes Schindelin <[email protected]>
@dscho dscho merged commit fb12b50 into main Mar 12, 2025
1 check passed
@dscho dscho deleted the fix-upload-snapshot-on-push branch March 12, 2025 10:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Snapshots are missing for the -rc versions

3 participants