Skip to content

Conversation

dscho
Copy link
Member

@dscho dscho commented Jan 28, 2025

This PR corresponds to git-for-windows/git-for-windows-automation#109, concluding the migration of Git for Windows' snapshot builds from being built via the GitArtifacts Azure Pipeline to a combination of GitHub workflows and an orchestration in a GitHub App (concretely, this here GitForWindowsHelper GitHub App).

It implements the logic to run the tag-git workflow on push unless there is already a tag-git check run attached to the git-for-windows/git commit.

If there already is one, then the upload-snapshot workflow needs to be triggered (uploading already-released Git for Windows versions, which is the scenario where tag-git check runs already exist).

And GitForWindowsHelper also needs to learn to react to completed git-artifacts snapshot check runs on git-for-windows/git, triggering the upload-snapshot workflow also in that case. It needs to be careful, though, to verify that this is wanted, by having a peek at git-for-windows/git-artifacts' releases to see whether a corresponding tag already exists, and also by doing an ahead check to see whether the corresponding commit is actually reachable from git-for-windows/git's main branch: We do not want any snapshots to be uploaded when they correspond to a random topic branch that will never be merged.

dscho added 3 commits January 29, 2025 11:18
…t-payload.js

I already adjusted it at some stage, but forgot that I had manually
modified the output of the `get-webhook-event-payload.js` script in my
tests, and it was therefore lacking the `id` and `action` lines.

Signed-off-by: Johannes Schindelin <[email protected]>
Apparently the `workspaceRoot` variable is no longer suggested (even if
it seems to work), but `workspaceFolder` is.

Signed-off-by: Johannes Schindelin <[email protected]>
The idea is that that the `upload-snapshot` workflow is triggered as
soon as the last `git-artifacts-*` check run has completed. Let's make
it easy on myself by taking an existing webhook event that was delivered
and that ideally should have triggered all that, and then develop the
relevant code leaning heavily on VS Code's debugger.

Signed-off-by: Johannes Schindelin <[email protected]>
@dscho dscho marked this pull request as ready for review January 29, 2025 13:44
@dscho dscho changed the title Snapshot builds Support snapshot builds Jan 29, 2025
@dscho dscho requested a review from mjcheetham January 29, 2025 13:53
dscho added 4 commits January 30, 2025 13:49
The `tag-git` workflow can be used to handle Git for Windows' snapshots
via the `snapshot` Boolean that is part of its inputs.

The idea is that once that workflow has completed, the `git-artifacts`
workflow runs are triggered automatically via GitForWindowsHelper, one
per supported CPU architecture.

Now this commit introduces the logic to trigger the `upload-snapshot`
workflow once all of those `git-artifacts` runs completed successfully.

Naturally, we have to be careful to do this only when the snapshot has
not yet been uploaded, and only when the snapshot is built from a commit
that is actually on git-for-windows/git's default branch.

Signed-off-by: Johannes Schindelin <[email protected]>
When a new commit is pushed to Git for Windows' default branch, we
either need to trigger a new snapshot build (namely when the `tag-git`
workflow has not yet run on that commit) or upload the snapshot (this is
the case when a new Git for Windows has been branch-deployed in a PR and
the PR is now "merged" by pushing its tip to `main`).

Signed-off-by: Johannes Schindelin <[email protected]>
Signed-off-by: Johannes Schindelin <[email protected]>
if (!match) throw new Error(
`Could not parse 'summary' attribute of check-run ${req.body.check_run.id}: ${output.summary}`
)
const [, ver, commit, tagGitWorkflowRunID] = match
Copy link
Member

Choose a reason for hiding this comment

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

I've never seen this syntax before (the leading empty ,).. is it intentional?

const [, ver, .....

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, this skips the match[0], which would be the entire matched string (I only need the capturing groups).

Comment on lines +191 to +194
const needle =
`Build Git ${ver} artifacts from commit ${commit} (tag-git run #${tagGitWorkflowRunID})`
const latest = runs
.filter(run => run.output.summary === needle)
Copy link
Member

Choose a reason for hiding this comment

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

This filtering feels fragile. Is this the best (only, I suspect 😢) way to filter runs?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, there is no other way, really. I use the title, summary and output to "store" information that links those workflow runs together.

Copy link
Member Author

Choose a reason for hiding this comment

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

For the record: The summary is specified in the git-artifacts workflow.

@dscho dscho merged commit 8672dce into git-for-windows:main Jan 30, 2025
1 check passed
@dscho dscho deleted the snapshot-builds branch January 30, 2025 16:19
dscho added a commit to dscho/git-for-windows-automation that referenced this pull request Feb 5, 2025
For almost eight years, Git for Windows' snapshots were hosted at
https://wingit.blob.core.windows.net/files/index.html, i.e. on Azure
Blobs.

As of a combination of PRs [*1*], [*2*],
snapshots are not only now built and deployed via GitHub Actions instead
of Azure Pipelines (and ARM64 artifacts are now included, too), they are
also hosted on GitHub [*3*], with the main page being hosted on GitHub
Pages [*4*].

Therefore, the original link now redirects to a new location (which is
also a lot easier to remember): http://gitforwindows.org/git-snapshots.
Let's adjust the link to link there directly.

References:
*1*: git-for-windows#109
*2*: git-for-windows/gfw-helper-github-app#117
*3*: https://github.com/git-for-windows/git-snapshots/releases/
*4*: https://github.com/git-for-windows/git-snapshots/commits/gh-pages

Signed-off-by: Johannes Schindelin <[email protected]>
dscho added a commit to dscho/git-for-windows-automation that referenced this pull request Feb 5, 2025
For almost eight years, Git for Windows' snapshots were hosted at
https://wingit.blob.core.windows.net/files/index.html, i.e. on Azure
Blobs.

As of a combination of PRs [*1*], [*2*],
snapshots are not only now built and deployed via GitHub Actions instead
of Azure Pipelines (and ARM64 artifacts are now included, too), they are
also hosted on GitHub [*3*], with the main page being hosted on GitHub
Pages [*4*].

Therefore, the original link now redirects to a new location (which is
also a lot easier to remember): http://gitforwindows.org/git-snapshots.
Let's adjust the link to link there directly.

References:
*1*: git-for-windows#109
*2*: git-for-windows/gfw-helper-github-app#117
*3*: https://github.com/git-for-windows/git-snapshots/releases/
*4*: https://github.com/git-for-windows/git-snapshots/commits/gh-pages

Signed-off-by: Johannes Schindelin <[email protected]>
dscho added a commit to dscho/build-extra that referenced this pull request Feb 5, 2025
For almost eight years, Git for Windows' snapshots were hosted at
https://wingit.blob.core.windows.net/files/index.html, i.e. on Azure
Blobs.

As of a combination of PRs [*1*], [*2*],
snapshots are not only now built and deployed via GitHub Actions instead
of Azure Pipelines (and ARM64 artifacts are now included, too), they are
also hosted on GitHub [*3*], with the main page being hosted on GitHub
Pages [*4*].

Therefore, the original link now redirects to a new location (which is
also a lot easier to remember): http://gitforwindows.org/git-snapshots.
Let's adjust the link to link there directly.

References:
*1*: git-for-windows/git-for-windows-automation#109
*2*: git-for-windows/gfw-helper-github-app#117
*3*: https://github.com/git-for-windows/git-snapshots/releases/
*4*: https://github.com/git-for-windows/git-snapshots/commits/gh-pages

Note that technically, we could alternatively delete the
`render_release_notes_and_mail` function from `please.sh`, as it was
only used in the Azure Pipeline that is no longer triggered to build the
snapshots. Let's leave the code there for a bit longer, though.

Signed-off-by: Johannes Schindelin <[email protected]>
dscho added a commit to git-for-windows/git-for-windows.github.io that referenced this pull request Feb 5, 2025
For almost eight years, Git for Windows' snapshots were hosted at
https://wingit.blob.core.windows.net/files/index.html, i.e. on Azure
Blobs.

As of a combination of PRs [*1*], [*2*],
snapshots are not only now built and deployed via GitHub Actions instead
of Azure Pipelines (and ARM64 artifacts are now included, too), they are
also hosted on GitHub [*3*], with the main page being hosted on GitHub
Pages [*4*].

Therefore, the original link now redirects to a new location (which is
also a lot easier to remember): http://gitforwindows.org/git-snapshots.
Let's adjust the link to link there directly.

References:
*1*: git-for-windows/git-for-windows-automation#109
*2*: git-for-windows/gfw-helper-github-app#117
*3*: https://github.com/git-for-windows/git-snapshots/releases/
*4*: https://github.com/git-for-windows/git-snapshots/commits/gh-pages

Signed-off-by: Johannes Schindelin <[email protected]>
dscho added a commit to dscho/git that referenced this pull request Feb 5, 2025
The `SECURITY.md` document mentions Git for Windows' snapshots and
helpfully provides a link.

For almost eight years, these snapshots were hosted at
https://wingit.blob.core.windows.net/files/index.html, i.e. on Azure
Blobs.

As of a combination of PRs [*1*], [*2*],
snapshots are not only now built and deployed via GitHub Actions instead
of Azure Pipelines (and ARM64 artifacts are now included, too), they are
also hosted on GitHub [*3*], with the main page being hosted on GitHub
Pages [*4*].

Therefore, the original link now redirects to a new location (which is
also a lot easier to remember): http://gitforwindows.org/git-snapshots.
Let's adjust the link to link there directly.

References:
*1*: git-for-windows/git-for-windows-automation#109
*2*: git-for-windows/gfw-helper-github-app#117
*3*: https://github.com/git-for-windows/git-snapshots/releases/
*4*: https://github.com/git-for-windows/git-snapshots/commits/gh-pages

Signed-off-by: Johannes Schindelin <[email protected]>
dscho added a commit to git-for-windows/git that referenced this pull request Feb 6, 2025
The `SECURITY.md` document mentions Git for Windows' snapshots and
helpfully provides a link.

For almost eight years, Git for Windows' snapshots were hosted [on Azure
Blobs](https://wingit.blob.core.windows.net/files/index.html).

As of a combination of PRs
(git-for-windows/git-for-windows-automation#109,
git-for-windows/gfw-helper-github-app#117),
snapshots are not only now built and deployed via GitHub Actions instead
of Azure Pipelines (and ARM64 artifacts are now included, too), they are
also hosted [on
GitHub](https://github.com/git-for-windows/git-snapshots/releases/),
with the main page being hosted [on GitHub
Pages](https://github.com/git-for-windows/git-snapshots/commits/gh-pages).

Therefore, the original link now redirects to a new location (which is
also a lot easier to remember): http://gitforwindows.org/git-snapshots.
Let's adjust the link to link there directly.

This is a companion PR of
git-for-windows/git-for-windows-automation#111
and of git-for-windows/build-extra#589.
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.

2 participants