Skip to content

Commit

Permalink
Enable kernel supervisor download in Github workflows (#5053)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
jmcphers authored Oct 18, 2024
1 parent 40081da commit 4cde19a
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 22 deletions.
2 changes: 1 addition & 1 deletion extensions/kallichore-adapter/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@
},
"positron": {
"binaryDependencies": {
"kallichore": "0.1.11"
"kallichore": "0.1.13"
}
},
"dependencies": {
Expand Down
22 changes: 7 additions & 15 deletions extensions/kallichore-adapter/scripts/install-kallichore-server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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);
Expand All @@ -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);
Expand Down Expand Up @@ -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.
Expand All @@ -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);
});
6 changes: 0 additions & 6 deletions extensions/kallichore-adapter/src/test/server.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down

0 comments on commit 4cde19a

Please sign in to comment.