From ec655a5f33f9f506bac7cb87e87fd2e0d8b5c832 Mon Sep 17 00:00:00 2001 From: Paul Jolly Date: Thu, 21 Mar 2024 04:50:08 +0000 Subject: [PATCH] internal/_e2e: rename CUE_LOGINS to CUE_TEST_LOGINS MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Whilst preparing to write a guide for the central registry, I was examining the pattern used by the e2e tests for performing a headless 'cue login'. This led me to the CI setup, where the env var CUE_LOGINS is set in order to control the behaviour of the e2e tests. Specifically, the contents of CUE_LOGINS is written to $CUE_CONFIG_DIR/logins.json. The naming of this environment variable is, however, rather unfortunate. Because at first glance it's not clear it should only ever be used in a test situation. Rename CUE_LOGINS to CUE_TEST_LOGINS to make sure we don't regress and ever use this environment variable for anything non-test. Signed-off-by: Paul Jolly Change-Id: I0deec96b5bf13422b9ef23a80467ee8d55377233 Reviewed-on: https://review.gerrithub.io/c/cue-lang/cue/+/1185463 Reviewed-by: Daniel Martí TryBot-Result: CUEcueckoo Unity-Result: CUE porcuepine --- .github/workflows/trybot.yml | 2 +- internal/_e2e/script_test.go | 4 ++-- internal/_e2e/testdata/script/github_app_private.txtar | 2 +- internal/_e2e/testdata/script/github_app_public.txtar | 2 +- internal/ci/github/trybot.cue | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/trybot.yml b/.github/workflows/trybot.yml index 9df273c6f..a7004a485 100644 --- a/.github/workflows/trybot.yml +++ b/.github/workflows/trybot.yml @@ -184,7 +184,7 @@ jobs: Dispatch-Trailer: {"type":"')))) && (matrix.go-version == '1.22.x' && matrix.runner == 'ubuntu-22.04') name: End-to-end test env: - CUE_LOGINS: ${{ secrets.E2E_CUE_LOGINS }} + CUE_TEST_LOGINS: ${{ secrets.E2E_CUE_LOGINS }} run: |- cd internal/_e2e go test -race diff --git a/internal/_e2e/script_test.go b/internal/_e2e/script_test.go index e3c22e1f1..eec6feef7 100644 --- a/internal/_e2e/script_test.go +++ b/internal/_e2e/script_test.go @@ -102,9 +102,9 @@ func TestScript(t *testing.T) { configDir := filepath.Join(env.WorkDir, "tmp/configdir") env.Setenv("CUE_CONFIG_DIR", configDir) - // CUE_LOGINS is a secret used by the scripts publishing to registry.cue.works. + // CUE_TEST_LOGINS is a secret used by the scripts publishing to registry.cue.works. // When unset, those tests would fail with an auth error. - if logins := os.Getenv("CUE_LOGINS"); logins != "" { + if logins := os.Getenv("CUE_TEST_LOGINS"); logins != "" { if err := os.MkdirAll(configDir, 0o777); err != nil { return err } diff --git a/internal/_e2e/testdata/script/github_app_private.txtar b/internal/_e2e/testdata/script/github_app_private.txtar index 00ffd9c42..0f8cc4978 100644 --- a/internal/_e2e/testdata/script/github_app_private.txtar +++ b/internal/_e2e/testdata/script/github_app_private.txtar @@ -1,5 +1,5 @@ # Publish a CUE module under a private GitHub repository namespace -# where the $CUE_LOGINS tokens have full read-write access. +# where the $CUE_TEST_LOGINS tokens have full read-write access. # Publish a version for this new repository with `cue mod publish`, # and then fetch the module as a dependency via cmd/cue. diff --git a/internal/_e2e/testdata/script/github_app_public.txtar b/internal/_e2e/testdata/script/github_app_public.txtar index e47797da5..e7f029420 100644 --- a/internal/_e2e/testdata/script/github_app_public.txtar +++ b/internal/_e2e/testdata/script/github_app_public.txtar @@ -1,5 +1,5 @@ # Publish a CUE module under a public GitHub repository namespace -# where the $CUE_LOGINS tokens have full read-write access. +# where the $CUE_TEST_LOGINS tokens have full read-write access. # Publish a version for this new repository with `cue mod publish`, # and then fetch the module as a dependency via cmd/cue. diff --git a/internal/ci/github/trybot.cue b/internal/ci/github/trybot.cue index 19866382c..064dd43ad 100644 --- a/internal/ci/github/trybot.cue +++ b/internal/ci/github/trybot.cue @@ -142,7 +142,7 @@ workflows: trybot: _repo.bashWorkflow & { // on the entire cue-labs-modules-testing org. Note that porcuepine is also an org admin, // since otherwise the repo admin access to create and delete repos does not work. env: { - CUE_LOGINS: "${{ secrets.E2E_CUE_LOGINS }}" + CUE_TEST_LOGINS: "${{ secrets.E2E_CUE_LOGINS }}" } // Our regular tests run with both `go test ./...` and `go test -race ./...`. // The end-to-end tests should only be run once, given the slowness and API rate limits.