Skip to content

Commit

Permalink
internal/ci: update base from cue-lang/cue@XXXXXXX
Browse files Browse the repository at this point in the history
DO NOT SUBMIT

Need to update the commit on which we are baselining one
https://cuelang.org/cl/1200599 lands.

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":3,"ref":"refs/changes/98/1200598/3","targetBranch":"master"}
  • Loading branch information
myitcv authored and cueckoo committed Sep 3, 2024
1 parent 5659008 commit 9cb7fb7
Show file tree
Hide file tree
Showing 5 changed files with 46 additions and 91 deletions.
47 changes: 9 additions & 38 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
71 changes: 26 additions & 45 deletions internal/ci/base/github.cue
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,32 @@ bashWorkflow: json.#Workflow & {
jobs: [string]: defaults: run: shell: "bash"
}

installGo: json.#step & {
name: "Install Go"
uses: "actions/setup-go@v5"
with: {
// We do our own caching in setupGoActionsCaches.
cache: false
"go-version": string
installGo: {
#setupGo: json.#step & {
name: "Install Go"
uses: "actions/setup-go@v5"
with: {
// We do our own caching in setupGoActionsCaches.
cache: false
"go-version": string
}
}

[
#setupGo,

{
json.#step & {
name: "Set common go env vars"
run: """
go env -w GOTOOLCHAIN=local
# Dump env for good measure
go env
"""
}
},
]
}

checkoutCode: {
Expand Down Expand Up @@ -100,44 +118,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
13 changes: 8 additions & 5 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 Expand Up @@ -88,17 +90,17 @@ workflows: trybot: _repo.bashWorkflow & {
"""
},

_repo.earlyChecks,

for v in _installDockerMacOS {v},

_installMacOSUtils,
_setupBuildx,
_installNode,
_installGo,
for v in _installGo {v},
_installHugoLinux,
_installHugoMacOS,

_repo.earlyChecks,

// If the commit under test contains the trailer
// Preprocessor-No-Write-Cache: true, then set the
// PREPROCESSOR_NOWRITECACHE env var to non-empty.
Expand Down Expand Up @@ -276,7 +278,8 @@ _installNode: json.#step & {
}

_installGo: _repo.installGo & {
with: "go-version": _repo.goVersion
#setupGo: with: "go-version": _repo.goVersion
_
}

_installHugoLinux: _linuxStep & {
Expand Down Expand Up @@ -403,7 +406,7 @@ _netlifyDeploy: json.#step & {

// _setupGoActionsCaches is shared between trybot and update_tip.
_setupGoActionsCaches: _repo.setupGoActionsCaches & {
#goVersion: _installGo.with."go-version"
#goVersion: _installGo.#setupGo.with."go-version"

// Unfortunate that we need to hardcode here. Ideally we would be able to derive
// the OS from the runner. i.e. from _linuxWorkflow somehow.
Expand Down

0 comments on commit 9cb7fb7

Please sign in to comment.