-
Notifications
You must be signed in to change notification settings - Fork 10
build: roll github actions runners automatically #147
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
704ccca
to
b786180
Compare
@@ -1,12 +1,12 @@ | |||
import { Octokit } from '@octokit/rest'; | |||
import { MAIN_BRANCH, REPOS } from '../constants'; | |||
import { MAIN_BRANCH, REPOS, WINDOWS_DOCKER_FILE } from '../constants'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
import { MAIN_BRANCH, REPOS, WINDOWS_DOCKER_FILE } from '../constants'; | |
import { MAIN_BRANCH, REPOS } from '../constants'; |
Looks unused in this file.
export const currentLinuxImages = (content: string) => { | ||
const matches = content.match(LINUX_IMAGE_REGEX); | ||
if (!matches || matches.length < 3) { | ||
return { | ||
amd64: '', | ||
arm64: '', | ||
}; | ||
} else { | ||
return { | ||
amd64: matches[1], | ||
arm64: matches[2], | ||
}; | ||
} | ||
}; | ||
|
||
export async function getCurrentWindowsRunnerVersion(content: string) { | ||
return content.match(WINDOWS_RUNNER_REGEX)?.[1]; | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Test coverage for these two utils would be nice, reviewing raw regexes never feels very effective. 😀
// Helper to fetch JSON from a URL | ||
function fetchJson(url: string, headers: Record<string, string> = {}): Promise<any> { | ||
return new Promise((resolve, reject) => { | ||
https | ||
.get(url, { headers }, (res) => { | ||
let data = ''; | ||
res.on('data', (chunk) => (data += chunk)); | ||
res.on('end', () => { | ||
if (res.statusCode && res.statusCode >= 200 && res.statusCode < 300) { | ||
try { | ||
resolve(JSON.parse(data)); | ||
} catch (e) { | ||
reject(e); | ||
} | ||
} else { | ||
reject(new Error(`HTTP ${res.statusCode}: ${data}`)); | ||
} | ||
}); | ||
}) | ||
.on('error', reject); | ||
}); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any reason we can't just use const resp = fetch(...); if (resp.ok) resp.json();
instead of rolling it ourselves?
This PR adds roll capability to our github actions runner images. If a new version is available at https://github.com/actions/runner/pkgs/container/actions-runner, create a PR updating the infra repo with the new runner version.