Skip to content

Commit ea05072

Browse files
authored
Merge branch 'cue-lang:master' into master
2 parents e0b5216 + 5ffd573 commit ea05072

File tree

100 files changed

+15000
-3697
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

100 files changed

+15000
-3697
lines changed

.github/workflows/release.yaml

+7-3
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ jobs:
5757
uses: actions/setup-go@v5
5858
with:
5959
cache: false
60-
go-version: 1.23.0
60+
go-version: 1.23.2
6161
- name: Set common go env vars
6262
run: |-
6363
go env -w GOTOOLCHAIN=local
@@ -80,11 +80,15 @@ jobs:
8080
uses: goreleaser/goreleaser-action@v5
8181
with:
8282
install-only: true
83-
version: v2.2.0
83+
version: v2.3.2
8484
- name: Run GoReleaser with CUE
8585
env:
86+
CUE_LOGINS: ${{ secrets.NOTCUECKOO_CUE_LOGINS }}
8687
GITHUB_TOKEN: ${{ secrets.CUECKOO_GITHUB_PAT }}
87-
run: cue cmd release
88+
run: |-
89+
export CUE_CONFIG_DIR=$(mktemp -d)
90+
echo "$CUE_LOGINS" > $CUE_CONFIG_DIR/logins.json
91+
cue cmd release
8892
working-directory: ./internal/ci/goreleaser
8993
- name: Re-test cuelang.org
9094
if: startsWith(github.ref, 'refs/tags/v')

.github/workflows/trybot.yaml

+7-2
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ jobs:
137137
uses: google-github-actions/setup-gcloud@v2
138138
- name: End-to-end test
139139
env:
140-
CUE_TEST_LOGINS: ${{ secrets.E2E_CUE_LOGINS }}
140+
CUE_TEST_LOGINS: ${{ secrets.E2E_PORCUEPINE_CUE_LOGINS }}
141141
if: |-
142142
github.repository == 'cue-lang/cue' && (((github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/heads/release-branch.')) && (! (contains(github.event.head_commit.message, '
143143
Dispatch-Trailer: {"type":"')))) || (github.ref == 'refs/heads/ci/test')) && (matrix.go-version == '1.23.x' && matrix.runner == 'ubuntu-22.04')
@@ -167,7 +167,12 @@ jobs:
167167
exit 1
168168
fi
169169
- name: Generate
170-
run: go generate ./...
170+
env:
171+
CUE_LOGINS: ${{ secrets.NOTCUECKOO_CUE_LOGINS }}
172+
run: |-
173+
export CUE_CONFIG_DIR=$(mktemp -d)
174+
echo "$CUE_LOGINS" > $CUE_CONFIG_DIR/logins.json
175+
go generate ./...
171176
if: (matrix.go-version == '1.23.x' && matrix.runner == 'ubuntu-22.04')
172177
- name: Check that git is clean at the end of the job
173178
if: always()

cmd/cue/cmd/login.go

+7-1
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ import (
1919
"fmt"
2020
"net/http"
2121
"os"
22+
"time"
2223

2324
"github.com/spf13/cobra"
2425
"golang.org/x/oauth2"
@@ -97,8 +98,13 @@ inside $CUE_CONFIG_DIR; see 'cue help environment'.
9798
return fmt.Errorf("cannot obtain the OAuth2 token: %v", err)
9899
}
99100

100-
_, err = cueconfig.UpdateRegistryLogin(loginsPath, host.Name, tok)
101+
// For consistency, store timestamps in UTC.
102+
tok.Expiry = tok.Expiry.UTC()
103+
// OAuth2 measures expiry in seconds via the expires_in JSON wire format field,
104+
// so any sub-second units add unnecessary verbosity.
105+
tok.Expiry = tok.Expiry.Truncate(time.Second)
101106

107+
_, err = cueconfig.UpdateRegistryLogin(loginsPath, host.Name, tok)
102108
if err != nil {
103109
return fmt.Errorf("cannot store CUE registry logins: %v", err)
104110
}

cmd/cue/cmd/script_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -518,7 +518,7 @@ func newMockRegistryOauth(mode string) *httptest.Server {
518518
writeJSON(w, http.StatusOK, oauth2.Token{
519519
AccessToken: staticAccessToken,
520520
TokenType: "Bearer",
521-
Expiry: time.Now().Add(time.Hour),
521+
ExpiresIn: int64(time.Hour / time.Second), // 1h in seconds
522522
})
523523
default:
524524
panic(fmt.Sprintf("unknown mode: %q", mode))

cmd/cue/cmd/testdata/script/login_immediate.txtar

+12-1
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,15 @@ oauthregistry immediate-success
66

77
exec cue login
88
stdout 'open:.*user_code=user-code'
9-
grep 'secret-access-token' cueconfig/logins.json
9+
10+
# Ensure that only one token is stored.
11+
grep -count=1 '"registries": {' cueconfig/logins.json
12+
grep -count=1 '"access_token"' cueconfig/logins.json
13+
14+
# Ensure the contents of the token look correct.
15+
grep -count=1 '"access_token": "secret-access-token"' cueconfig/logins.json
16+
grep -count=1 '"token_type": "Bearer"' cueconfig/logins.json
17+
# Timestamps are always stored in UTC and truncated to seconds.
18+
grep '"expiry": "20..-..-..T..:..:..Z"' cueconfig/logins.json
19+
# oauthregistry does not give a refresh token, and we use encoding/json's omitempty.
20+
! grep '"refresh_token"' cueconfig/logins.json

cue.mod/module.cue

+6
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,9 @@ module: "cuelang.org/go"
22
language: {
33
version: "v0.8.0"
44
}
5+
deps: {
6+
"github.com/cue-tmp/jsonschema-pub/exp1/githubactions@v0": {
7+
v: "v0.3.0"
8+
default: true
9+
}
10+
}

0 commit comments

Comments
 (0)