Skip to content

Commit

Permalink
internal/ci: update base from cue-lang/cue@46fb300d
Browse files Browse the repository at this point in the history
With the one exception we we do:

    go run cuelang.org/go/internal/ci/[email protected]

in the earlyChecks to side-step the fact that those checks are internal
to the main CUE repo. Fixing that properly is covered by
https://cuelang.org/issue/3435, which also includes more information on
the root cause of this variation.

Signed-off-by: Paul Jolly <[email protected]>
Change-Id: Id4d1b1e34b01483efaca87339e51acca31c87135
Dispatch-Trailer: {"type":"trybot","CL":1200598,"patchset":1,"ref":"refs/changes/98/1200598/1","targetBranch":"master"}
  • Loading branch information
myitcv authored and cueckoo committed Sep 3, 2024
1 parent 5659008 commit 40803ca
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 78 deletions.
39 changes: 2 additions & 37 deletions .github/workflows/trybot.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions internal/ci/base/base.cue
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ import (
)

// Package parameters
githubRepositoryPath: *(URLPath & {#url: githubRepositoryURL, _}) | string
githubRepositoryPath: *(URLPath & {#url: githubRepositoryURL, _}) | string
githubRepositoryURL: *("https://github.com/" + githubRepositoryPath) | string
gerritHubHostname: "review.gerrithub.io"
gerritHubRepositoryURL: *("https://\(gerritHubHostname)/a/" + githubRepositoryPath) | string
Expand Down Expand Up @@ -67,7 +67,7 @@ codeReview: #codeReview & {
// Define some shared keys and human-readable names.
//
// trybot.key and unity.key are shared with
// github.com/cue-sh/tools/cmd/cueckoo. The keys are used across various CUE
// github.com/cue-lang/contrib-tools/cmd/cueckoo. The keys are used across various CUE
// workflows and their consistency in those various locations is therefore
// crucial. As such, we assert specific values for the keys here rather than
// just deriving values from the human-readable names.
Expand Down
2 changes: 1 addition & 1 deletion internal/ci/base/codereview.cue
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
// #codeReview defines the schema of a codereview.cfg file that
// sits at the root of a repository. codereview.cfg is the configuration
// file that drives golang.org/x/review/git-codereview. This config
// file is also used by github.com/cue-sh/tools/cmd/cueckoo.
// file is also used by github.com/cue-lang/contrib-tools/cmd/cueckoo.
#codeReview: {
gerrit?: string
github?: string
Expand Down
39 changes: 1 addition & 38 deletions internal/ci/base/github.cue
Original file line number Diff line number Diff line change
Expand Up @@ -100,44 +100,7 @@ checkoutCode: {

earlyChecks: json.#step & {
name: "Early git and code sanity checks"
run: #"""
# Ensure that commit messages have a blank second line.
# We know that a commit message must be longer than a single
# line because each commit must be signed-off.
if git log --format=%B -n 1 HEAD | sed -n '2{/^$/{q1}}'; then
echo "second line of commit message must be blank"
exit 1
fi
# All authors, including co-authors, must have a signed-off trailer by email.
# Note that trailers are in the form "Name <email>", so grab the email with sed.
# For now, we require the sorted lists of author and signer emails to match.
# Note that this also fails if a commit isn't signed-off at all.
#
# In Gerrit we already enable a form of this via https://gerrit-review.googlesource.com/Documentation/project-configuration.html#require-signed-off-by,
# but it does not support co-authors nor can it be used when testing GitHub PRs.
commit_authors="$(
{
git log -1 --pretty='%ae'
git log -1 --pretty='%(trailers:key=Co-authored-by,valueonly)' | sed -ne 's/.* <\(.*\)>/\1/p'
} | sort -u
)"
commit_signers="$(
{
git log -1 --pretty='%(trailers:key=Signed-off-by,valueonly)' | sed -ne 's/.* <\(.*\)>/\1/p'
} | sort -u
)"
if [[ "${commit_authors}" != "${commit_signers}" ]]; then
echo "Error: commit author email addresses do not match signed-off-by trailers"
echo
echo "Authors:"
echo "${commit_authors}"
echo
echo "Signers:"
echo "${commit_signers}"
exit 1
fi
"""#
run: "go run cuelang.org/go/internal/ci/[email protected]"
}

curlGitHubAPI: {
Expand Down
2 changes: 2 additions & 0 deletions internal/ci/github/trybot.cue
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ import (
)

workflows: trybot: _repo.bashWorkflow & {
name: _repo.trybot.name

on: {
push: {
branches: list.Concat([[_repo.testDefaultBranch], _repo.protectedBranchPatterns]) // do not run PR branches
Expand Down

0 comments on commit 40803ca

Please sign in to comment.