From 06484a39d8d44c656212ac2d3b5589f8aa9db033 Mon Sep 17 00:00:00 2001 From: cueckoo Date: Fri, 2 Jul 2021 15:06:28 +0000 Subject: [PATCH] all: change references from cuelang/cue to cue-lang/cue Signed-off-by: cueckoo --- .github/CODEOWNERS | 1 + .github/ISSUE_TEMPLATE/bug_report.md | 2 +- .github/workflows/mirror.yml | 29 - .github/workflows/new_version_triggers.yml | 2 +- .github/workflows/release.yml | 4 +- .github/workflows/repository_dispatch.yml | 58 +- .github/workflows/test.yml | 68 +-- .goreleaser.yml | 2 +- CONTRIBUTING.md | 7 +- README.md | 13 +- _scripts/copy.bara.sky | 74 --- cmd/cue/cmd/testdata/script/cmd_github.txt | 260 ++++----- cmd/cue/cmd/trim.go | 2 +- codereview.cfg | 4 +- cue/testdata/eval/github.txtar | 604 +++++---------------- cue/types.go | 2 +- doc/cmd/cue.md | 2 +- doc/contribute.md | 238 ++++---- doc/tutorial/kubernetes/README.md | 6 +- internal/ci/workflows.cue | 109 ++-- internal/core/adt/eval.go | 2 +- 21 files changed, 446 insertions(+), 1043 deletions(-) create mode 100644 .github/CODEOWNERS delete mode 100644 .github/workflows/mirror.yml delete mode 100644 _scripts/copy.bara.sky diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS new file mode 100644 index 00000000000..ff62be8e8fc --- /dev/null +++ b/.github/CODEOWNERS @@ -0,0 +1 @@ +* @cueckoo diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md index d0b0420e81f..e14bca1a598 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -34,7 +34,7 @@ If possible, provide a recipe for reproducing the error. For advice on how to create a good reproducer, please see: -https://github.com/cuelang/cue/wiki/Creating-test-or-performance-reproducers +https://github.com/cue-lang/cue/wiki/Creating-test-or-performance-reproducers --> diff --git a/.github/workflows/mirror.yml b/.github/workflows/mirror.yml deleted file mode 100644 index afb22a9fcdb..00000000000 --- a/.github/workflows/mirror.yml +++ /dev/null @@ -1,29 +0,0 @@ -# Generated by internal/ci/ci_tool.cue; do not edit - -name: Scheduled repo mirror -on: - schedule: - - cron: '*/30 * * * *' -jobs: - mirror: - runs-on: ubuntu-18.04 - defaults: - run: - shell: bash - steps: - - name: Checkout code - uses: actions/checkout@v2 - - name: Mirror Gerrit to GitHub - run: |- - cd _scripts - docker run --rm -v $PWD/cache:/root/copybara/cache -v $PWD:/usr/src/app --entrypoint="" cueckoo/copybara:afc4ae03eed00b0c9d7415141cd1b5dfa583da7c bash -c " \ - set -eu; \ - echo \"${{ secrets.gerritCookie }}\" > ~/.gitcookies; \ - chmod 600 ~/.gitcookies; \ - git config --global user.name cueckoo; \ - git config --global user.email cueckoo@gmail.com; \ - git config --global http.cookiefile \$HOME/.gitcookies; \ - echo https://cueckoo:${{ secrets.CUECKOO_GITHUB_PAT }}@github.com > ~/.git-credentials; \ - chmod 600 ~/.git-credentials; \ - java -jar /opt/copybara/copybara_deploy.jar migrate copy.bara.sky github; \ - " diff --git a/.github/workflows/new_version_triggers.yml b/.github/workflows/new_version_triggers.yml index cd94c27b9c0..2f4eb0dc793 100644 --- a/.github/workflows/new_version_triggers.yml +++ b/.github/workflows/new_version_triggers.yml @@ -15,7 +15,7 @@ jobs: - name: Rebuild tip.cuelang.org run: 'curl -f -s -H "Content-Type: application/json" -u cueckoo:${{ secrets.CUECKOO_GITHUB_PAT }} --request POST --data-binary "{\"event_type\": \"Re-test post release of - ${GITHUB_REF##refs/tags/}\"}" https://api.github.com/repos/cuelang/cuelang.org/dispatches' + ${GITHUB_REF##refs/tags/}\"}" https://api.github.com/repos/cue-lang/cuelang.org/dispatches' - name: Trigger unity build run: 'curl -f -s -H "Content-Type: application/json" -u cueckoo:${{ secrets.CUECKOO_GITHUB_PAT }} --request POST --data-binary "{\"event_type\": \"Check against CUE ${GITHUB_REF##refs/tags/}\", diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 30d0c5dd40b..ee4cd073ee7 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -28,7 +28,7 @@ jobs: args: release --rm-dist version: v0.155.1 env: - GITHUB_TOKEN: ${{ secrets.ACTIONS_GITHUB_TOKEN }} + GITHUB_TOKEN: ${{ secrets.CUECKOO_GITHUB_PAT }} docker: name: docker runs-on: ubuntu-18.04 @@ -47,7 +47,7 @@ jobs: uses: docker/build-push-action@v1 with: tags: ${{ env.CUE_VERSION }},latest - repository: cuelang/cue + repository: cue-lang/cue username: ${{ secrets.DOCKER_USERNAME }} password: ${{ secrets.DOCKER_PASSWORD }} tag_with_ref: false diff --git a/.github/workflows/repository_dispatch.yml b/.github/workflows/repository_dispatch.yml index 819611560a9..f4ac5e266d1 100644 --- a/.github/workflows/repository_dispatch.yml +++ b/.github/workflows/repository_dispatch.yml @@ -11,6 +11,14 @@ jobs: shell: bash if: ${{ github.event.client_payload.type == 'runtrybot' }} steps: + - name: Write netrc file for cueckoo Gerrithub + run: |- + cat < ~/.netrc + machine review.gerrithub.io + login cueckoo + password ${{ secrets.CUECKOO_GERRITHUB_PASSWORD }} + EOD + chmod 600 ~/.netrc - name: Trigger trybot run: |- mkdir tmpgit @@ -19,52 +27,6 @@ jobs: git config user.name cueckoo git config user.email cueckoo@gmail.com git config http.https://github.com/.extraheader "AUTHORIZATION: basic $(echo -n cueckoo:${{ secrets.CUECKOO_GITHUB_PAT }} | base64)" - git fetch https://cue-review.googlesource.com/cue ${{ github.event.client_payload.payload.ref }} + git fetch https://review.gerrithub.io/a/cue-lang/cue ${{ github.event.client_payload.payload.ref }} git checkout -b ci/${{ github.event.client_payload.payload.changeID }}/${{ github.event.client_payload.payload.commit }} FETCH_HEAD - git push https://github.com/cuelang/cue ci/${{ github.event.client_payload.payload.changeID }}/${{ github.event.client_payload.payload.commit }} - mirror: - runs-on: ubuntu-18.04 - defaults: - run: - shell: bash - if: ${{ github.event.client_payload.type == 'mirror' }} - steps: - - name: Checkout code - uses: actions/checkout@v2 - - name: Mirror Gerrit to GitHub - run: |- - cd _scripts - docker run --rm -v $PWD/cache:/root/copybara/cache -v $PWD:/usr/src/app --entrypoint="" cueckoo/copybara:afc4ae03eed00b0c9d7415141cd1b5dfa583da7c bash -c " \ - set -eu; \ - echo \"${{ secrets.gerritCookie }}\" > ~/.gitcookies; \ - chmod 600 ~/.gitcookies; \ - git config --global user.name cueckoo; \ - git config --global user.email cueckoo@gmail.com; \ - git config --global http.cookiefile \$HOME/.gitcookies; \ - echo https://cueckoo:${{ secrets.CUECKOO_GITHUB_PAT }}@github.com > ~/.git-credentials; \ - chmod 600 ~/.git-credentials; \ - java -jar /opt/copybara/copybara_deploy.jar migrate copy.bara.sky github; \ - " - importpr: - runs-on: ubuntu-18.04 - defaults: - run: - shell: bash - if: ${{ github.event.client_payload.type == 'importpr' }} - steps: - - name: Checkout code - uses: actions/checkout@v2 - - name: 'Import PR #${{ github.event.client_payload.commit }} from GitHub to Gerrit' - run: |- - cd _scripts - docker run --rm -v $PWD/cache:/root/copybara/cache -v $PWD:/usr/src/app --entrypoint="" cueckoo/copybara:afc4ae03eed00b0c9d7415141cd1b5dfa583da7c bash -c " \ - set -eu; \ - echo \"${{ secrets.gerritCookie }}\" > ~/.gitcookies; \ - chmod 600 ~/.gitcookies; \ - git config --global user.name cueckoo; \ - git config --global user.email cueckoo@gmail.com; \ - git config --global http.cookiefile \$HOME/.gitcookies; \ - echo https://cueckoo:${{ secrets.CUECKOO_GITHUB_PAT }}@github.com > ~/.git-credentials; \ - chmod 600 ~/.git-credentials; \ - java -jar /opt/copybara/copybara_deploy.jar migrate copy.bara.sky github-pr ${{ github.event.client_payload.payload.pr }}; \ - " + git push https://github.com/cue-lang/cue ci/${{ github.event.client_payload.payload.changeID }}/${{ github.event.client_payload.payload.commit }} diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 7bd0271325d..a72e3ed9b9e 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -7,6 +7,7 @@ on: - '**' tags-ignore: - v* + pull_request: {} jobs: start: runs-on: ubuntu-18.04 @@ -15,13 +16,19 @@ jobs: shell: bash steps: - if: ${{ startsWith(github.ref, 'refs/heads/ci/') }} - name: Write the gitcookies file - run: echo "${{ secrets.gerritCookie }}" > ~/.gitcookies + name: Write netrc file for cueckoo Gerrithub + run: |- + cat < ~/.netrc + machine review.gerrithub.io + login cueckoo + password ${{ secrets.CUECKOO_GERRITHUB_PASSWORD }} + EOD + chmod 600 ~/.netrc - if: ${{ startsWith(github.ref, 'refs/heads/ci/') }} name: Update Gerrit CL message with starting message - run: 'curl -f -s -H "Content-Type: application/json" --request POST --data ''{"tag":"trybot","message":"Started - the build... see progress at ${{ github.event.repository.html_url }}/actions/runs/${{ - github.run_id }}"}'' -b ~/.gitcookies https://cue-review.googlesource.com/a/changes/$(basename + run: 'curl -f -s -n -H "Content-Type: application/json" --request POST --data + ''{"tag":"trybot","message":"Started the build... see progress at ${{ github.event.repository.html_url + }}/actions/runs/${{ github.run_id }}"}'' https://review.gerrithub.io/a/changes/$(basename $(dirname $GITHUB_REF))/revisions/$(basename $GITHUB_REF)/review' test: needs: start @@ -29,20 +36,22 @@ jobs: fail-fast: false matrix: go-version: - - 1.14.14 - - 1.15.8 - "1.16" os: - ubuntu-18.04 - - macos-10.15 - - windows-2019 runs-on: ${{ matrix.os }} defaults: run: shell: bash steps: - - name: Write the gitcookies file - run: echo "${{ secrets.gerritCookie }}" > ~/.gitcookies + - name: Write netrc file for cueckoo Gerrithub + run: |- + cat < ~/.netrc + machine review.gerrithub.io + login cueckoo + password ${{ secrets.CUECKOO_GERRITHUB_PASSWORD }} + EOD + chmod 600 ~/.netrc - name: Install Go uses: actions/setup-go@v2 with: @@ -65,27 +74,16 @@ jobs: run: go generate ./... - name: Test run: go test ./... - - if: ${{ github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/heads/ci/') - && matrix.go-version == '1.15.8' && matrix.os == 'ubuntu-18.04' }} - name: Test with -race - run: go test -race ./... - name: gorelease check run: go run golang.org/x/exp/cmd/gorelease - name: Check that git is clean post generate and tests run: test -z "$(git status --porcelain)" || (git status; git diff; false) - - if: ${{ github.ref == 'refs/heads/master' }} - name: Pull this commit through the proxy on master - run: |- - v=$(git rev-parse HEAD) - cd $(mktemp -d) - go mod init mod.com - GOPROXY=https://proxy.golang.org go get -d cuelang.org/go/cmd/cue@$v - if: ${{ startsWith(github.ref, 'refs/heads/ci/') && failure() }} name: Post any failures for this matrix entry - run: 'curl -f -s -H "Content-Type: application/json" --request POST --data ''{"tag":"trybot","message":"Build - failed for ${{ runner.os }}-${{ matrix.go-version }}; see ${{ github.event.repository.html_url - }}/actions/runs/${{ github.run_id }} for more details","labels":{"Code-Review":-1}}'' - -b ~/.gitcookies https://cue-review.googlesource.com/a/changes/$(basename + run: 'curl -f -s -n -H "Content-Type: application/json" --request POST --data + ''{"tag":"trybot","message":"Build failed for ${{ runner.os }}-${{ matrix.go-version + }}; see ${{ github.event.repository.html_url }}/actions/runs/${{ github.run_id + }} for more details","labels":{"TryBot-Result":-1}}'' https://review.gerrithub.io/a/changes/$(basename $(dirname $GITHUB_REF))/revisions/$(basename $GITHUB_REF)/review' mark_ci_success: runs-on: ubuntu-18.04 @@ -95,12 +93,18 @@ jobs: run: shell: bash steps: - - name: Write the gitcookies file - run: echo "${{ secrets.gerritCookie }}" > ~/.gitcookies + - name: Write netrc file for cueckoo Gerrithub + run: |- + cat < ~/.netrc + machine review.gerrithub.io + login cueckoo + password ${{ secrets.CUECKOO_GERRITHUB_PASSWORD }} + EOD + chmod 600 ~/.netrc - name: Update Gerrit CL message with success message - run: 'curl -f -s -H "Content-Type: application/json" --request POST --data ''{"tag":"trybot","message":"Build - succeeded for ${{ github.event.repository.html_url }}/actions/runs/${{ github.run_id - }}","labels":{"Code-Review":1}}'' -b ~/.gitcookies https://cue-review.googlesource.com/a/changes/$(basename + run: 'curl -f -s -n -H "Content-Type: application/json" --request POST --data + ''{"tag":"trybot","message":"Build succeeded for ${{ github.event.repository.html_url + }}/actions/runs/${{ github.run_id }}","labels":{"TryBot-Result":1}}'' https://review.gerrithub.io/a/changes/$(basename $(dirname $GITHUB_REF))/revisions/$(basename $GITHUB_REF)/review' delete_build_branch: runs-on: ubuntu-18.04 @@ -117,4 +121,4 @@ jobs: git config user.name cueckoo git config user.email cueckoo@gmail.com git config http.https://github.com/.extraheader "AUTHORIZATION: basic $(echo -n cueckoo:${{ secrets.CUECKOO_GITHUB_PAT }} | base64)" - git push https://github.com/cuelang/cue :${GITHUB_REF#refs/heads/} + git push https://github.com/cue-lang/cue :${GITHUB_REF#refs/heads/} diff --git a/.goreleaser.yml b/.goreleaser.yml index 961dbf14046..48fdc216b3d 100644 --- a/.goreleaser.yml +++ b/.goreleaser.yml @@ -59,7 +59,7 @@ brews: commit_author: name: cue-bot email: noreply@cuelang.org - homepage: "https://github.com/cuelang/cue" + homepage: "https://cuelang.org" description: "CUE is an open source data constraint language which aims to simplify tasks involving defining and using data." test: | system "#{bin}/cue version" diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index d486dc714d5..82b95049ae9 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -20,9 +20,10 @@ again. ## Code reviews All submissions, including submissions by project members, require review. We -use Gerrit code reviews at https://cue-review.googlesource.com for this purpose. -Please read the [Contributing Guide](./doc/contribute.md) -before reading patches. +use [Gerrit code +reviews](https://review.gerrithub.io/q/project:cue-lang%252Fcue) for this +purpose. Please read the [Contributing Guide](./doc/contribute.md) before +reading patches. ## Code of Conduct diff --git a/README.md b/README.md index 98c23f98207..15e87972e89 100644 --- a/README.md +++ b/README.md @@ -14,8 +14,8 @@ limitations under the License. --> [![Go Reference](https://pkg.go.dev/badge/cuelang.org/go.svg)](https://pkg.go.dev/cuelang.org/go) -[![Github](https://github.com/cuelang/cue/workflows/Test/badge.svg)](https://github.com/cuelang/cue/actions) -[![GolangCI](https://golangci.com/badges/github.com/cuelang/cue.svg)](https://golangci.com/r/github.com/cuelang/cue) +[![Github](https://github.com/cue-lang/cue/workflows/Test/badge.svg)](https://github.com/cue-lang/cue/actions) +[![GolangCI](https://golangci.com/badges/github.com/cue-lang/cue.svg)](https://golangci.com/r/github.com/cue-lang/cue) [![Go 1.14+](https://img.shields.io/badge/go-1.14-9cf.svg)](https://golang.org/dl/) [![platforms](https://img.shields.io/badge/platforms-linux|windows|macos-inactive.svg)]() @@ -95,7 +95,7 @@ Some aspects of this are: #### Release builds -[Download](https://github.com/cuelang/cue/releases) the latest release from GitHub. +[Download](https://github.com/cue-lang/cue/releases) the latest release from GitHub. #### Install using Homebrew @@ -146,12 +146,13 @@ an existing set of Kubernetes configurations is available in ### Contributing -Our canonical Git repository is located at https://cue.googlesource.com. +Our canonical Git repository is located at +https://review.gerrithub.io/q/project:cue-lang%252Fcue. To contribute, please read the [Contribution Guide](./doc/contribute.md). To report issues or make a feature request, use the -[issue tracker](https://github.com/cuelang/cue/issues). +[issue tracker](https://github.com/cue-lang/cue/issues). Changes can be contributed using Gerrit or Github pull requests. @@ -160,7 +161,7 @@ Changes can be contributed using Gerrit or Github pull requests. You can get in touch with the cuelang community in the following ways: -- Ask questions via [GitHub Discussions](https://github.com/cuelang/cue/discussions) +- Ask questions via [GitHub Discussions](https://github.com/cue-lang/cue/discussions) - Chat with us on our [Slack workspace](https://join.slack.com/t/cuelang/shared_invite/enQtNzQwODc3NzYzNTA0LTAxNWQwZGU2YWFiOWFiOWQ4MjVjNGQ2ZTNlMmIxODc4MDVjMDg5YmIyOTMyMjQ2MTkzMTU5ZjA1OGE0OGE1NmE). diff --git a/_scripts/copy.bara.sky b/_scripts/copy.bara.sky deleted file mode 100644 index 736f5f72cf1..00000000000 --- a/_scripts/copy.bara.sky +++ /dev/null @@ -1,74 +0,0 @@ -# Copyright 2021 The CUE Authors -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# The copybara configuration for the cuelang/cue repository -# -# When used in conjunction with the cueckoo/copybara Docker image this -# configuration can be run in two modes: -# -# github -# github-pr N -# -# The first mode mirrors Gerrit to GitHub. The second mode imports PR #N from -# GitHub to Gerrit. -# -# See the CUE-defined copybara workflow defined in internal/ci for an example -# of how to pass in Gerrit and GitHub credentials when running an instance of -# the cueckoo/copybara image. - -github_url = "https://github.com/cuelang/cue.git" -gerrit_url = "https://cue-review.googlesource.com/cue" - -origin_github_pr = git.github_pr_origin( - baseline_from_branch = True, - use_merge = True, - url = github_url, - ) - -origin_gerrit = git.origin( - url = gerrit_url, - ref = "master", - ) - -destination_gerrit = git.gerrit_destination( - url = gerrit_url, - fetch = "master", - push_to_refs_for = "master%hashtag=github-pr", - ) - -# Mirror from Gerrit -> GitHub -git.mirror( - name = "github", - origin = gerrit_url, - destination = github_url, - refspecs = ["refs/*"], - prune = False, - ) - -# Import a PR from GitHub to Gerrit -core.workflow( - name = "github-pr", - origin = origin_github_pr, - destination = destination_gerrit, - authoring = authoring.pass_thru("CUE team "), - transformations = [ - metadata.replace_message( - "${GITHUB_PR_TITLE}\n\n" + - "${GITHUB_PR_BODY}\n\n" + - "Closes #${GITHUB_PR_NUMBER}\n" + - "https://github.com/cuelang/cue/pull/${GITHUB_PR_NUMBER}", - ), - ], - mode = "CHANGE_REQUEST", - ) diff --git a/cmd/cue/cmd/testdata/script/cmd_github.txt b/cmd/cue/cmd/testdata/script/cmd_github.txt index 2e6ebffa6ec..e2b14baa138 100644 --- a/cmd/cue/cmd/testdata/script/cmd_github.txt +++ b/cmd/cue/cmd/testdata/script/cmd_github.txt @@ -11,7 +11,6 @@ cue cmd genworkflows # TODO: drop cd when we solve cuelang.org/issue/708 cd ../../ -cmp .github/workflows/mirror.yml .github/workflows/mirror.yml.golden cmp .github/workflows/new_version_triggers.yml .github/workflows/new_version_triggers.yml.golden cmp .github/workflows/release.yml .github/workflows/release.yml.golden cmp .github/workflows/repository_dispatch.yml .github/workflows/repository_dispatch.yml.golden @@ -26,7 +25,7 @@ module "cuelang.org/go" name: Scheduled repo mirror on: schedule: - - cron: '*/30 * * * *' + - cron: '*/15 * * * *' jobs: mirror: runs-on: ubuntu-18.04 @@ -41,13 +40,11 @@ jobs: cd _scripts docker run --rm -v $PWD/cache:/root/copybara/cache -v $PWD:/usr/src/app --entrypoint="" cueckoo/copybara:afc4ae03eed00b0c9d7415141cd1b5dfa583da7c bash -c " \ set -eu; \ - echo \"${{ secrets.gerritCookie }}\" > ~/.gitcookies; \ - chmod 600 ~/.gitcookies; \ git config --global user.name cueckoo; \ - git config --global user.email cueckoo@gmail.com; \ - git config --global http.cookiefile \$HOME/.gitcookies; \ - echo https://cueckoo:${{ secrets.CUECKOO_GITHUB_PAT }}@github.com > ~/.git-credentials; \ - chmod 600 ~/.git-credentials; \ + git config --global user.email cueckoo@cuelang.org; \ + echo machine github.com login cueckoo password ${{ secrets.CUECKOO_GITHUB_PAT }} >> ~/.netrc; \ + echo machine review.gerrithub.io login cueckoo password ${{ secrets.CUECKOO_GERRITHUB_PASSWORD }} >> ~/.netrc; \ + chmod 600 ~/.netrc; \ java -jar /opt/copybara/copybara_deploy.jar migrate copy.bara.sky github; \ " -- .github/workflows/new_version_triggers.yml.golden -- @@ -68,7 +65,7 @@ jobs: - name: Rebuild tip.cuelang.org run: 'curl -f -s -H "Content-Type: application/json" -u cueckoo:${{ secrets.CUECKOO_GITHUB_PAT }} --request POST --data-binary "{\"event_type\": \"Re-test post release of - ${GITHUB_REF##refs/tags/}\"}" https://api.github.com/repos/cuelang/cuelang.org/dispatches' + ${GITHUB_REF##refs/tags/}\"}" https://api.github.com/repos/cue-lang/cuelang.org/dispatches' - name: Trigger unity build run: 'curl -f -s -H "Content-Type: application/json" -u cueckoo:${{ secrets.CUECKOO_GITHUB_PAT }} --request POST --data-binary "{\"event_type\": \"Check against CUE ${GITHUB_REF##refs/tags/}\", @@ -105,7 +102,7 @@ jobs: args: release --rm-dist version: v0.155.1 env: - GITHUB_TOKEN: ${{ secrets.ACTIONS_GITHUB_TOKEN }} + GITHUB_TOKEN: ${{ secrets.CUECKOO_GITHUB_PAT }} docker: name: docker runs-on: ubuntu-18.04 @@ -124,7 +121,7 @@ jobs: uses: docker/build-push-action@v1 with: tags: ${{ env.CUE_VERSION }},latest - repository: cuelang/cue + repository: cue-lang/cue username: ${{ secrets.DOCKER_USERNAME }} password: ${{ secrets.DOCKER_PASSWORD }} tag_with_ref: false @@ -152,6 +149,14 @@ jobs: shell: bash if: ${{ github.event.client_payload.type == 'runtrybot' }} steps: + - name: Write netrc file for cueckoo Gerrithub + run: |- + cat < ~/.netrc + machine review.gerrithub.io + login cueckoo + password ${{ secrets.CUECKOO_GERRITHUB_PASSWORD }} + EOD + chmod 600 ~/.netrc - name: Trigger trybot run: |- mkdir tmpgit @@ -160,55 +165,9 @@ jobs: git config user.name cueckoo git config user.email cueckoo@gmail.com git config http.https://github.com/.extraheader "AUTHORIZATION: basic $(echo -n cueckoo:${{ secrets.CUECKOO_GITHUB_PAT }} | base64)" - git fetch https://cue-review.googlesource.com/cue ${{ github.event.client_payload.payload.ref }} + git fetch https://review.gerrithub.io/a/cue-lang/cue ${{ github.event.client_payload.payload.ref }} git checkout -b ci/${{ github.event.client_payload.payload.changeID }}/${{ github.event.client_payload.payload.commit }} FETCH_HEAD - git push https://github.com/cuelang/cue ci/${{ github.event.client_payload.payload.changeID }}/${{ github.event.client_payload.payload.commit }} - mirror: - runs-on: ubuntu-18.04 - defaults: - run: - shell: bash - if: ${{ github.event.client_payload.type == 'mirror' }} - steps: - - name: Checkout code - uses: actions/checkout@v2 - - name: Mirror Gerrit to GitHub - run: |- - cd _scripts - docker run --rm -v $PWD/cache:/root/copybara/cache -v $PWD:/usr/src/app --entrypoint="" cueckoo/copybara:afc4ae03eed00b0c9d7415141cd1b5dfa583da7c bash -c " \ - set -eu; \ - echo \"${{ secrets.gerritCookie }}\" > ~/.gitcookies; \ - chmod 600 ~/.gitcookies; \ - git config --global user.name cueckoo; \ - git config --global user.email cueckoo@gmail.com; \ - git config --global http.cookiefile \$HOME/.gitcookies; \ - echo https://cueckoo:${{ secrets.CUECKOO_GITHUB_PAT }}@github.com > ~/.git-credentials; \ - chmod 600 ~/.git-credentials; \ - java -jar /opt/copybara/copybara_deploy.jar migrate copy.bara.sky github; \ - " - importpr: - runs-on: ubuntu-18.04 - defaults: - run: - shell: bash - if: ${{ github.event.client_payload.type == 'importpr' }} - steps: - - name: Checkout code - uses: actions/checkout@v2 - - name: 'Import PR #${{ github.event.client_payload.commit }} from GitHub to Gerrit' - run: |- - cd _scripts - docker run --rm -v $PWD/cache:/root/copybara/cache -v $PWD:/usr/src/app --entrypoint="" cueckoo/copybara:afc4ae03eed00b0c9d7415141cd1b5dfa583da7c bash -c " \ - set -eu; \ - echo \"${{ secrets.gerritCookie }}\" > ~/.gitcookies; \ - chmod 600 ~/.gitcookies; \ - git config --global user.name cueckoo; \ - git config --global user.email cueckoo@gmail.com; \ - git config --global http.cookiefile \$HOME/.gitcookies; \ - echo https://cueckoo:${{ secrets.CUECKOO_GITHUB_PAT }}@github.com > ~/.git-credentials; \ - chmod 600 ~/.git-credentials; \ - java -jar /opt/copybara/copybara_deploy.jar migrate copy.bara.sky github-pr ${{ github.event.client_payload.payload.pr }}; \ - " + git push https://github.com/cue-lang/cue ci/${{ github.event.client_payload.payload.changeID }}/${{ github.event.client_payload.payload.commit }} -- .github/workflows/test.yml.golden -- # Generated by internal/ci/ci_tool.cue; do not edit @@ -219,6 +178,7 @@ on: - '**' tags-ignore: - v* + pull_request: {} jobs: start: runs-on: ubuntu-18.04 @@ -227,13 +187,19 @@ jobs: shell: bash steps: - if: ${{ startsWith(github.ref, 'refs/heads/ci/') }} - name: Write the gitcookies file - run: echo "${{ secrets.gerritCookie }}" > ~/.gitcookies + name: Write netrc file for cueckoo Gerrithub + run: |- + cat < ~/.netrc + machine review.gerrithub.io + login cueckoo + password ${{ secrets.CUECKOO_GERRITHUB_PASSWORD }} + EOD + chmod 600 ~/.netrc - if: ${{ startsWith(github.ref, 'refs/heads/ci/') }} name: Update Gerrit CL message with starting message - run: 'curl -f -s -H "Content-Type: application/json" --request POST --data ''{"tag":"trybot","message":"Started - the build... see progress at ${{ github.event.repository.html_url }}/actions/runs/${{ - github.run_id }}"}'' -b ~/.gitcookies https://cue-review.googlesource.com/a/changes/$(basename + run: 'curl -f -s -n -H "Content-Type: application/json" --request POST --data + ''{"tag":"trybot","message":"Started the build... see progress at ${{ github.event.repository.html_url + }}/actions/runs/${{ github.run_id }}"}'' https://review.gerrithub.io/a/changes/$(basename $(dirname $GITHUB_REF))/revisions/$(basename $GITHUB_REF)/review' test: needs: start @@ -241,20 +207,22 @@ jobs: fail-fast: false matrix: go-version: - - 1.14.14 - - 1.15.8 - "1.16" os: - ubuntu-18.04 - - macos-10.15 - - windows-2019 runs-on: ${{ matrix.os }} defaults: run: shell: bash steps: - - name: Write the gitcookies file - run: echo "${{ secrets.gerritCookie }}" > ~/.gitcookies + - name: Write netrc file for cueckoo Gerrithub + run: |- + cat < ~/.netrc + machine review.gerrithub.io + login cueckoo + password ${{ secrets.CUECKOO_GERRITHUB_PASSWORD }} + EOD + chmod 600 ~/.netrc - name: Install Go uses: actions/setup-go@v2 with: @@ -277,27 +245,16 @@ jobs: run: go generate ./... - name: Test run: go test ./... - - if: ${{ github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/heads/ci/') - && matrix.go-version == '1.15.8' && matrix.os == 'ubuntu-18.04' }} - name: Test with -race - run: go test -race ./... - name: gorelease check run: go run golang.org/x/exp/cmd/gorelease - name: Check that git is clean post generate and tests run: test -z "$(git status --porcelain)" || (git status; git diff; false) - - if: ${{ github.ref == 'refs/heads/master' }} - name: Pull this commit through the proxy on master - run: |- - v=$(git rev-parse HEAD) - cd $(mktemp -d) - go mod init mod.com - GOPROXY=https://proxy.golang.org go get -d cuelang.org/go/cmd/cue@$v - if: ${{ startsWith(github.ref, 'refs/heads/ci/') && failure() }} name: Post any failures for this matrix entry - run: 'curl -f -s -H "Content-Type: application/json" --request POST --data ''{"tag":"trybot","message":"Build - failed for ${{ runner.os }}-${{ matrix.go-version }}; see ${{ github.event.repository.html_url - }}/actions/runs/${{ github.run_id }} for more details","labels":{"Code-Review":-1}}'' - -b ~/.gitcookies https://cue-review.googlesource.com/a/changes/$(basename + run: 'curl -f -s -n -H "Content-Type: application/json" --request POST --data + ''{"tag":"trybot","message":"Build failed for ${{ runner.os }}-${{ matrix.go-version + }}; see ${{ github.event.repository.html_url }}/actions/runs/${{ github.run_id + }} for more details","labels":{"TryBot-Result":-1}}'' https://review.gerrithub.io/a/changes/$(basename $(dirname $GITHUB_REF))/revisions/$(basename $GITHUB_REF)/review' mark_ci_success: runs-on: ubuntu-18.04 @@ -307,12 +264,18 @@ jobs: run: shell: bash steps: - - name: Write the gitcookies file - run: echo "${{ secrets.gerritCookie }}" > ~/.gitcookies + - name: Write netrc file for cueckoo Gerrithub + run: |- + cat < ~/.netrc + machine review.gerrithub.io + login cueckoo + password ${{ secrets.CUECKOO_GERRITHUB_PASSWORD }} + EOD + chmod 600 ~/.netrc - name: Update Gerrit CL message with success message - run: 'curl -f -s -H "Content-Type: application/json" --request POST --data ''{"tag":"trybot","message":"Build - succeeded for ${{ github.event.repository.html_url }}/actions/runs/${{ github.run_id - }}","labels":{"Code-Review":1}}'' -b ~/.gitcookies https://cue-review.googlesource.com/a/changes/$(basename + run: 'curl -f -s -n -H "Content-Type: application/json" --request POST --data + ''{"tag":"trybot","message":"Build succeeded for ${{ github.event.repository.html_url + }}/actions/runs/${{ github.run_id }}","labels":{"TryBot-Result":1}}'' https://review.gerrithub.io/a/changes/$(basename $(dirname $GITHUB_REF))/revisions/$(basename $GITHUB_REF)/review' delete_build_branch: runs-on: ubuntu-18.04 @@ -329,7 +292,7 @@ jobs: git config user.name cueckoo git config user.email cueckoo@gmail.com git config http.https://github.com/.extraheader "AUTHORIZATION: basic $(echo -n cueckoo:${{ secrets.CUECKOO_GITHUB_PAT }} | base64)" - git push https://github.com/cuelang/cue :${GITHUB_REF#refs/heads/} + git push https://github.com/cue-lang/cue :${GITHUB_REF#refs/heads/} -- .github/workflows/tip_triggers.yml.golden -- # Generated by internal/ci/ci_tool.cue; do not edit @@ -1188,39 +1151,37 @@ workflows: [...{ }, { file: "new_version_triggers.yml" schema: new_version_triggers -}, { - file: "mirror.yml" - schema: mirror }] test: _#bashWorkflow & { name: "Test" - on: push: { - branches: ["**"] - "tags-ignore": [_#releaseTagPattern] + on: { + push: { + branches: ["**"] + "tags-ignore": [_#releaseTagPattern] + } + pull_request: {} } jobs: { start: { "runs-on": _#linuxMachine steps: [..._ & { if: "${{ \(_#isCLCITestBranch) }}" - }] & [_#writeCookiesFile, _#startCLBuild] + }] & [_#writeNetrcFile, _#startCLBuild] } test: { needs: "start" strategy: _#testStrategy "runs-on": "${{ matrix.os }}" - steps: [_#writeCookiesFile, _#installGo, _#checkoutCode, _#cacheGoModules, _#setGoBuildTags & { + steps: [_#writeNetrcFile, _#installGo, _#checkoutCode, _#cacheGoModules, _#setGoBuildTags & { _#tags: "long" if: "${{ \(_#isMaster) }}" - }, _#goGenerate, _#goTest, _#goTestRace & { - if: "${{ \(_#isMaster) || \(_#isCLCITestBranch) && matrix.go-version == '\(_#latestStableGo)' && matrix.os == '\(_#linuxMachine)' }}" - }, _#goReleaseCheck, _#checkGitClean, _#pullThroughProxy, _#failCLBuild] + }, _#goGenerate, _#goTest, _#goReleaseCheck, _#checkGitClean, _#failCLBuild] } mark_ci_success: { "runs-on": _#linuxMachine if: "${{ \(_#isCLCITestBranch) }}" needs: "test" - steps: [_#writeCookiesFile, _#passCLBuild] + steps: [_#writeNetrcFile, _#passCLBuild] } delete_build_branch: { "runs-on": _#linuxMachine @@ -1229,7 +1190,7 @@ test: _#bashWorkflow & { steps: [_#step & { run: """ \(_#tempCueckooGitDir) - git push https://github.com/cuelang/cue :${GITHUB_REF#\(_#branchRefPrefix)} + git push https://github.com/cue-lang/cue :${GITHUB_REF#\(_#branchRefPrefix)} """ }] } @@ -1266,7 +1227,7 @@ test: _#bashWorkflow & { run: (_#gerrit._#setCodeReview & { #args: { message: "Build failed for ${{ runner.os }}-${{ matrix.go-version }}; see ${{ github.event.repository.html_url }}/actions/runs/${{ github.run_id }} for more details" - labels: "Code-Review": -1 + labels: "TryBot-Result": -1 } }).res } @@ -1275,7 +1236,7 @@ test: _#bashWorkflow & { run: (_#gerrit._#setCodeReview & { #args: { message: "Build succeeded for ${{ github.event.repository.html_url }}/actions/runs/${{ github.run_id }}" - labels: "Code-Review": 1 + labels: "TryBot-Result": 1 } }).res } @@ -1286,17 +1247,15 @@ test: _#bashWorkflow & { #args: { tag: "trybot" message: string - labels?: "Code-Review": int + labels?: "TryBot-Result": int } - res: "\(_#curl) -H \"Content-Type: application/json\" --request POST --data '\(encjson.Marshal(#args))' -b ~/.gitcookies https://cue-review.googlesource.com/a/changes/$(basename $(dirname $GITHUB_REF))/revisions/$(basename $GITHUB_REF)/review" + res: "\(_#curl) -n -H \"Content-Type: application/json\" --request POST --data '\(encjson.Marshal(#args))' https://review.gerrithub.io/a/changes/$(basename $(dirname $GITHUB_REF))/revisions/$(basename $GITHUB_REF)/review" } } } repository_dispatch: _#bashWorkflow & { // These constants are defined by github.com/cue-sh/tools/cmd/cueckoo _#runtrybot: "runtrybot" - _#mirror: "mirror" - _#importpr: "importpr" _#unity: "unity" _#dispatchJob: _#job & { _#type: string @@ -1305,49 +1264,17 @@ repository_dispatch: _#bashWorkflow & { } name: "Repository Dispatch" on: ["repository_dispatch"] - jobs: { - "\(_#runtrybot)": _#dispatchJob & { - _#type: _#runtrybot - steps: [_#step & { - name: "Trigger trybot" - run: """ + jobs: "\(_#runtrybot)": _#dispatchJob & { + _#type: _#runtrybot + steps: [_#writeNetrcFile, _#step & { + name: "Trigger trybot" + run: """ \(_#tempCueckooGitDir) - git fetch https://cue-review.googlesource.com/cue ${{ github.event.client_payload.payload.ref }} + git fetch https://review.gerrithub.io/a/cue-lang/cue ${{ github.event.client_payload.payload.ref }} git checkout -b ci/${{ github.event.client_payload.payload.changeID }}/${{ github.event.client_payload.payload.commit }} FETCH_HEAD - git push https://github.com/cuelang/cue ci/${{ github.event.client_payload.payload.changeID }}/${{ github.event.client_payload.payload.commit }} + git push https://github.com/cue-lang/cue ci/${{ github.event.client_payload.payload.changeID }}/${{ github.event.client_payload.payload.commit }} """ - }] - } - "\(_#mirror)": _#dispatchJob & { - _#type: _#mirror - steps: _#copybaraSteps & { - _ - _#name: "Mirror Gerrit to GitHub" - _#cmd: "github" - } - } - "\(_#importpr)": _#dispatchJob & { - _#type: _#importpr - steps: _#copybaraSteps & { - _ - _#name: "Import PR #${{ github.event.client_payload.commit }} from GitHub to Gerrit" - _#cmd: "github-pr ${{ github.event.client_payload.payload.pr }}" - } - } - } -} -mirror: _#bashWorkflow & { - name: "Scheduled repo mirror" - on: schedule: [{ - cron: "*/30 * * * *" - }] - jobs: mirror: { - "runs-on": _#linuxMachine - steps: _#copybaraSteps & { - _ - _#name: "Mirror Gerrit to GitHub" - _#cmd: "github" - } + }] } } release: _#bashWorkflow & { @@ -1362,7 +1289,7 @@ release: _#bashWorkflow & { with: version: _#latestStableGo }, _#step & { name: "Run GoReleaser" - env: GITHUB_TOKEN: "${{ secrets.ACTIONS_GITHUB_TOKEN }}" + env: GITHUB_TOKEN: "${{ secrets.CUECKOO_GITHUB_PAT }}" uses: "goreleaser/goreleaser-action@v2" with: { args: "release --rm-dist" @@ -1390,7 +1317,7 @@ release: _#bashWorkflow & { uses: "docker/build-push-action@v1" with: { tags: "${{ env.CUE_VERSION }},latest" - repository: "cuelang/cue" + repository: "cue-lang/cue" username: "${{ secrets.DOCKER_USERNAME }}" password: "${{ secrets.DOCKER_PASSWORD }}" tag_with_ref: false @@ -1425,7 +1352,7 @@ new_version_triggers: _#bashWorkflow & { "runs-on": _#linuxMachine steps: [{ name: "Rebuild tip.cuelang.org" - run: "\(_#curl) -H \"Content-Type: application/json\" -u cueckoo:${{ secrets.CUECKOO_GITHUB_PAT }} --request POST --data-binary \"{\\\"event_type\\\": \\\"Re-test post release of ${GITHUB_REF##refs/tags/}\\\"}\" https://api.github.com/repos/cuelang/cuelang.org/dispatches" + run: "\(_#curl) -H \"Content-Type: application/json\" -u cueckoo:${{ secrets.CUECKOO_GITHUB_PAT }} --request POST --data-binary \"{\\\"event_type\\\": \\\"Re-test post release of ${GITHUB_REF##refs/tags/}\\\"}\" https://api.github.com/repos/cue-lang/cuelang.org/dispatches" }, { name: "Trigger unity build" run: "\(_#curl) -H \"Content-Type: application/json\" -u cueckoo:${{ secrets.CUECKOO_GITHUB_PAT }} --request POST --data-binary \"{\\\"event_type\\\": \\\"Check against CUE ${GITHUB_REF##refs/tags/}\\\", \\\"client_payload\\\": {\\\"type\\\": \\\"unity\\\", \\\"payload\\\": {\\\"versions\\\": \\\"\\\\\\\"${GITHUB_REF##refs/tags/}\\\\\\\"\\\"}}}\" https://api.github.com/repos/cue-sh/unity/dispatches" @@ -1457,8 +1384,8 @@ _#testStrategy: { "fail-fast": false matrix: { // Use a stable version of 1.14.x for go generate - "go-version": [_#codeGenGo, _#latestStableGo, "1.16"] - os: [_#linuxMachine, _#macosMachine, _#windowsMachine] + "go-version": ["1.16"] + os: [_#linuxMachine] } } _#setGoBuildTags: _#step & { @@ -1512,9 +1439,16 @@ _#checkGitClean: _#step & { name: "Check that git is clean post generate and tests" run: "test -z \"$(git status --porcelain)\" || (git status; git diff; false)" } -_#writeCookiesFile: _#step & { - name: "Write the gitcookies file" - run: "echo \"${{ secrets.gerritCookie }}\" > ~/.gitcookies" +_#writeNetrcFile: _#step & { + name: "Write netrc file for cueckoo Gerrithub" + run: """ + cat < ~/.netrc + machine review.gerrithub.io + login cueckoo + password ${{ secrets.CUECKOO_GERRITHUB_PASSWORD }} + EOD + chmod 600 ~/.netrc + """ } _#branchRefPrefix: "refs/heads/" _#tempCueckooGitDir: """ @@ -1535,13 +1469,11 @@ _#copybaraCmd: { cd _scripts docker run --rm -v $PWD/cache:/root/copybara/cache -v $PWD:/usr/src/app --entrypoint="" \(_#cueckooCopybaraImage) bash -c " \\ \tset -eu; \\ - \techo \\"${{ secrets.gerritCookie }}\\" > ~/.gitcookies; \\ - \tchmod 600 ~/.gitcookies; \\ \tgit config --global user.name cueckoo; \\ - \tgit config --global user.email cueckoo@gmail.com; \\ - \tgit config --global http.cookiefile \\$HOME/.gitcookies; \\ - \techo https://cueckoo:${{ secrets.CUECKOO_GITHUB_PAT }}@github.com > ~/.git-credentials; \\ - \tchmod 600 ~/.git-credentials; \\ + \tgit config --global user.email cueckoo@cuelang.org; \\ + \techo machine github.com login cueckoo password ${{ secrets.CUECKOO_GITHUB_PAT }} >> ~/.netrc; \\ + \techo machine review.gerrithub.io login cueckoo password ${{ secrets.CUECKOO_GERRITHUB_PASSWORD }} >> ~/.netrc; \\ + \tchmod 600 ~/.netrc; \\ \tjava -jar /opt/copybara/copybara_deploy.jar migrate copy.bara.sky \(_#cmd); \\ \t" """ diff --git a/cmd/cue/cmd/trim.go b/cmd/cue/cmd/trim.go index 8d171b75c6f..eb0725ff719 100644 --- a/cmd/cue/cmd/trim.go +++ b/cmd/cue/cmd/trim.go @@ -137,7 +137,7 @@ func runTrim(cmd *Command, args []string) error { if k != diff.Identity { diff.Print(os.Stdout, script) fmt.Println("Aborting trim, output differs after trimming. This is a bug! Use -i to force trim.") - fmt.Println("You can file a bug here: https://github.com/cuelang/cue/issues/new?assignees=&labels=NeedsInvestigation&template=bug_report.md&title=") + fmt.Println("You can file a bug here: https://github.com/cue-lang/cue/issues/new?assignees=&labels=NeedsInvestigation&template=bug_report.md&title=") os.Exit(1) } } diff --git a/codereview.cfg b/codereview.cfg index 0f505674b2c..5cebf5d7c13 100644 --- a/codereview.cfg +++ b/codereview.cfg @@ -1,3 +1,3 @@ -gerrit: https://cue-review.googlesource.com/cue -github: https://github.com/cuelang/cue +gerrit: https://review.gerrithub.io/a/cue-lang/cue +github: https://github.com/cue-lang/cue cue-unity: https://github.com/cue-sh/unity diff --git a/cue/testdata/eval/github.txtar b/cue/testdata/eval/github.txtar index 0bf6cf8fac2..a21154c1f52 100644 --- a/cue/testdata/eval/github.txtar +++ b/cue/testdata/eval/github.txtar @@ -34,39 +34,37 @@ workflows: [...{ }, { file: "new_version_triggers.yml" schema: new_version_triggers -}, { - file: "mirror.yml" - schema: mirror }] test: _#bashWorkflow & { name: "Test" - on: push: { - branches: ["**"] - "tags-ignore": [_#releaseTagPattern] + on: { + push: { + branches: ["**"] + "tags-ignore": [_#releaseTagPattern] + } + pull_request: {} } jobs: { start: { "runs-on": _#linuxMachine steps: [..._ & { if: "${{ \(_#isCLCITestBranch) }}" - }] & [_#writeCookiesFile, _#startCLBuild] + }] & [_#writeNetrcFile, _#startCLBuild] } test: { needs: "start" strategy: _#testStrategy "runs-on": "${{ matrix.os }}" - steps: [_#writeCookiesFile, _#installGo, _#checkoutCode, _#cacheGoModules, _#setGoBuildTags & { + steps: [_#writeNetrcFile, _#installGo, _#checkoutCode, _#cacheGoModules, _#setGoBuildTags & { _#tags: "long" if: "${{ \(_#isMaster) }}" - }, _#goGenerate, _#goTest, _#goTestRace & { - if: "${{ \(_#isMaster) || \(_#isCLCITestBranch) && matrix.go-version == '\(_#latestStableGo)' && matrix.os == '\(_#linuxMachine)' }}" - }, _#goReleaseCheck, _#checkGitClean, _#pullThroughProxy, _#failCLBuild] + }, _#goGenerate, _#goTest, _#goReleaseCheck, _#checkGitClean, _#failCLBuild] } mark_ci_success: { "runs-on": _#linuxMachine if: "${{ \(_#isCLCITestBranch) }}" needs: "test" - steps: [_#writeCookiesFile, _#passCLBuild] + steps: [_#writeNetrcFile, _#passCLBuild] } delete_build_branch: { "runs-on": _#linuxMachine @@ -75,7 +73,7 @@ test: _#bashWorkflow & { steps: [_#step & { run: """ \(_#tempCueckooGitDir) - git push https://github.com/cuelang/cue :${GITHUB_REF#\(_#branchRefPrefix)} + git push https://github.com/cue-lang/cue :${GITHUB_REF#\(_#branchRefPrefix)} """ }] } @@ -112,7 +110,7 @@ test: _#bashWorkflow & { run: (_#gerrit._#setCodeReview & { #args: { message: "Build failed for ${{ runner.os }}-${{ matrix.go-version }}; see ${{ github.event.repository.html_url }}/actions/runs/${{ github.run_id }} for more details" - labels: "Code-Review": -1 + labels: "TryBot-Result": -1 } }).res } @@ -121,7 +119,7 @@ test: _#bashWorkflow & { run: (_#gerrit._#setCodeReview & { #args: { message: "Build succeeded for ${{ github.event.repository.html_url }}/actions/runs/${{ github.run_id }}" - labels: "Code-Review": 1 + labels: "TryBot-Result": 1 } }).res } @@ -132,17 +130,15 @@ test: _#bashWorkflow & { #args: { tag: "trybot" message: string - labels?: "Code-Review": int + labels?: "TryBot-Result": int } - res: "\(_#curl) -H \"Content-Type: application/json\" --request POST --data '\(encjson.Marshal(#args))' -b ~/.gitcookies https://cue-review.googlesource.com/a/changes/$(basename $(dirname $GITHUB_REF))/revisions/$(basename $GITHUB_REF)/review" + res: "\(_#curl) -n -H \"Content-Type: application/json\" --request POST --data '\(encjson.Marshal(#args))' https://review.gerrithub.io/a/changes/$(basename $(dirname $GITHUB_REF))/revisions/$(basename $GITHUB_REF)/review" } } } repository_dispatch: _#bashWorkflow & { // These constants are defined by github.com/cue-sh/tools/cmd/cueckoo _#runtrybot: "runtrybot" - _#mirror: "mirror" - _#importpr: "importpr" _#unity: "unity" _#dispatchJob: _#job & { _#type: string @@ -151,49 +147,17 @@ repository_dispatch: _#bashWorkflow & { } name: "Repository Dispatch" on: ["repository_dispatch"] - jobs: { - "\(_#runtrybot)": _#dispatchJob & { - _#type: _#runtrybot - steps: [_#step & { - name: "Trigger trybot" - run: """ + jobs: "\(_#runtrybot)": _#dispatchJob & { + _#type: _#runtrybot + steps: [_#writeNetrcFile, _#step & { + name: "Trigger trybot" + run: """ \(_#tempCueckooGitDir) - git fetch https://cue-review.googlesource.com/cue ${{ github.event.client_payload.payload.ref }} + git fetch https://review.gerrithub.io/a/cue-lang/cue ${{ github.event.client_payload.payload.ref }} git checkout -b ci/${{ github.event.client_payload.payload.changeID }}/${{ github.event.client_payload.payload.commit }} FETCH_HEAD - git push https://github.com/cuelang/cue ci/${{ github.event.client_payload.payload.changeID }}/${{ github.event.client_payload.payload.commit }} + git push https://github.com/cue-lang/cue ci/${{ github.event.client_payload.payload.changeID }}/${{ github.event.client_payload.payload.commit }} """ - }] - } - "\(_#mirror)": _#dispatchJob & { - _#type: _#mirror - steps: _#copybaraSteps & { - _ - _#name: "Mirror Gerrit to GitHub" - _#cmd: "github" - } - } - "\(_#importpr)": _#dispatchJob & { - _#type: _#importpr - steps: _#copybaraSteps & { - _ - _#name: "Import PR #${{ github.event.client_payload.commit }} from GitHub to Gerrit" - _#cmd: "github-pr ${{ github.event.client_payload.payload.pr }}" - } - } - } -} -mirror: _#bashWorkflow & { - name: "Scheduled repo mirror" - on: schedule: [{ - cron: "*/30 * * * *" - }] - jobs: mirror: { - "runs-on": _#linuxMachine - steps: _#copybaraSteps & { - _ - _#name: "Mirror Gerrit to GitHub" - _#cmd: "github" - } + }] } } release: _#bashWorkflow & { @@ -208,7 +172,7 @@ release: _#bashWorkflow & { with: version: _#latestStableGo }, _#step & { name: "Run GoReleaser" - env: GITHUB_TOKEN: "${{ secrets.ACTIONS_GITHUB_TOKEN }}" + env: GITHUB_TOKEN: "${{ secrets.CUECKOO_GITHUB_PAT }}" uses: "goreleaser/goreleaser-action@v2" with: { args: "release --rm-dist" @@ -236,7 +200,7 @@ release: _#bashWorkflow & { uses: "docker/build-push-action@v1" with: { tags: "${{ env.CUE_VERSION }},latest" - repository: "cuelang/cue" + repository: "cue-lang/cue" username: "${{ secrets.DOCKER_USERNAME }}" password: "${{ secrets.DOCKER_PASSWORD }}" tag_with_ref: false @@ -271,7 +235,7 @@ new_version_triggers: _#bashWorkflow & { "runs-on": _#linuxMachine steps: [{ name: "Rebuild tip.cuelang.org" - run: "\(_#curl) -H \"Content-Type: application/json\" -u cueckoo:${{ secrets.CUECKOO_GITHUB_PAT }} --request POST --data-binary \"{\\\"event_type\\\": \\\"Re-test post release of ${GITHUB_REF##refs/tags/}\\\"}\" https://api.github.com/repos/cuelang/cuelang.org/dispatches" + run: "\(_#curl) -H \"Content-Type: application/json\" -u cueckoo:${{ secrets.CUECKOO_GITHUB_PAT }} --request POST --data-binary \"{\\\"event_type\\\": \\\"Re-test post release of ${GITHUB_REF##refs/tags/}\\\"}\" https://api.github.com/repos/cue-lang/cuelang.org/dispatches" }, { name: "Trigger unity build" run: "\(_#curl) -H \"Content-Type: application/json\" -u cueckoo:${{ secrets.CUECKOO_GITHUB_PAT }} --request POST --data-binary \"{\\\"event_type\\\": \\\"Check against CUE ${GITHUB_REF##refs/tags/}\\\", \\\"client_payload\\\": {\\\"type\\\": \\\"unity\\\", \\\"payload\\\": {\\\"versions\\\": \\\"\\\\\\\"${GITHUB_REF##refs/tags/}\\\\\\\"\\\"}}}\" https://api.github.com/repos/cue-sh/unity/dispatches" @@ -303,8 +267,8 @@ _#testStrategy: { "fail-fast": false matrix: { // Use a stable version of 1.14.x for go generate - "go-version": [_#codeGenGo, _#latestStableGo, "1.16"] - os: [_#linuxMachine, _#macosMachine, _#windowsMachine] + "go-version": ["1.16"] + os: [_#linuxMachine] } } _#setGoBuildTags: _#step & { @@ -358,9 +322,16 @@ _#checkGitClean: _#step & { name: "Check that git is clean post generate and tests" run: "test -z \"$(git status --porcelain)\" || (git status; git diff; false)" } -_#writeCookiesFile: _#step & { - name: "Write the gitcookies file" - run: "echo \"${{ secrets.gerritCookie }}\" > ~/.gitcookies" +_#writeNetrcFile: _#step & { + name: "Write netrc file for cueckoo Gerrithub" + run: """ + cat < ~/.netrc + machine review.gerrithub.io + login cueckoo + password ${{ secrets.CUECKOO_GERRITHUB_PASSWORD }} + EOD + chmod 600 ~/.netrc + """ } _#branchRefPrefix: "refs/heads/" _#tempCueckooGitDir: """ @@ -381,13 +352,11 @@ _#copybaraCmd: { cd _scripts docker run --rm -v $PWD/cache:/root/copybara/cache -v $PWD:/usr/src/app --entrypoint="" \(_#cueckooCopybaraImage) bash -c " \\ \tset -eu; \\ - \techo \\"${{ secrets.gerritCookie }}\\" > ~/.gitcookies; \\ - \tchmod 600 ~/.gitcookies; \\ \tgit config --global user.name cueckoo; \\ - \tgit config --global user.email cueckoo@gmail.com; \\ - \tgit config --global http.cookiefile \\$HOME/.gitcookies; \\ - \techo https://cueckoo:${{ secrets.CUECKOO_GITHUB_PAT }}@github.com > ~/.git-credentials; \\ - \tchmod 600 ~/.git-credentials; \\ + \tgit config --global user.email cueckoo@cuelang.org; \\ + \techo machine github.com login cueckoo password ${{ secrets.CUECKOO_GITHUB_PAT }} >> ~/.netrc; \\ + \techo machine review.gerrithub.io login cueckoo password ${{ secrets.CUECKOO_GERRITHUB_PASSWORD }} >> ~/.netrc; \\ + \tchmod 600 ~/.netrc; \\ \tjava -jar /opt/copybara/copybara_deploy.jar migrate copy.bara.sky \(_#cmd); \\ \t" """ @@ -1125,13 +1094,13 @@ import "strings" "runs-on": (string){ "ubuntu-18.04" } steps: (#list){ 0: (#struct){ - name: (string){ "Write the gitcookies file" } - run: (string){ "echo \"${{ secrets.gerritCookie }}\" > ~/.gitcookies" } + name: (string){ "Write netrc file for cueckoo Gerrithub" } + run: (string){ "cat < ~/.netrc\nmachine review.gerrithub.io\nlogin cueckoo\npassword ${{ secrets.CUECKOO_GERRITHUB_PASSWORD }}\nEOD\nchmod 600 ~/.netrc" } if: (string){ "${{ startsWith(github.ref, 'refs/heads/ci/') }}" } } 1: (#struct){ name: (string){ "Update Gerrit CL message with starting message" } - run: (string){ "curl -f -s -H \"Content-Type: application/json\" --request POST --data '{\"tag\":\"trybot\",\"message\":\"Started the build... see progress at ${{ github.event.repository.html_url }}/actions/runs/${{ github.run_id }}\"}' -b ~/.gitcookies https://cue-review.googlesource.com/a/changes/$(basename $(dirname $GITHUB_REF))/revisions/$(basename $GITHUB_REF)/review" } + run: (string){ "curl -f -s -n -H \"Content-Type: application/json\" --request POST --data '{\"tag\":\"trybot\",\"message\":\"Started the build... see progress at ${{ github.event.repository.html_url }}/actions/runs/${{ github.run_id }}\"}' https://review.gerrithub.io/a/changes/$(basename $(dirname $GITHUB_REF))/revisions/$(basename $GITHUB_REF)/review" } if: (string){ "${{ startsWith(github.ref, 'refs/heads/ci/') }}" } } } @@ -1147,22 +1116,18 @@ import "strings" "fail-fast": (bool){ false } matrix: (#struct){ "go-version": (#list){ - 0: (string){ "1.14.14" } - 1: (string){ "1.15.8" } - 2: (string){ "1.16" } + 0: (string){ "1.16" } } os: (#list){ 0: (string){ "ubuntu-18.04" } - 1: (string){ "macos-10.15" } - 2: (string){ "windows-2019" } } } } "runs-on": (string){ "${{ matrix.os }}" } steps: (#list){ 0: (#struct){ - name: (string){ "Write the gitcookies file" } - run: (string){ "echo \"${{ secrets.gerritCookie }}\" > ~/.gitcookies" } + name: (string){ "Write netrc file for cueckoo Gerrithub" } + run: (string){ "cat < ~/.netrc\nmachine review.gerrithub.io\nlogin cueckoo\npassword ${{ secrets.CUECKOO_GERRITHUB_PASSWORD }}\nEOD\nchmod 600 ~/.netrc" } } 1: (#struct){ name: (string){ "Install Go" } @@ -1201,27 +1166,17 @@ import "strings" run: (string){ "go test ./..." } } 7: (#struct){ - name: (string){ "Test with -race" } - run: (string){ "go test -race ./..." } - if: (string){ "${{ github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/heads/ci/') && matrix.go-version == '1.15.8' && matrix.os == 'ubuntu-18.04' }}" } - } - 8: (#struct){ name: (string){ "gorelease check" } run: (string){ "go run golang.org/x/exp/cmd/gorelease" } } - 9: (#struct){ + 8: (#struct){ name: (string){ "Check that git is clean post generate and tests" } run: (string){ "test -z \"$(git status --porcelain)\" || (git status; git diff; false)" } } - 10: (#struct){ - name: (string){ "Pull this commit through the proxy on master" } - run: (string){ "v=$(git rev-parse HEAD)\ncd $(mktemp -d)\ngo mod init mod.com\nGOPROXY=https://proxy.golang.org go get -d cuelang.org/go/cmd/cue@$v" } - if: (string){ "${{ github.ref == 'refs/heads/master' }}" } - } - 11: (#struct){ + 9: (#struct){ if: (string){ "${{ startsWith(github.ref, 'refs/heads/ci/') && failure() }}" } name: (string){ "Post any failures for this matrix entry" } - run: (string){ "curl -f -s -H \"Content-Type: application/json\" --request POST --data '{\"tag\":\"trybot\",\"message\":\"Build failed for ${{ runner.os }}-${{ matrix.go-version }}; see ${{ github.event.repository.html_url }}/actions/runs/${{ github.run_id }} for more details\",\"labels\":{\"Code-Review\":-1}}' -b ~/.gitcookies https://cue-review.googlesource.com/a/changes/$(basename $(dirname $GITHUB_REF))/revisions/$(basename $GITHUB_REF)/review" } + run: (string){ "curl -f -s -n -H \"Content-Type: application/json\" --request POST --data '{\"tag\":\"trybot\",\"message\":\"Build failed for ${{ runner.os }}-${{ matrix.go-version }}; see ${{ github.event.repository.html_url }}/actions/runs/${{ github.run_id }} for more details\",\"labels\":{\"TryBot-Result\":-1}}' https://review.gerrithub.io/a/changes/$(basename $(dirname $GITHUB_REF))/revisions/$(basename $GITHUB_REF)/review" } } } defaults: (#struct){ @@ -1236,12 +1191,12 @@ import "strings" needs: (string){ "test" } steps: (#list){ 0: (#struct){ - name: (string){ "Write the gitcookies file" } - run: (string){ "echo \"${{ secrets.gerritCookie }}\" > ~/.gitcookies" } + name: (string){ "Write netrc file for cueckoo Gerrithub" } + run: (string){ "cat < ~/.netrc\nmachine review.gerrithub.io\nlogin cueckoo\npassword ${{ secrets.CUECKOO_GERRITHUB_PASSWORD }}\nEOD\nchmod 600 ~/.netrc" } } 1: (#struct){ name: (string){ "Update Gerrit CL message with success message" } - run: (string){ "curl -f -s -H \"Content-Type: application/json\" --request POST --data '{\"tag\":\"trybot\",\"message\":\"Build succeeded for ${{ github.event.repository.html_url }}/actions/runs/${{ github.run_id }}\",\"labels\":{\"Code-Review\":1}}' -b ~/.gitcookies https://cue-review.googlesource.com/a/changes/$(basename $(dirname $GITHUB_REF))/revisions/$(basename $GITHUB_REF)/review" } + run: (string){ "curl -f -s -n -H \"Content-Type: application/json\" --request POST --data '{\"tag\":\"trybot\",\"message\":\"Build succeeded for ${{ github.event.repository.html_url }}/actions/runs/${{ github.run_id }}\",\"labels\":{\"TryBot-Result\":1}}' https://review.gerrithub.io/a/changes/$(basename $(dirname $GITHUB_REF))/revisions/$(basename $GITHUB_REF)/review" } } } defaults: (#struct){ @@ -1256,7 +1211,7 @@ import "strings" needs: (string){ "test" } steps: (#list){ 0: (#struct){ - run: (string){ "mkdir tmpgit\ncd tmpgit\ngit init\ngit config user.name cueckoo\ngit config user.email cueckoo@gmail.com\ngit config http.https://github.com/.extraheader \"AUTHORIZATION: basic $(echo -n cueckoo:${{ secrets.CUECKOO_GITHUB_PAT }} | base64)\"\ngit push https://github.com/cuelang/cue :${GITHUB_REF#refs/heads/}" } + run: (string){ "mkdir tmpgit\ncd tmpgit\ngit init\ngit config user.name cueckoo\ngit config user.email cueckoo@gmail.com\ngit config http.https://github.com/.extraheader \"AUTHORIZATION: basic $(echo -n cueckoo:${{ secrets.CUECKOO_GITHUB_PAT }} | base64)\"\ngit push https://github.com/cue-lang/cue :${GITHUB_REF#refs/heads/}" } } } defaults: (#struct){ @@ -1276,6 +1231,8 @@ import "strings" 0: (string){ "v*" } } } + pull_request: (#struct){ + } } _#isCLCITestBranch(:ci): (string){ "startsWith(github.ref, 'refs/heads/ci/')" } _#isMaster(:ci): (string){ "github.ref == 'refs/heads/master'" } @@ -1286,16 +1243,16 @@ import "strings" } _#startCLBuild(:ci): (#struct){ name: (string){ "Update Gerrit CL message with starting message" } - run: (string){ "curl -f -s -H \"Content-Type: application/json\" --request POST --data '{\"tag\":\"trybot\",\"message\":\"Started the build... see progress at ${{ github.event.repository.html_url }}/actions/runs/${{ github.run_id }}\"}' -b ~/.gitcookies https://cue-review.googlesource.com/a/changes/$(basename $(dirname $GITHUB_REF))/revisions/$(basename $GITHUB_REF)/review" } + run: (string){ "curl -f -s -n -H \"Content-Type: application/json\" --request POST --data '{\"tag\":\"trybot\",\"message\":\"Started the build... see progress at ${{ github.event.repository.html_url }}/actions/runs/${{ github.run_id }}\"}' https://review.gerrithub.io/a/changes/$(basename $(dirname $GITHUB_REF))/revisions/$(basename $GITHUB_REF)/review" } } _#failCLBuild(:ci): (#struct){ if: (string){ "${{ startsWith(github.ref, 'refs/heads/ci/') && failure() }}" } name: (string){ "Post any failures for this matrix entry" } - run: (string){ "curl -f -s -H \"Content-Type: application/json\" --request POST --data '{\"tag\":\"trybot\",\"message\":\"Build failed for ${{ runner.os }}-${{ matrix.go-version }}; see ${{ github.event.repository.html_url }}/actions/runs/${{ github.run_id }} for more details\",\"labels\":{\"Code-Review\":-1}}' -b ~/.gitcookies https://cue-review.googlesource.com/a/changes/$(basename $(dirname $GITHUB_REF))/revisions/$(basename $GITHUB_REF)/review" } + run: (string){ "curl -f -s -n -H \"Content-Type: application/json\" --request POST --data '{\"tag\":\"trybot\",\"message\":\"Build failed for ${{ runner.os }}-${{ matrix.go-version }}; see ${{ github.event.repository.html_url }}/actions/runs/${{ github.run_id }} for more details\",\"labels\":{\"TryBot-Result\":-1}}' https://review.gerrithub.io/a/changes/$(basename $(dirname $GITHUB_REF))/revisions/$(basename $GITHUB_REF)/review" } } _#passCLBuild(:ci): (#struct){ name: (string){ "Update Gerrit CL message with success message" } - run: (string){ "curl -f -s -H \"Content-Type: application/json\" --request POST --data '{\"tag\":\"trybot\",\"message\":\"Build succeeded for ${{ github.event.repository.html_url }}/actions/runs/${{ github.run_id }}\",\"labels\":{\"Code-Review\":1}}' -b ~/.gitcookies https://cue-review.googlesource.com/a/changes/$(basename $(dirname $GITHUB_REF))/revisions/$(basename $GITHUB_REF)/review" } + run: (string){ "curl -f -s -n -H \"Content-Type: application/json\" --request POST --data '{\"tag\":\"trybot\",\"message\":\"Build succeeded for ${{ github.event.repository.html_url }}/actions/runs/${{ github.run_id }}\",\"labels\":{\"TryBot-Result\":1}}' https://review.gerrithub.io/a/changes/$(basename $(dirname $GITHUB_REF))/revisions/$(basename $GITHUB_REF)/review" } } _#gerrit(:ci): (#struct){ _#setCodeReview(:ci): (#struct){ @@ -1305,7 +1262,7 @@ import "strings" } res: (_|_){ // [incomplete] invalid interpolation: cannot convert incomplete value "string" to JSON: - // ./workflows.cue:129:9 + // ./workflows.cue:127:9 } } } @@ -1359,58 +1316,12 @@ import "strings" if: (string){ "${{ github.event.client_payload.type == 'runtrybot' }}" } steps: (#list){ 0: (#struct){ - name: (string){ "Trigger trybot" } - run: (string){ "mkdir tmpgit\ncd tmpgit\ngit init\ngit config user.name cueckoo\ngit config user.email cueckoo@gmail.com\ngit config http.https://github.com/.extraheader \"AUTHORIZATION: basic $(echo -n cueckoo:${{ secrets.CUECKOO_GITHUB_PAT }} | base64)\"\ngit fetch https://cue-review.googlesource.com/cue ${{ github.event.client_payload.payload.ref }}\ngit checkout -b ci/${{ github.event.client_payload.payload.changeID }}/${{ github.event.client_payload.payload.commit }} FETCH_HEAD\ngit push https://github.com/cuelang/cue ci/${{ github.event.client_payload.payload.changeID }}/${{ github.event.client_payload.payload.commit }}" } - } - } - defaults: (#struct){ - run: (#struct){ - shell: (string){ "bash" } - } - } - } - mirror: (#struct){ - "runs-on": (string){ "ubuntu-18.04" } - _#type(:ci): (string){ "mirror" } - if: (string){ "${{ github.event.client_payload.type == 'mirror' }}" } - steps: (#list){ - _#name(:ci): (string){ "Mirror Gerrit to GitHub" } - _#cmd(:ci): (string){ "github" } - 0: (#struct){ - name: (string){ "Checkout code" } - uses: (string){ "actions/checkout@v2" } - } - 1: (#struct){ - name: (string){ "Mirror Gerrit to GitHub" } - run: (string){ - "cd _scripts\ndocker run --rm -v $PWD/cache:/root/copybara/cache -v $PWD:/usr/src/app --entrypoint=\"\" cueckoo/copybara:afc4ae03eed00b0c9d7415141cd1b5dfa583da7c bash -c \" \\\n\tset -eu; \\\n\techo \\\"${{ secrets.gerritCookie }}\\\" > ~/.gitcookies; \\\n\tchmod 600 ~/.gitcookies; \\\n\tgit config --global user.name cueckoo; \\\n\tgit config --global user.email cueckoo@gmail.com; \\\n\tgit config --global http.cookiefile \\$HOME/.gitcookies; \\\n \techo https://cueckoo:${{ secrets.CUECKOO_GITHUB_PAT }}@github.com > ~/.git-credentials; \\\n\tchmod 600 ~/.git-credentials; \\\n\tjava -jar /opt/copybara/copybara_deploy.jar migrate copy.bara.sky github; \\\n\t\"" - _#cmd(:ci): (string){ "github" } - } - } - } - defaults: (#struct){ - run: (#struct){ - shell: (string){ "bash" } - } - } - } - importpr: (#struct){ - "runs-on": (string){ "ubuntu-18.04" } - _#type(:ci): (string){ "importpr" } - if: (string){ "${{ github.event.client_payload.type == 'importpr' }}" } - steps: (#list){ - _#name(:ci): (string){ "Import PR #${{ github.event.client_payload.commit }} from GitHub to Gerrit" } - _#cmd(:ci): (string){ "github-pr ${{ github.event.client_payload.payload.pr }}" } - 0: (#struct){ - name: (string){ "Checkout code" } - uses: (string){ "actions/checkout@v2" } + name: (string){ "Write netrc file for cueckoo Gerrithub" } + run: (string){ "cat < ~/.netrc\nmachine review.gerrithub.io\nlogin cueckoo\npassword ${{ secrets.CUECKOO_GERRITHUB_PASSWORD }}\nEOD\nchmod 600 ~/.netrc" } } 1: (#struct){ - name: (string){ "Import PR #${{ github.event.client_payload.commit }} from GitHub to Gerrit" } - run: (string){ - "cd _scripts\ndocker run --rm -v $PWD/cache:/root/copybara/cache -v $PWD:/usr/src/app --entrypoint=\"\" cueckoo/copybara:afc4ae03eed00b0c9d7415141cd1b5dfa583da7c bash -c \" \\\n\tset -eu; \\\n\techo \\\"${{ secrets.gerritCookie }}\\\" > ~/.gitcookies; \\\n\tchmod 600 ~/.gitcookies; \\\n\tgit config --global user.name cueckoo; \\\n\tgit config --global user.email cueckoo@gmail.com; \\\n\tgit config --global http.cookiefile \\$HOME/.gitcookies; \\\n \techo https://cueckoo:${{ secrets.CUECKOO_GITHUB_PAT }}@github.com > ~/.git-credentials; \\\n\tchmod 600 ~/.git-credentials; \\\n\tjava -jar /opt/copybara/copybara_deploy.jar migrate copy.bara.sky github-pr ${{ github.event.client_payload.payload.pr }}; \\\n\t\"" - _#cmd(:ci): (string){ "github-pr ${{ github.event.client_payload.payload.pr }}" } - } + name: (string){ "Trigger trybot" } + run: (string){ "mkdir tmpgit\ncd tmpgit\ngit init\ngit config user.name cueckoo\ngit config user.email cueckoo@gmail.com\ngit config http.https://github.com/.extraheader \"AUTHORIZATION: basic $(echo -n cueckoo:${{ secrets.CUECKOO_GITHUB_PAT }} | base64)\"\ngit fetch https://review.gerrithub.io/a/cue-lang/cue ${{ github.event.client_payload.payload.ref }}\ngit checkout -b ci/${{ github.event.client_payload.payload.changeID }}/${{ github.event.client_payload.payload.commit }} FETCH_HEAD\ngit push https://github.com/cue-lang/cue ci/${{ github.event.client_payload.payload.changeID }}/${{ github.event.client_payload.payload.commit }}" } } } defaults: (#struct){ @@ -1421,15 +1332,13 @@ import "strings" } } _#runtrybot(:ci): (string){ "runtrybot" } - _#mirror(:ci): (string){ "mirror" } - _#importpr(:ci): (string){ "importpr" } _#unity(:ci): (string){ "unity" } _#dispatchJob(:ci): (#struct){ "runs-on": (string){ "ubuntu-18.04" } _#type(:ci): (string){ string } if: (_|_){ // [incomplete] workflows.1.schema._#dispatchJob.if: invalid interpolation: non-concrete value string (type string): - // ./workflows.cue:142:14 + // ./workflows.cue:138:14 } } name: (string){ "Repository Dispatch" } @@ -1502,7 +1411,7 @@ import "strings" 2: (#struct){ name: (string){ "Run GoReleaser" } env: (#struct){ - GITHUB_TOKEN: (string){ "${{ secrets.ACTIONS_GITHUB_TOKEN }}" } + GITHUB_TOKEN: (string){ "${{ secrets.CUECKOO_GITHUB_PAT }}" } } uses: (string){ "goreleaser/goreleaser-action@v2" } with: (#struct){ @@ -1539,7 +1448,7 @@ import "strings" uses: (string){ "docker/build-push-action@v1" } with: (#struct){ tags: (string){ "${{ env.CUE_VERSION }},latest" } - repository: (string){ "cuelang/cue" } + repository: (string){ "cue-lang/cue" } username: (string){ "${{ secrets.DOCKER_USERNAME }}" } password: (string){ "${{ secrets.DOCKER_PASSWORD }}" } tag_with_ref: (bool){ false } @@ -1686,7 +1595,7 @@ import "strings" steps: (#list){ 0: (#struct){ name: (string){ "Rebuild tip.cuelang.org" } - run: (string){ "curl -f -s -H \"Content-Type: application/json\" -u cueckoo:${{ secrets.CUECKOO_GITHUB_PAT }} --request POST --data-binary \"{\\\"event_type\\\": \\\"Re-test post release of ${GITHUB_REF##refs/tags/}\\\"}\" https://api.github.com/repos/cuelang/cuelang.org/dispatches" } + run: (string){ "curl -f -s -H \"Content-Type: application/json\" -u cueckoo:${{ secrets.CUECKOO_GITHUB_PAT }} --request POST --data-binary \"{\\\"event_type\\\": \\\"Re-test post release of ${GITHUB_REF##refs/tags/}\\\"}\" https://api.github.com/repos/cue-lang/cuelang.org/dispatches" } } 1: (#struct){ name: (string){ "Trigger unity build" } @@ -1710,82 +1619,6 @@ import "strings" } } } - 5: (struct){ - file: (string){ "mirror.yml" } - schema: (#struct){ - #architecture: (string){ |((string){ "ARM32" }, (string){ "x64" }, (string){ "x86" }) } - #branch: (list){ - 0: (string){ strings.MinRunes(1) } - } - #configuration: ((bool|string|list|struct|number)){ |((string){ string }, (number){ number }, (bool){ bool }, (#struct){ - }, (list){ - }) } - #container: (#struct){ - image: (string){ string } - } - #defaults: (#struct){ - } - #env: (#struct){ - } - #environment: (#struct){ - name: (string){ string } - } - #event: (string){ |((string){ "check_run" }, (string){ "check_suite" }, (string){ "create" }, (string){ "delete" }, (string){ "deployment" }, (string){ "deployment_status" }, (string){ "fork" }, (string){ "gollum" }, (string){ "issue_comment" }, (string){ "issues" }, (string){ "label" }, (string){ "member" }, (string){ "milestone" }, (string){ "page_build" }, (string){ "project" }, (string){ "project_card" }, (string){ "project_column" }, (string){ "public" }, (string){ "pull_request" }, (string){ "pull_request_review" }, (string){ "pull_request_review_comment" }, (string){ "pull_request_target" }, (string){ "push" }, (string){ "registry_package" }, (string){ "release" }, (string){ "status" }, (string){ "watch" }, (string){ "workflow_dispatch" }, (string){ "workflow_run" }, (string){ "repository_dispatch" }) } - #eventObject: ((null|struct)){ |((null){ null }, (#struct){ - }) } - #expressionSyntax: (string){ =~"^\\$\\{\\{.*\\}\\}$" } - #globs: (list){ - 0: (string){ strings.MinRunes(1) } - } - #machine: (string){ |((string){ "linux" }, (string){ "macos" }, (string){ "windows" }) } - #name: (string){ =~"^[_a-zA-Z][a-zA-Z0-9_-]*$" } - #path: (list){ - 0: (string){ strings.MinRunes(1) } - } - #ref: ((null|struct)){ |((null){ null }, (#struct){ - }) } - #shell: (string){ |((string){ string }, (string){ "bash" }, (string){ "pwsh" }, (string){ "python" }, (string){ "sh" }, (string){ "cmd" }, (string){ "powershell" }) } - #types: (list){ - 0: (_){ _ } - } - #: (#struct){ - "working-directory": (string){ string } - } - jobs: (#struct){ - mirror: (#struct){ - "runs-on": (string){ "ubuntu-18.04" } - steps: (#list){ - _#name(:ci): (string){ "Mirror Gerrit to GitHub" } - _#cmd(:ci): (string){ "github" } - 0: (#struct){ - name: (string){ "Checkout code" } - uses: (string){ "actions/checkout@v2" } - } - 1: (#struct){ - name: (string){ "Mirror Gerrit to GitHub" } - run: (string){ - "cd _scripts\ndocker run --rm -v $PWD/cache:/root/copybara/cache -v $PWD:/usr/src/app --entrypoint=\"\" cueckoo/copybara:afc4ae03eed00b0c9d7415141cd1b5dfa583da7c bash -c \" \\\n\tset -eu; \\\n\techo \\\"${{ secrets.gerritCookie }}\\\" > ~/.gitcookies; \\\n\tchmod 600 ~/.gitcookies; \\\n\tgit config --global user.name cueckoo; \\\n\tgit config --global user.email cueckoo@gmail.com; \\\n\tgit config --global http.cookiefile \\$HOME/.gitcookies; \\\n \techo https://cueckoo:${{ secrets.CUECKOO_GITHUB_PAT }}@github.com > ~/.git-credentials; \\\n\tchmod 600 ~/.git-credentials; \\\n\tjava -jar /opt/copybara/copybara_deploy.jar migrate copy.bara.sky github; \\\n\t\"" - _#cmd(:ci): (string){ "github" } - } - } - } - defaults: (#struct){ - run: (#struct){ - shell: (string){ "bash" } - } - } - } - } - name: (string){ "Scheduled repo mirror" } - on: (#struct){ - schedule: (#list){ - 0: (#struct){ - cron: (string){ "*/30 * * * *" } - } - } - } - } - } } test: (#struct){ #architecture: (string){ |((string){ "ARM32" }, (string){ "x64" }, (string){ "x86" }) } @@ -1831,13 +1664,13 @@ import "strings" "runs-on": (string){ "ubuntu-18.04" } steps: (#list){ 0: (#struct){ - name: (string){ "Write the gitcookies file" } - run: (string){ "echo \"${{ secrets.gerritCookie }}\" > ~/.gitcookies" } + name: (string){ "Write netrc file for cueckoo Gerrithub" } + run: (string){ "cat < ~/.netrc\nmachine review.gerrithub.io\nlogin cueckoo\npassword ${{ secrets.CUECKOO_GERRITHUB_PASSWORD }}\nEOD\nchmod 600 ~/.netrc" } if: (string){ "${{ startsWith(github.ref, 'refs/heads/ci/') }}" } } 1: (#struct){ name: (string){ "Update Gerrit CL message with starting message" } - run: (string){ "curl -f -s -H \"Content-Type: application/json\" --request POST --data '{\"tag\":\"trybot\",\"message\":\"Started the build... see progress at ${{ github.event.repository.html_url }}/actions/runs/${{ github.run_id }}\"}' -b ~/.gitcookies https://cue-review.googlesource.com/a/changes/$(basename $(dirname $GITHUB_REF))/revisions/$(basename $GITHUB_REF)/review" } + run: (string){ "curl -f -s -n -H \"Content-Type: application/json\" --request POST --data '{\"tag\":\"trybot\",\"message\":\"Started the build... see progress at ${{ github.event.repository.html_url }}/actions/runs/${{ github.run_id }}\"}' https://review.gerrithub.io/a/changes/$(basename $(dirname $GITHUB_REF))/revisions/$(basename $GITHUB_REF)/review" } if: (string){ "${{ startsWith(github.ref, 'refs/heads/ci/') }}" } } } @@ -1853,22 +1686,18 @@ import "strings" "fail-fast": (bool){ false } matrix: (#struct){ "go-version": (#list){ - 0: (string){ "1.14.14" } - 1: (string){ "1.15.8" } - 2: (string){ "1.16" } + 0: (string){ "1.16" } } os: (#list){ 0: (string){ "ubuntu-18.04" } - 1: (string){ "macos-10.15" } - 2: (string){ "windows-2019" } } } } "runs-on": (string){ "${{ matrix.os }}" } steps: (#list){ 0: (#struct){ - name: (string){ "Write the gitcookies file" } - run: (string){ "echo \"${{ secrets.gerritCookie }}\" > ~/.gitcookies" } + name: (string){ "Write netrc file for cueckoo Gerrithub" } + run: (string){ "cat < ~/.netrc\nmachine review.gerrithub.io\nlogin cueckoo\npassword ${{ secrets.CUECKOO_GERRITHUB_PASSWORD }}\nEOD\nchmod 600 ~/.netrc" } } 1: (#struct){ name: (string){ "Install Go" } @@ -1907,27 +1736,17 @@ import "strings" run: (string){ "go test ./..." } } 7: (#struct){ - name: (string){ "Test with -race" } - run: (string){ "go test -race ./..." } - if: (string){ "${{ github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/heads/ci/') && matrix.go-version == '1.15.8' && matrix.os == 'ubuntu-18.04' }}" } - } - 8: (#struct){ name: (string){ "gorelease check" } run: (string){ "go run golang.org/x/exp/cmd/gorelease" } } - 9: (#struct){ + 8: (#struct){ name: (string){ "Check that git is clean post generate and tests" } run: (string){ "test -z \"$(git status --porcelain)\" || (git status; git diff; false)" } } - 10: (#struct){ - name: (string){ "Pull this commit through the proxy on master" } - run: (string){ "v=$(git rev-parse HEAD)\ncd $(mktemp -d)\ngo mod init mod.com\nGOPROXY=https://proxy.golang.org go get -d cuelang.org/go/cmd/cue@$v" } - if: (string){ "${{ github.ref == 'refs/heads/master' }}" } - } - 11: (#struct){ + 9: (#struct){ if: (string){ "${{ startsWith(github.ref, 'refs/heads/ci/') && failure() }}" } name: (string){ "Post any failures for this matrix entry" } - run: (string){ "curl -f -s -H \"Content-Type: application/json\" --request POST --data '{\"tag\":\"trybot\",\"message\":\"Build failed for ${{ runner.os }}-${{ matrix.go-version }}; see ${{ github.event.repository.html_url }}/actions/runs/${{ github.run_id }} for more details\",\"labels\":{\"Code-Review\":-1}}' -b ~/.gitcookies https://cue-review.googlesource.com/a/changes/$(basename $(dirname $GITHUB_REF))/revisions/$(basename $GITHUB_REF)/review" } + run: (string){ "curl -f -s -n -H \"Content-Type: application/json\" --request POST --data '{\"tag\":\"trybot\",\"message\":\"Build failed for ${{ runner.os }}-${{ matrix.go-version }}; see ${{ github.event.repository.html_url }}/actions/runs/${{ github.run_id }} for more details\",\"labels\":{\"TryBot-Result\":-1}}' https://review.gerrithub.io/a/changes/$(basename $(dirname $GITHUB_REF))/revisions/$(basename $GITHUB_REF)/review" } } } defaults: (#struct){ @@ -1942,12 +1761,12 @@ import "strings" needs: (string){ "test" } steps: (#list){ 0: (#struct){ - name: (string){ "Write the gitcookies file" } - run: (string){ "echo \"${{ secrets.gerritCookie }}\" > ~/.gitcookies" } + name: (string){ "Write netrc file for cueckoo Gerrithub" } + run: (string){ "cat < ~/.netrc\nmachine review.gerrithub.io\nlogin cueckoo\npassword ${{ secrets.CUECKOO_GERRITHUB_PASSWORD }}\nEOD\nchmod 600 ~/.netrc" } } 1: (#struct){ name: (string){ "Update Gerrit CL message with success message" } - run: (string){ "curl -f -s -H \"Content-Type: application/json\" --request POST --data '{\"tag\":\"trybot\",\"message\":\"Build succeeded for ${{ github.event.repository.html_url }}/actions/runs/${{ github.run_id }}\",\"labels\":{\"Code-Review\":1}}' -b ~/.gitcookies https://cue-review.googlesource.com/a/changes/$(basename $(dirname $GITHUB_REF))/revisions/$(basename $GITHUB_REF)/review" } + run: (string){ "curl -f -s -n -H \"Content-Type: application/json\" --request POST --data '{\"tag\":\"trybot\",\"message\":\"Build succeeded for ${{ github.event.repository.html_url }}/actions/runs/${{ github.run_id }}\",\"labels\":{\"TryBot-Result\":1}}' https://review.gerrithub.io/a/changes/$(basename $(dirname $GITHUB_REF))/revisions/$(basename $GITHUB_REF)/review" } } } defaults: (#struct){ @@ -1962,7 +1781,7 @@ import "strings" needs: (string){ "test" } steps: (#list){ 0: (#struct){ - run: (string){ "mkdir tmpgit\ncd tmpgit\ngit init\ngit config user.name cueckoo\ngit config user.email cueckoo@gmail.com\ngit config http.https://github.com/.extraheader \"AUTHORIZATION: basic $(echo -n cueckoo:${{ secrets.CUECKOO_GITHUB_PAT }} | base64)\"\ngit push https://github.com/cuelang/cue :${GITHUB_REF#refs/heads/}" } + run: (string){ "mkdir tmpgit\ncd tmpgit\ngit init\ngit config user.name cueckoo\ngit config user.email cueckoo@gmail.com\ngit config http.https://github.com/.extraheader \"AUTHORIZATION: basic $(echo -n cueckoo:${{ secrets.CUECKOO_GITHUB_PAT }} | base64)\"\ngit push https://github.com/cue-lang/cue :${GITHUB_REF#refs/heads/}" } } } defaults: (#struct){ @@ -1982,6 +1801,8 @@ import "strings" 0: (string){ "v*" } } } + pull_request: (#struct){ + } } _#isCLCITestBranch(:ci): (string){ "startsWith(github.ref, 'refs/heads/ci/')" } _#isMaster(:ci): (string){ "github.ref == 'refs/heads/master'" } @@ -1992,16 +1813,16 @@ import "strings" } _#startCLBuild(:ci): (#struct){ name: (string){ "Update Gerrit CL message with starting message" } - run: (string){ "curl -f -s -H \"Content-Type: application/json\" --request POST --data '{\"tag\":\"trybot\",\"message\":\"Started the build... see progress at ${{ github.event.repository.html_url }}/actions/runs/${{ github.run_id }}\"}' -b ~/.gitcookies https://cue-review.googlesource.com/a/changes/$(basename $(dirname $GITHUB_REF))/revisions/$(basename $GITHUB_REF)/review" } + run: (string){ "curl -f -s -n -H \"Content-Type: application/json\" --request POST --data '{\"tag\":\"trybot\",\"message\":\"Started the build... see progress at ${{ github.event.repository.html_url }}/actions/runs/${{ github.run_id }}\"}' https://review.gerrithub.io/a/changes/$(basename $(dirname $GITHUB_REF))/revisions/$(basename $GITHUB_REF)/review" } } _#failCLBuild(:ci): (#struct){ if: (string){ "${{ startsWith(github.ref, 'refs/heads/ci/') && failure() }}" } name: (string){ "Post any failures for this matrix entry" } - run: (string){ "curl -f -s -H \"Content-Type: application/json\" --request POST --data '{\"tag\":\"trybot\",\"message\":\"Build failed for ${{ runner.os }}-${{ matrix.go-version }}; see ${{ github.event.repository.html_url }}/actions/runs/${{ github.run_id }} for more details\",\"labels\":{\"Code-Review\":-1}}' -b ~/.gitcookies https://cue-review.googlesource.com/a/changes/$(basename $(dirname $GITHUB_REF))/revisions/$(basename $GITHUB_REF)/review" } + run: (string){ "curl -f -s -n -H \"Content-Type: application/json\" --request POST --data '{\"tag\":\"trybot\",\"message\":\"Build failed for ${{ runner.os }}-${{ matrix.go-version }}; see ${{ github.event.repository.html_url }}/actions/runs/${{ github.run_id }} for more details\",\"labels\":{\"TryBot-Result\":-1}}' https://review.gerrithub.io/a/changes/$(basename $(dirname $GITHUB_REF))/revisions/$(basename $GITHUB_REF)/review" } } _#passCLBuild(:ci): (#struct){ name: (string){ "Update Gerrit CL message with success message" } - run: (string){ "curl -f -s -H \"Content-Type: application/json\" --request POST --data '{\"tag\":\"trybot\",\"message\":\"Build succeeded for ${{ github.event.repository.html_url }}/actions/runs/${{ github.run_id }}\",\"labels\":{\"Code-Review\":1}}' -b ~/.gitcookies https://cue-review.googlesource.com/a/changes/$(basename $(dirname $GITHUB_REF))/revisions/$(basename $GITHUB_REF)/review" } + run: (string){ "curl -f -s -n -H \"Content-Type: application/json\" --request POST --data '{\"tag\":\"trybot\",\"message\":\"Build succeeded for ${{ github.event.repository.html_url }}/actions/runs/${{ github.run_id }}\",\"labels\":{\"TryBot-Result\":1}}' https://review.gerrithub.io/a/changes/$(basename $(dirname $GITHUB_REF))/revisions/$(basename $GITHUB_REF)/review" } } _#gerrit(:ci): (#struct){ _#setCodeReview(:ci): (#struct){ @@ -2011,7 +1832,7 @@ import "strings" } res: (_|_){ // [incomplete] invalid interpolation: cannot convert incomplete value "string" to JSON: - // ./workflows.cue:129:9 + // ./workflows.cue:127:9 } } } @@ -2062,58 +1883,12 @@ import "strings" if: (string){ "${{ github.event.client_payload.type == 'runtrybot' }}" } steps: (#list){ 0: (#struct){ - name: (string){ "Trigger trybot" } - run: (string){ "mkdir tmpgit\ncd tmpgit\ngit init\ngit config user.name cueckoo\ngit config user.email cueckoo@gmail.com\ngit config http.https://github.com/.extraheader \"AUTHORIZATION: basic $(echo -n cueckoo:${{ secrets.CUECKOO_GITHUB_PAT }} | base64)\"\ngit fetch https://cue-review.googlesource.com/cue ${{ github.event.client_payload.payload.ref }}\ngit checkout -b ci/${{ github.event.client_payload.payload.changeID }}/${{ github.event.client_payload.payload.commit }} FETCH_HEAD\ngit push https://github.com/cuelang/cue ci/${{ github.event.client_payload.payload.changeID }}/${{ github.event.client_payload.payload.commit }}" } - } - } - defaults: (#struct){ - run: (#struct){ - shell: (string){ "bash" } - } - } - } - mirror: (#struct){ - "runs-on": (string){ "ubuntu-18.04" } - _#type(:ci): (string){ "mirror" } - if: (string){ "${{ github.event.client_payload.type == 'mirror' }}" } - steps: (#list){ - _#name(:ci): (string){ "Mirror Gerrit to GitHub" } - _#cmd(:ci): (string){ "github" } - 0: (#struct){ - name: (string){ "Checkout code" } - uses: (string){ "actions/checkout@v2" } - } - 1: (#struct){ - name: (string){ "Mirror Gerrit to GitHub" } - run: (string){ - "cd _scripts\ndocker run --rm -v $PWD/cache:/root/copybara/cache -v $PWD:/usr/src/app --entrypoint=\"\" cueckoo/copybara:afc4ae03eed00b0c9d7415141cd1b5dfa583da7c bash -c \" \\\n\tset -eu; \\\n\techo \\\"${{ secrets.gerritCookie }}\\\" > ~/.gitcookies; \\\n\tchmod 600 ~/.gitcookies; \\\n\tgit config --global user.name cueckoo; \\\n\tgit config --global user.email cueckoo@gmail.com; \\\n\tgit config --global http.cookiefile \\$HOME/.gitcookies; \\\n \techo https://cueckoo:${{ secrets.CUECKOO_GITHUB_PAT }}@github.com > ~/.git-credentials; \\\n\tchmod 600 ~/.git-credentials; \\\n\tjava -jar /opt/copybara/copybara_deploy.jar migrate copy.bara.sky github; \\\n\t\"" - _#cmd(:ci): (string){ "github" } - } - } - } - defaults: (#struct){ - run: (#struct){ - shell: (string){ "bash" } - } - } - } - importpr: (#struct){ - "runs-on": (string){ "ubuntu-18.04" } - _#type(:ci): (string){ "importpr" } - if: (string){ "${{ github.event.client_payload.type == 'importpr' }}" } - steps: (#list){ - _#name(:ci): (string){ "Import PR #${{ github.event.client_payload.commit }} from GitHub to Gerrit" } - _#cmd(:ci): (string){ "github-pr ${{ github.event.client_payload.payload.pr }}" } - 0: (#struct){ - name: (string){ "Checkout code" } - uses: (string){ "actions/checkout@v2" } + name: (string){ "Write netrc file for cueckoo Gerrithub" } + run: (string){ "cat < ~/.netrc\nmachine review.gerrithub.io\nlogin cueckoo\npassword ${{ secrets.CUECKOO_GERRITHUB_PASSWORD }}\nEOD\nchmod 600 ~/.netrc" } } 1: (#struct){ - name: (string){ "Import PR #${{ github.event.client_payload.commit }} from GitHub to Gerrit" } - run: (string){ - "cd _scripts\ndocker run --rm -v $PWD/cache:/root/copybara/cache -v $PWD:/usr/src/app --entrypoint=\"\" cueckoo/copybara:afc4ae03eed00b0c9d7415141cd1b5dfa583da7c bash -c \" \\\n\tset -eu; \\\n\techo \\\"${{ secrets.gerritCookie }}\\\" > ~/.gitcookies; \\\n\tchmod 600 ~/.gitcookies; \\\n\tgit config --global user.name cueckoo; \\\n\tgit config --global user.email cueckoo@gmail.com; \\\n\tgit config --global http.cookiefile \\$HOME/.gitcookies; \\\n \techo https://cueckoo:${{ secrets.CUECKOO_GITHUB_PAT }}@github.com > ~/.git-credentials; \\\n\tchmod 600 ~/.git-credentials; \\\n\tjava -jar /opt/copybara/copybara_deploy.jar migrate copy.bara.sky github-pr ${{ github.event.client_payload.payload.pr }}; \\\n\t\"" - _#cmd(:ci): (string){ "github-pr ${{ github.event.client_payload.payload.pr }}" } - } + name: (string){ "Trigger trybot" } + run: (string){ "mkdir tmpgit\ncd tmpgit\ngit init\ngit config user.name cueckoo\ngit config user.email cueckoo@gmail.com\ngit config http.https://github.com/.extraheader \"AUTHORIZATION: basic $(echo -n cueckoo:${{ secrets.CUECKOO_GITHUB_PAT }} | base64)\"\ngit fetch https://review.gerrithub.io/a/cue-lang/cue ${{ github.event.client_payload.payload.ref }}\ngit checkout -b ci/${{ github.event.client_payload.payload.changeID }}/${{ github.event.client_payload.payload.commit }} FETCH_HEAD\ngit push https://github.com/cue-lang/cue ci/${{ github.event.client_payload.payload.changeID }}/${{ github.event.client_payload.payload.commit }}" } } } defaults: (#struct){ @@ -2124,15 +1899,13 @@ import "strings" } } _#runtrybot(:ci): (string){ "runtrybot" } - _#mirror(:ci): (string){ "mirror" } - _#importpr(:ci): (string){ "importpr" } _#unity(:ci): (string){ "unity" } _#dispatchJob(:ci): (#struct){ "runs-on": (string){ "ubuntu-18.04" } _#type(:ci): (string){ string } if: (_|_){ // [incomplete] repository_dispatch._#dispatchJob.if: invalid interpolation: non-concrete value string (type string): - // ./workflows.cue:142:14 + // ./workflows.cue:138:14 } } name: (string){ "Repository Dispatch" } @@ -2140,79 +1913,6 @@ import "strings" 0: (string){ "repository_dispatch" } } } - mirror: (#struct){ - #architecture: (string){ |((string){ "ARM32" }, (string){ "x64" }, (string){ "x86" }) } - #branch: (list){ - 0: (string){ strings.MinRunes(1) } - } - #configuration: ((bool|string|list|struct|number)){ |((string){ string }, (number){ number }, (bool){ bool }, (#struct){ - }, (list){ - }) } - #container: (#struct){ - image: (string){ string } - } - #defaults: (#struct){ - } - #env: (#struct){ - } - #environment: (#struct){ - name: (string){ string } - } - #event: (string){ |((string){ "check_run" }, (string){ "check_suite" }, (string){ "create" }, (string){ "delete" }, (string){ "deployment" }, (string){ "deployment_status" }, (string){ "fork" }, (string){ "gollum" }, (string){ "issue_comment" }, (string){ "issues" }, (string){ "label" }, (string){ "member" }, (string){ "milestone" }, (string){ "page_build" }, (string){ "project" }, (string){ "project_card" }, (string){ "project_column" }, (string){ "public" }, (string){ "pull_request" }, (string){ "pull_request_review" }, (string){ "pull_request_review_comment" }, (string){ "pull_request_target" }, (string){ "push" }, (string){ "registry_package" }, (string){ "release" }, (string){ "status" }, (string){ "watch" }, (string){ "workflow_dispatch" }, (string){ "workflow_run" }, (string){ "repository_dispatch" }) } - #eventObject: ((null|struct)){ |((null){ null }, (#struct){ - }) } - #expressionSyntax: (string){ =~"^\\$\\{\\{.*\\}\\}$" } - #globs: (list){ - 0: (string){ strings.MinRunes(1) } - } - #machine: (string){ |((string){ "linux" }, (string){ "macos" }, (string){ "windows" }) } - #name: (string){ =~"^[_a-zA-Z][a-zA-Z0-9_-]*$" } - #path: (list){ - 0: (string){ strings.MinRunes(1) } - } - #ref: ((null|struct)){ |((null){ null }, (#struct){ - }) } - #shell: (string){ |((string){ string }, (string){ "bash" }, (string){ "pwsh" }, (string){ "python" }, (string){ "sh" }, (string){ "cmd" }, (string){ "powershell" }) } - #types: (list){ - 0: (_){ _ } - } - #: (#struct){ - "working-directory": (string){ string } - } - jobs: (#struct){ - mirror: (#struct){ - "runs-on": (string){ "ubuntu-18.04" } - steps: (#list){ - _#name(:ci): (string){ "Mirror Gerrit to GitHub" } - _#cmd(:ci): (string){ "github" } - 0: (#struct){ - name: (string){ "Checkout code" } - uses: (string){ "actions/checkout@v2" } - } - 1: (#struct){ - name: (string){ "Mirror Gerrit to GitHub" } - run: (string){ - "cd _scripts\ndocker run --rm -v $PWD/cache:/root/copybara/cache -v $PWD:/usr/src/app --entrypoint=\"\" cueckoo/copybara:afc4ae03eed00b0c9d7415141cd1b5dfa583da7c bash -c \" \\\n\tset -eu; \\\n\techo \\\"${{ secrets.gerritCookie }}\\\" > ~/.gitcookies; \\\n\tchmod 600 ~/.gitcookies; \\\n\tgit config --global user.name cueckoo; \\\n\tgit config --global user.email cueckoo@gmail.com; \\\n\tgit config --global http.cookiefile \\$HOME/.gitcookies; \\\n \techo https://cueckoo:${{ secrets.CUECKOO_GITHUB_PAT }}@github.com > ~/.git-credentials; \\\n\tchmod 600 ~/.git-credentials; \\\n\tjava -jar /opt/copybara/copybara_deploy.jar migrate copy.bara.sky github; \\\n\t\"" - _#cmd(:ci): (string){ "github" } - } - } - } - defaults: (#struct){ - run: (#struct){ - shell: (string){ "bash" } - } - } - } - } - name: (string){ "Scheduled repo mirror" } - on: (#struct){ - schedule: (#list){ - 0: (#struct){ - cron: (string){ "*/30 * * * *" } - } - } - } - } release: (#struct){ #architecture: (string){ |((string){ "ARM32" }, (string){ "x64" }, (string){ "x86" }) } #branch: (list){ @@ -2275,7 +1975,7 @@ import "strings" 2: (#struct){ name: (string){ "Run GoReleaser" } env: (#struct){ - GITHUB_TOKEN: (string){ "${{ secrets.ACTIONS_GITHUB_TOKEN }}" } + GITHUB_TOKEN: (string){ "${{ secrets.CUECKOO_GITHUB_PAT }}" } } uses: (string){ "goreleaser/goreleaser-action@v2" } with: (#struct){ @@ -2312,7 +2012,7 @@ import "strings" uses: (string){ "docker/build-push-action@v1" } with: (#struct){ tags: (string){ "${{ env.CUE_VERSION }},latest" } - repository: (string){ "cuelang/cue" } + repository: (string){ "cue-lang/cue" } username: (string){ "${{ secrets.DOCKER_USERNAME }}" } password: (string){ "${{ secrets.DOCKER_PASSWORD }}" } tag_with_ref: (bool){ false } @@ -2453,7 +2153,7 @@ import "strings" steps: (#list){ 0: (#struct){ name: (string){ "Rebuild tip.cuelang.org" } - run: (string){ "curl -f -s -H \"Content-Type: application/json\" -u cueckoo:${{ secrets.CUECKOO_GITHUB_PAT }} --request POST --data-binary \"{\\\"event_type\\\": \\\"Re-test post release of ${GITHUB_REF##refs/tags/}\\\"}\" https://api.github.com/repos/cuelang/cuelang.org/dispatches" } + run: (string){ "curl -f -s -H \"Content-Type: application/json\" -u cueckoo:${{ secrets.CUECKOO_GITHUB_PAT }} --request POST --data-binary \"{\\\"event_type\\\": \\\"Re-test post release of ${GITHUB_REF##refs/tags/}\\\"}\" https://api.github.com/repos/cue-lang/cuelang.org/dispatches" } } 1: (#struct){ name: (string){ "Trigger unity build" } @@ -2552,14 +2252,10 @@ import "strings" "fail-fast": (bool){ false } matrix: (#struct){ "go-version": (#list){ - 0: (string){ "1.14.14" } - 1: (string){ "1.15.8" } - 2: (string){ "1.16" } + 0: (string){ "1.16" } } os: (#list){ 0: (string){ "ubuntu-18.04" } - 1: (string){ "macos-10.15" } - 2: (string){ "windows-2019" } } } } @@ -2568,7 +2264,7 @@ import "strings" name: (string){ "Set go build tags" } run: (_|_){ // [incomplete] _#setGoBuildTags.run: invalid interpolation: non-concrete value string (type string): - // ./workflows.cue:305:10 + // ./workflows.cue:269:10 } } _#installGo(:ci): (#struct){ @@ -2613,16 +2309,16 @@ import "strings" name: (string){ "Check that git is clean post generate and tests" } run: (string){ "test -z \"$(git status --porcelain)\" || (git status; git diff; false)" } } - _#writeCookiesFile(:ci): (#struct){ - name: (string){ "Write the gitcookies file" } - run: (string){ "echo \"${{ secrets.gerritCookie }}\" > ~/.gitcookies" } + _#writeNetrcFile(:ci): (#struct){ + name: (string){ "Write netrc file for cueckoo Gerrithub" } + run: (string){ "cat < ~/.netrc\nmachine review.gerrithub.io\nlogin cueckoo\npassword ${{ secrets.CUECKOO_GERRITHUB_PASSWORD }}\nEOD\nchmod 600 ~/.netrc" } } _#branchRefPrefix(:ci): (string){ "refs/heads/" } _#tempCueckooGitDir(:ci): (string){ "mkdir tmpgit\ncd tmpgit\ngit init\ngit config user.name cueckoo\ngit config user.email cueckoo@gmail.com\ngit config http.https://github.com/.extraheader \"AUTHORIZATION: basic $(echo -n cueckoo:${{ secrets.CUECKOO_GITHUB_PAT }} | base64)\"" } _#cueckooCopybaraImage(:ci): (string){ "cueckoo/copybara:afc4ae03eed00b0c9d7415141cd1b5dfa583da7c" } _#copybaraCmd(:ci): (_|_){ // [incomplete] _#copybaraCmd: invalid interpolation: non-concrete value string (type string): - // ./workflows.cue:372:2 + // ./workflows.cue:343:2 _#cmd(:ci): (string){ string } } _#copybaraSteps(:ci): (#list){ @@ -2636,7 +2332,7 @@ import "strings" name: (string){ string } run: (_|_){ // [incomplete] _#copybaraSteps.1.run: invalid interpolation: non-concrete value string (type string): - // ./workflows.cue:372:2 + // ./workflows.cue:343:2 _#cmd(:ci): (string){ string } } } @@ -2675,10 +2371,6 @@ import "strings" file: "new_version_triggers.yml" schema: 〈1;new_version_triggers〉 }, - { - file: "mirror.yml" - schema: 〈1;mirror〉 - }, ]) test: (〈0;_#bashWorkflow〉 & { name: "Test" @@ -2691,6 +2383,7 @@ import "strings" 〈3;_#releaseTagPattern〉, ] } + pull_request: {} } jobs: { start: { @@ -2700,7 +2393,7 @@ import "strings" if: "${{ \(〈3;_#isCLCITestBranch〉) }}" }), ] & [ - 〈3;_#writeCookiesFile〉, + 〈3;_#writeNetrcFile〉, 〈2;_#startCLBuild〉, ]) } @@ -2709,7 +2402,7 @@ import "strings" strategy: 〈3;_#testStrategy〉 "runs-on": "${{ matrix.os }}" steps: [ - 〈3;_#writeCookiesFile〉, + 〈3;_#writeNetrcFile〉, 〈3;_#installGo〉, 〈3;_#checkoutCode〉, 〈3;_#cacheGoModules〉, @@ -2719,12 +2412,8 @@ import "strings" }), 〈3;_#goGenerate〉, 〈3;_#goTest〉, - (〈3;_#goTestRace〉 & { - if: "${{ \(〈3;_#isMaster〉) || \(〈3;_#isCLCITestBranch〉) && matrix.go-version == '\(〈4;_#latestStableGo〉)' && matrix.os == '\(〈4;_#linuxMachine〉)' }}" - }), 〈3;_#goReleaseCheck〉, 〈3;_#checkGitClean〉, - 〈2;_#pullThroughProxy〉, 〈2;_#failCLBuild〉, ] } @@ -2733,7 +2422,7 @@ import "strings" if: "${{ \(〈2;_#isCLCITestBranch〉) }}" needs: "test" steps: [ - 〈3;_#writeCookiesFile〉, + 〈3;_#writeNetrcFile〉, 〈2;_#passCLBuild〉, ] } @@ -2744,7 +2433,7 @@ import "strings" steps: [ (〈3;_#step〉 & { run: "\(〈4;_#tempCueckooGitDir〉) - git push https://github.com/cuelang/cue :${GITHUB_REF#\(〈4;_#branchRefPrefix〉)}" + git push https://github.com/cue-lang/cue :${GITHUB_REF#\(〈4;_#branchRefPrefix〉)}" }), ] } @@ -2771,7 +2460,7 @@ import "strings" #args: { message: "Build failed for ${{ runner.os }}-${{ matrix.go-version }}; see ${{ github.event.repository.html_url }}/actions/runs/${{ github.run_id }} for more details" labels: { - "Code-Review": -1 + "TryBot-Result": -1 } } }).res @@ -2782,7 +2471,7 @@ import "strings" #args: { message: "Build succeeded for ${{ github.event.repository.html_url }}/actions/runs/${{ github.run_id }}" labels: { - "Code-Review": 1 + "TryBot-Result": 1 } } }).res @@ -2793,17 +2482,15 @@ import "strings" tag: "trybot" message: string labels?: { - "Code-Review": int + "TryBot-Result": int } } - res: "\(〈3;_#curl〉) -H "Content-Type: application/json" --request POST --data '\(〈import;"encoding/json"〉.Marshal(〈0;#args〉))' -b ~/.gitcookies https://cue-review.googlesource.com/a/changes/$(basename $(dirname $GITHUB_REF))/revisions/$(basename $GITHUB_REF)/review" + res: "\(〈3;_#curl〉) -n -H "Content-Type: application/json" --request POST --data '\(〈import;"encoding/json"〉.Marshal(〈0;#args〉))' https://review.gerrithub.io/a/changes/$(basename $(dirname $GITHUB_REF))/revisions/$(basename $GITHUB_REF)/review" } } }) repository_dispatch: (〈0;_#bashWorkflow〉 & { _#runtrybot: "runtrybot" - _#mirror: "mirror" - _#importpr: "importpr" _#unity: "unity" _#dispatchJob: (〈1;_#job〉 & { _#type: string @@ -2818,51 +2505,16 @@ import "strings" "\(〈1;_#runtrybot〉)": (〈1;_#dispatchJob〉 & { _#type: 〈2;_#runtrybot〉 steps: [ + 〈3;_#writeNetrcFile〉, (〈3;_#step〉 & { name: "Trigger trybot" run: "\(〈4;_#tempCueckooGitDir〉) - git fetch https://cue-review.googlesource.com/cue ${{ github.event.client_payload.payload.ref }} + git fetch https://review.gerrithub.io/a/cue-lang/cue ${{ github.event.client_payload.payload.ref }} git checkout -b ci/${{ github.event.client_payload.payload.changeID }}/${{ github.event.client_payload.payload.commit }} FETCH_HEAD - git push https://github.com/cuelang/cue ci/${{ github.event.client_payload.payload.changeID }}/${{ github.event.client_payload.payload.commit }}" + git push https://github.com/cue-lang/cue ci/${{ github.event.client_payload.payload.changeID }}/${{ github.event.client_payload.payload.commit }}" }), ] }) - "\(〈1;_#mirror〉)": (〈1;_#dispatchJob〉 & { - _#type: 〈2;_#mirror〉 - steps: (〈3;_#copybaraSteps〉 & { - _ - _#name: "Mirror Gerrit to GitHub" - _#cmd: "github" - }) - }) - "\(〈1;_#importpr〉)": (〈1;_#dispatchJob〉 & { - _#type: 〈2;_#importpr〉 - steps: (〈3;_#copybaraSteps〉 & { - _ - _#name: "Import PR #${{ github.event.client_payload.commit }} from GitHub to Gerrit" - _#cmd: "github-pr ${{ github.event.client_payload.payload.pr }}" - }) - }) - } - }) - mirror: (〈0;_#bashWorkflow〉 & { - name: "Scheduled repo mirror" - on: { - schedule: [ - { - cron: "*/30 * * * *" - }, - ] - } - jobs: { - mirror: { - "runs-on": 〈3;_#linuxMachine〉 - steps: (〈3;_#copybaraSteps〉 & { - _ - _#name: "Mirror Gerrit to GitHub" - _#cmd: "github" - }) - } } }) release: (〈0;_#bashWorkflow〉 & { @@ -2891,7 +2543,7 @@ import "strings" (〈3;_#step〉 & { name: "Run GoReleaser" env: { - GITHUB_TOKEN: "${{ secrets.ACTIONS_GITHUB_TOKEN }}" + GITHUB_TOKEN: "${{ secrets.CUECKOO_GITHUB_PAT }}" } uses: "goreleaser/goreleaser-action@v2" with: { @@ -2920,7 +2572,7 @@ import "strings" uses: "docker/build-push-action@v1" with: { tags: "${{ env.CUE_VERSION }},latest" - repository: "cuelang/cue" + repository: "cue-lang/cue" username: "${{ secrets.DOCKER_USERNAME }}" password: "${{ secrets.DOCKER_PASSWORD }}" tag_with_ref: false @@ -2975,7 +2627,7 @@ import "strings" steps: [ { name: "Rebuild tip.cuelang.org" - run: "\(〈4;_#curl〉) -H "Content-Type: application/json" -u cueckoo:${{ secrets.CUECKOO_GITHUB_PAT }} --request POST --data-binary "{\"event_type\": \"Re-test post release of ${GITHUB_REF##refs/tags/}\"}" https://api.github.com/repos/cuelang/cuelang.org/dispatches" + run: "\(〈4;_#curl〉) -H "Content-Type: application/json" -u cueckoo:${{ secrets.CUECKOO_GITHUB_PAT }} --request POST --data-binary "{\"event_type\": \"Re-test post release of ${GITHUB_REF##refs/tags/}\"}" https://api.github.com/repos/cue-lang/cuelang.org/dispatches" }, { name: "Trigger unity build" @@ -3013,14 +2665,10 @@ import "strings" "fail-fast": false matrix: { "go-version": [ - 〈2;_#codeGenGo〉, - 〈2;_#latestStableGo〉, "1.16", ] os: [ 〈2;_#linuxMachine〉, - 〈2;_#macosMachine〉, - 〈2;_#windowsMachine〉, ] } } @@ -3071,9 +2719,9 @@ import "strings" name: "Check that git is clean post generate and tests" run: "test -z \"$(git status --porcelain)\" || (git status; git diff; false)" }) - _#writeCookiesFile: (〈0;_#step〉 & { - name: "Write the gitcookies file" - run: "echo \"${{ secrets.gerritCookie }}\" > ~/.gitcookies" + _#writeNetrcFile: (〈0;_#step〉 & { + name: "Write netrc file for cueckoo Gerrithub" + run: "cat < ~/.netrc\nmachine review.gerrithub.io\nlogin cueckoo\npassword ${{ secrets.CUECKOO_GERRITHUB_PASSWORD }}\nEOD\nchmod 600 ~/.netrc" }) _#branchRefPrefix: "refs/heads/" _#tempCueckooGitDir: "mkdir tmpgit\ncd tmpgit\ngit init\ngit config user.name cueckoo\ngit config user.email cueckoo@gmail.com\ngit config http.https://github.com/.extraheader \"AUTHORIZATION: basic $(echo -n cueckoo:${{ secrets.CUECKOO_GITHUB_PAT }} | base64)\"" @@ -3082,13 +2730,11 @@ import "strings" "cd _scripts docker run --rm -v $PWD/cache:/root/copybara/cache -v $PWD:/usr/src/app --entrypoint="" \(〈1;_#cueckooCopybaraImage〉) bash -c " \ set -eu; \ - echo \"${{ secrets.gerritCookie }}\" > ~/.gitcookies; \ - chmod 600 ~/.gitcookies; \ git config --global user.name cueckoo; \ - git config --global user.email cueckoo@gmail.com; \ - git config --global http.cookiefile \$HOME/.gitcookies; \ - echo https://cueckoo:${{ secrets.CUECKOO_GITHUB_PAT }}@github.com > ~/.git-credentials; \ - chmod 600 ~/.git-credentials; \ + git config --global user.email cueckoo@cuelang.org; \ + echo machine github.com login cueckoo password ${{ secrets.CUECKOO_GITHUB_PAT }} >> ~/.netrc; \ + echo machine review.gerrithub.io login cueckoo password ${{ secrets.CUECKOO_GERRITHUB_PASSWORD }} >> ~/.netrc; \ + chmod 600 ~/.netrc; \ java -jar /opt/copybara/copybara_deploy.jar migrate copy.bara.sky \(〈0;_#cmd〉); \ "" _#cmd: string diff --git a/cue/types.go b/cue/types.go index 7957c15484d..e055c2b7dee 100644 --- a/cue/types.go +++ b/cue/types.go @@ -989,7 +989,7 @@ Value: %v You could file a bug with the above information at: - https://github.com/cuelang/cue/issues/new?assignees=&labels=NeedsInvestigation&template=bug_report.md&title=. + https://github.com/cue-lang/cue/issues/new?assignees=&labels=NeedsInvestigation&template=bug_report.md&title=. ` cg := &ast.CommentGroup{Doc: true} msg := fmt.Sprintf(format, name, err, p, v) diff --git a/doc/cmd/cue.md b/doc/cmd/cue.md index 6c39bf3a2cb..524523f2b44 100644 --- a/doc/cmd/cue.md +++ b/doc/cmd/cue.md @@ -6,4 +6,4 @@ how to convert other formats like JSON and YAML to CUE, and `cue help filetypes` describes the `cue` command's support for various file types. We do plan to provide a web-based version of these various help topics, -something that is tracked by [#9](https://github.com/cuelang/cue/issues/9). +something that is tracked by [#9](https://cuelang.org/issue/9). diff --git a/doc/contribute.md b/doc/contribute.md index 200dd0fa189..fb0950cfc0d 100644 --- a/doc/contribute.md +++ b/doc/contribute.md @@ -16,71 +16,32 @@ We assume you have a basic understanding of Git and Go. The first step is registering as a CUE contributor and configuring your environment. Here is a checklist of the required steps to follow: - -- **Step 0**: Decide on a single Google Account you will be using to contribute to CUE. -Use that account for all the following steps and make sure that `git` -is configured to create commits with that account's e-mail address. -- **Step 1**: [Sign and submit](https://cla.developers.google.com/clas) a -CLA (Contributor License Agreement). -- **Step 2**: Configure authentication credentials for the CUE Git repository. -Visit -[cue.googlesource.com](https://cue.googlesource.com), click -on "Generate Password" (top right), and follow the instructions. -- **Step 3**: Register for Gerrit, the code review tool used by the CUE team, -by [visiting this page](https://cue-review.googlesource.com/login/). -The CLA and the registration need to be done only once for your account. -- **Step 4**: Install `git-codereview` by running: `GO111MODULE=on go get +- **Step 0**: Decide which email address you want to use for contributions. +- **Step 1**: Read and prepare for asserting a Developer Certificate of Origin. +- **Step 2**: Set up a [GerritHub](http://gerrithub.io/) account. +- **Step 3**: Install `git-codereview` by running: `GO111MODULE=on go get golang.org/x/review/git-codereview` (or just `go install golang.org/x/review/git-codereview@latest` if you are using Go 1.16) - - - - - -The rest of this chapter elaborates on these instructions. -If you have completed the steps above (either manually or through the tool), jump to -Before contributing code. - - -### Step 0: Select a Google Account +Note that if you plan to contribute via GitHub, only Steps 0 and 1 are required. -A contribution to CUE is made through a Google account with a specific -e-mail address. -Make sure to use the same account throughout the process and -for all your subsequent contributions. -You may need to decide whether to use a personal address or a corporate address. -The choice will depend on who -will own the copyright for the code that you will be writing -and submitting. -You might want to discuss this topic with your employer before deciding which -account to use. +The rest of this chapter elaborates on these instructions. If you have +completed the steps above (either manually or through the tool), jump to "Before +contributing code." +### Step 0: Decide which email address you want to use for contributions -Google accounts can either be Gmail e-mail accounts, G Suite organization accounts, or -accounts associated with an external e-mail address. -For instance, if you need to use -an existing corporate e-mail that is not managed through G Suite, you can create -an account associated -[with your existing -e-mail address](https://accounts.google.com/SignUpWithoutGmail). - +A contribution to CUE is made through a specific e-mail address. Make sure to +use the same account throughout the process and for all your subsequent +contributions. You may need to decide whether to use a personal address or a +corporate address. The choice will depend on who will own the copyright for the +code that you will be writing and submitting. You might want to discuss this +topic with your employer before deciding which account to use. You also need to make sure that your Git tool is configured to create commits -using your chosen e-mail address. -You can either configure Git globally -(as a default for all projects), or locally (for a single specific project). -You can check the current configuration with this command: +using your chosen e-mail address. You can either configure Git globally (as a +default for all projects), or locally (for a single specific project). You can +check the current configuration with this command: ``` @@ -96,82 +57,98 @@ $ git config --global user.email name@example.com # change global config $ git config user.email name@example.com # change local config ``` +If the copyright holder for the code you are submitting changes—for +example, if you start contributing code on behalf of a new company—please +send mail to the [CUE Owners](mailto:owners@cuelang.org). This will let us know +the situation so we can make sure an appropriate agreement is completed and +update the `AUTHORS` file. + +### Step 1: Read and prepare for asserting a Developer Certificate of Origin -### Step 1: Contributor License Agreement +Contributions to the CUE project must be accompanied by a [Developer Certificate +of Origin](https://developercertificate.org/), the text of which is reproduced +here for convenience: -Before sending your first change to the CUE project -you must have completed one of the following two CLAs. -Which CLA you should sign depends on who owns the copyright to your work. +``` +Developer Certificate of Origin +Version 1.1 +Copyright (C) 2004, 2006 The Linux Foundation and its contributors. +1 Letterman Drive +Suite D4700 +San Francisco, CA, 94129 -- If you are the copyright holder, you will need to agree to the -[individual contributor license agreement](https://developers.google.com/open-source/cla/individual), -which can be completed online. -- If your organization is the copyright holder, the organization -will need to agree to the -[corporate -contributor license agreement](https://developers.google.com/open-source/cla/corporate). +Everyone is permitted to copy and distribute verbatim copies of this +license document, but changing it is not allowed. -You can check your currently signed agreements and sign new ones at -the -[Google Developers Contributor License Agreements](https://cla.developers.google.com/clas?pli=1&authuser=1) website. -If the copyright holder for your contribution has already completed the -agreement in connection with another Google open source project, -it does not need to be completed again. +Developer's Certificate of Origin 1.1 -If the copyright holder for the code you are submitting changes—for example, -if you start contributing code on behalf of a new company—please send mail -to the [`cue-dev` mailing list](mailto:cue-dev@googlegroups.com). -This will let us know the situation so we can make sure an appropriate agreement is -completed and update the `AUTHORS` file. +By making a contribution to this project, I certify that: +(a) The contribution was created in whole or in part by me and I + have the right to submit it under the open source license + indicated in the file; or +(b) The contribution is based upon previous work that, to the best + of my knowledge, is covered under an appropriate open source + license and I have the right under that license to submit that + work with modifications, whether created in whole or in part + by me, under the same open source license (unless I am + permitted to submit under a different license), as indicated + in the file; or -### Step 2: Configure git authentication +(c) The contribution was provided directly to me by some other + person who certified (a), (b) or (c) and I have not modified + it. -The remaining two steps only apply if you wish to contribute through Gerrit, -which is the source of truth for the CUE project. You can also send Pull -Requests to the mirror at https://github.com/cuelang/cue. +(d) I understand and agree that this project and the contribution + are public and that a record of the contribution (including all + personal information I submit with it, including my sign-off) is + maintained indefinitely and may be redistributed consistent with + this project or the open source license(s) involved. +``` -The main CUE repository is located at -[cue.googlesource.com](https://cue.googlesource.com), -a Git server hosted by Google. -Authentication on the web server is made through your Google account, but -you also need to configure `git` on your computer to access it. -Follow this steps: +All commit messages must contain the `Signed-off-by` line with an email address +that matches the commit author. When commiting, use the `--signoff` flag: +``` +git commit -s +``` -- Visit [cue.googlesource.com](https://cue.googlesource.com) -and click on "Generate Password" in the page's top right menu bar. -You will be redirected to accounts.google.com to sign in. -- After signing in, you will be taken to a page with the title "Configure Git". -This page contains a personalized script that when run locally will configure Git -to hold your unique authentication key. -This key is paired with one that is generated and stored on the server, -analogous to how SSH keys work. -- Copy and run this script locally in your terminal to store your secret -authentication token in a `.gitcookies` file. -If you are using a Windows computer and running `cmd`, -you should instead follow the instructions in the yellow box to run the command; -otherwise run the regular script. +### Step 2: Setup a GerritHub account -### Step 3: Create a Gerrit account +If you have not used GerritHub before, setting up an account is a simple +process: -Gerrit is an open-source tool used by CUE maintainers to discuss and review -code submissions. +- Visit [GerritHub](http://gerrithub.io/). +- Click "First Time Sign In". +- Clickt the green "Sign In" button, to sign in using your GitHub + credentials. +- When prompted "Which level of GitHub access do you need?", choose + "Default" and then click "Login." +- Click "Authorize gerritforge-ltd" on the GitHub auth page. +- Confirm account profile details and click "Next." +If you want to use SSH for authentication, SSH keys can be [configured in your +user profile](https://review.gerrithub.io/settings/#SSHKeys). -To register your account, visit -[cue-review.googlesource.com/login/](https://cue-review.googlesource.com/login/) -and sign in once using the same Google Account you used above. +For HTTP Credentials, [generate a password via your user +profile](https://review.gerrithub.io/settings/#HTTPCredentials). Then use an +existing HTTP authentication mechanism like `.netrc`, macOS KeyChain, or some +other [crendential helper](https://git-scm.com/docs/gitcredentials). If you have +any troubles with this step, please [raise an +issue](https://github.com/cue-lang/cue/issues/new). +Then visit https://review.gerrithub.io/admin/repos/cue-lang/cue, then click +"HTTP" or "SSH" then copy the corresponding "Clone" command. -### Step 4: Install the git-codereview command -Changes to CUE must be reviewed before they are accepted, no matter who makes the change. -A custom `git` command called `git-codereview` -simplifies sending changes to Gerrit. +### Step 3: Install the git-codereview command + +Changes to CUE must be reviewed before they are accepted, no matter who makes +the change. A custom `git` command called `git-codereview` simplifies sending +changes to Gerrit. @@ -205,7 +182,6 @@ Run `git --exec-path` to discover the right location then create a symbolic link or just copy the executable from $GOPATH/bin to this directory. - ## Before contributing code