From 669ac97d9eb8c0f67e80959791c9fe86504b783e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rados=C5=82aw=20Wa=C5=9Bko?= Date: Wed, 9 Oct 2024 17:02:54 +0200 Subject: [PATCH] Clean up credentials file after E2E job. (#11285) - While #11255 fixes the root cause of #11278, this PR fixes what triggered it - since #11198 our runners were keeping `~/.enso/credentials` file between runs, meaning that some tests were unexpectedly running in 'authenticated' mode. This PR cleans up this file to avoid that. --- .github/workflows/gui.yml | 9 +++++++++ build/build/src/ci_gen/job.rs | 10 ++++++++++ 2 files changed, 19 insertions(+) diff --git a/.github/workflows/gui.yml b/.github/workflows/gui.yml index 33db30f043d4..88dea539e78c 100644 --- a/.github/workflows/gui.yml +++ b/.github/workflows/gui.yml @@ -372,6 +372,9 @@ jobs: ENSO_TEST_USER: ${{ secrets.ENSO_CLOUD_TEST_ACCOUNT_USERNAME }} ENSO_TEST_USER_PASSWORD: ${{ secrets.ENSO_CLOUD_TEST_ACCOUNT_PASSWORD }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - run: rm $HOME/.enso/credentials + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - if: failure() && runner.os == 'Windows' name: List files if failed (Windows) run: Get-ChildItem -Force -Recurse @@ -441,6 +444,9 @@ jobs: ENSO_TEST_USER: ${{ secrets.ENSO_CLOUD_TEST_ACCOUNT_USERNAME }} ENSO_TEST_USER_PASSWORD: ${{ secrets.ENSO_CLOUD_TEST_ACCOUNT_PASSWORD }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - run: rm $HOME/.enso/credentials + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - if: failure() && runner.os == 'Windows' name: List files if failed (Windows) run: Get-ChildItem -Force -Recurse @@ -506,6 +512,9 @@ jobs: ENSO_TEST_USER: ${{ secrets.ENSO_CLOUD_TEST_ACCOUNT_USERNAME }} ENSO_TEST_USER_PASSWORD: ${{ secrets.ENSO_CLOUD_TEST_ACCOUNT_PASSWORD }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - run: rm $HOME/.enso/credentials + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - if: failure() && runner.os == 'Windows' name: List files if failed (Windows) run: Get-ChildItem -Force -Recurse diff --git a/build/build/src/ci_gen/job.rs b/build/build/src/ci_gen/job.rs index 35ecee1e2ae3..bf8d4f8f5b21 100644 --- a/build/build/src/ci_gen/job.rs +++ b/build/build/src/ci_gen/job.rs @@ -547,6 +547,16 @@ impl JobArchetype for PackageIde { "ENSO_TEST_USER_PASSWORD", ); steps.push(test_step); + + // After the E2E tests run, they create a credentials file in user home directory. + // If that file is not cleaned up, future runs of our tests may randomly get + // authenticated into Enso Cloud. We want to run tests as an authenticated + // user only when we explicitly set that up, not randomly. So we clean the credentials + // file. + let cloud_credentials_path = "$HOME/.enso/credentials"; + let cleanup_credentials_step = shell(format!("rm {cloud_credentials_path}")); + steps.push(cleanup_credentials_step); + steps }) .build_job("Package New IDE", target)