From 4cde19a003d09cf75114ec8650020b132bbc5554 Mon Sep 17 00:00:00 2001 From: Jonathan Date: Fri, 18 Oct 2024 13:53:40 -0700 Subject: [PATCH] Enable kernel supervisor download in Github workflows (#5053) Enables downloads for the kernel supervisor to prepare for running tests against it. Most of the work here is generating a temporary PAT to use to download the supervisor. It is somewhat duplicative to generate the PAT outside the composite action and pass it in every time, but composite actions don't support secrets (unlike reusable workflows) and it feels safer to push an ephemeral PAT into here than all the data we need to actually generate one. --- extensions/kallichore-adapter/package.json | 2 +- .../scripts/install-kallichore-server.ts | 22 ++++++------------- .../src/test/server.test.ts | 6 ----- 3 files changed, 8 insertions(+), 22 deletions(-) diff --git a/extensions/kallichore-adapter/package.json b/extensions/kallichore-adapter/package.json index 39961d969c0..cc3064401be 100644 --- a/extensions/kallichore-adapter/package.json +++ b/extensions/kallichore-adapter/package.json @@ -84,7 +84,7 @@ }, "positron": { "binaryDependencies": { - "kallichore": "0.1.11" + "kallichore": "0.1.13" } }, "dependencies": { diff --git a/extensions/kallichore-adapter/scripts/install-kallichore-server.ts b/extensions/kallichore-adapter/scripts/install-kallichore-server.ts index 8ee10c18160..4e959606121 100644 --- a/extensions/kallichore-adapter/scripts/install-kallichore-server.ts +++ b/extensions/kallichore-adapter/scripts/install-kallichore-server.ts @@ -123,7 +123,7 @@ async function downloadAndReplaceKallichore(version: string, method: 'GET', protocol: 'https:', hostname: 'api.github.com', - path: `/repos/posit-dev/kallichore/releases` + path: `/repos/posit-dev/kallichore-builds/releases` }; const response = await httpsGetAsync(requestOptions as any) as any; @@ -138,7 +138,7 @@ async function downloadAndReplaceKallichore(version: string, await executeCommand('git credential approve', `protocol=https\n` + `host=github.com\n` + - `path=/repos/posit-dev/kallichore/releases\n` + + `path=/repos/posit-dev/kallichore-builds/releases\n` + `username=\n` + `password=${githubPat}\n`); console.log(stdout); @@ -155,7 +155,7 @@ async function downloadAndReplaceKallichore(version: string, await executeCommand('git credential reject', `protocol=https\n` + `host=github.com\n` + - `path=/repos/posit-dev/kallichore/releases\n` + + `path=/repos/posit-dev/kallichore-builds/releases\n` + `username=\n` + `password=${githubPat}\n`); console.log(stdout); @@ -366,7 +366,7 @@ async function main() { await executeCommand('git credential fill', `protocol=https\n` + `host=github.com\n` + - `path=/repos/posit-dev/kallichore/releases\n`); + `path=/repos/posit-dev/kallichore-builds/releases\n`); gitCredential = true; // Extract the `password = ` line from the output. @@ -388,14 +388,6 @@ async function main() { await downloadAndReplaceKallichore(packageJsonVersion, githubPat, gitCredential); } -// Disable downloading if running inside a Github action on the public -// posit-dev/positron repository, which doesn't currently have access to the -// private Kallichore repository. -if (process.env.GITHUB_ACTIONS && process.env.GITHUB_REPOSITORY === 'posit-dev/positron') { - console.log('Skipping Kallichore download on public repository.'); -} else { - - main().catch((error) => { - console.error('An error occurred:', error); - }); -} +main().catch((error) => { + console.error('An error occurred:', error); +}); diff --git a/extensions/kallichore-adapter/src/test/server.test.ts b/extensions/kallichore-adapter/src/test/server.test.ts index 8d0c0a24fe4..ecfe9bfdcfa 100644 --- a/extensions/kallichore-adapter/src/test/server.test.ts +++ b/extensions/kallichore-adapter/src/test/server.test.ts @@ -10,12 +10,6 @@ import { API_INSTANCE } from '../extension'; // correct version as specified in the package.json. suite('Server', () => { test('Server starts and connects', async () => { - // Skip this test if the server is not available (see notes in `install-kallichore-server.ts`) - if (process.env.GITHUB_ACTIONS && process.env.GITHUB_REPOSITORY === 'posit-dev/positron') { - // Skip the test - return; - } - // Start the server and connect to it const status = await API_INSTANCE.serverStatus();