mirror of
https://github.com/hashicorp/vault.git
synced 2026-02-04 15:31:57 +01:00
* [VAULT-41857] pipeline(find-artifact): add support for finding artifacts from branches (#11799) Add support for finding matching workflow artifacts from branches rather than PRs. This allows us to trigger custom HCP image builds from a branch rather than an PR. It also enables us to build and test the HCP image on a scheduled nightly cadence, which we've also enabled. As part of these changes I also added support for specifying which environment you want to test and threaded it through the cloud scenario now that there are multiple variants. We also make the testing workflow workflow_dispatch-able so that we can trigger HVD testing for any custom image in any environment without building a new image. Signed-off-by: Ryan Cragun <me@ryan.ec> Co-authored-by: Ryan Cragun <me@ryan.ec>
45 lines
975 B
Go
45 lines
975 B
Go
// Copyright IBM Corp. 2016, 2025
|
|
// SPDX-License-Identifier: BUSL-1.1
|
|
|
|
package github
|
|
|
|
import (
|
|
"context"
|
|
"log/slog"
|
|
|
|
libgithub "github.com/google/go-github/v81/github"
|
|
slogctx "github.com/veqryn/slog-context"
|
|
)
|
|
|
|
// listCommitStatuses lists all of the statuses associated with a commit.
|
|
func listCommitStatuses(
|
|
ctx context.Context,
|
|
github *libgithub.Client,
|
|
owner string,
|
|
repo string,
|
|
ref string,
|
|
) ([]*libgithub.RepoStatus, error) {
|
|
ctx = slogctx.Append(ctx,
|
|
slog.String("owner", owner),
|
|
slog.String("repo", repo),
|
|
slog.String("commit-ref", ref),
|
|
)
|
|
slog.Default().DebugContext(ctx, "listing commit statuses")
|
|
|
|
opts := &libgithub.ListOptions{PerPage: PerPageMax}
|
|
statuses := []*libgithub.RepoStatus{}
|
|
for {
|
|
ss, res, err := github.Repositories.ListStatuses(ctx, owner, repo, ref, opts)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
statuses = append(statuses, ss...)
|
|
|
|
if res.NextPage == 0 {
|
|
return statuses, nil
|
|
}
|
|
|
|
opts.Page = res.NextPage
|
|
}
|
|
}
|