Skip to content

Commit

Permalink
feat - allow --version to test a build by specific version number (#18
Browse files Browse the repository at this point in the history
)
  • Loading branch information
bpasero authored Sep 18, 2024
1 parent 8a7af30 commit c152f63
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 5 deletions.
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@vscode/vscode-bisect",
"version": "0.5.0",
"version": "0.5.1",
"description": "Bisect released VS Code Insider builds to find bugs or performance issues similar to what git bisect supports.",
"repository": {
"type": "git",
Expand Down
7 changes: 7 additions & 0 deletions src/builds.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,19 @@ export interface IBuild {

interface IBuildMetadata {
readonly url: string;
readonly version: string;
readonly productVersion: string;
readonly sha256hash: string;
}

class Builds {

async fetchBuildByVersion(runtime = Runtime.WebLocal, version: string): Promise<IBuild> {
const meta = await jsonGet<IBuildMetadata>(`https://update.code.visualstudio.com/api/versions/${version}-insider/${this.getBuildApiName(runtime)}/insider`);

return { runtime, commit: meta.version };
}

async fetchBuilds(runtime = Runtime.WebLocal, goodCommit?: string, badCommit?: string, releasedOnly?: boolean): Promise<IBuild[]> {

// Fetch all released insider builds
Expand Down
9 changes: 7 additions & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ module.exports = async function (argv: string[]): Promise<void> {
good?: string;
bad?: string;
commit?: string;
version?: string;
releasedOnly?: boolean;
verbose?: boolean;
reset?: boolean;
Expand All @@ -36,6 +37,7 @@ module.exports = async function (argv: string[]): Promise<void> {
.option('-g, --good <commit>', 'commit hash of a released insiders build that does not reproduce the issue')
.option('-b, --bad <commit>', 'commit hash of a released insiders build that reproduces the issue')
.option('-c, --commit <commit|latest>', 'commit hash of a specific insiders build to test or "latest" released build (supercedes -g and -b)')
.option('--version <version>', 'version of a specific insiders build to test (supercedes -g, -b and -c)')
.option('--releasedOnly', 'only bisect over released insiders builds to support older builds')
.option('--reset', 'deletes the cache folder (use only for troubleshooting)')
.option('-p, --perf [path]', 'runs a performance test and optionally writes the result to the provided path')
Expand Down Expand Up @@ -82,7 +84,7 @@ Builds are stored and cached on disk in ${BUILD_FOLDER}

let badCommit = opts.bad;
let goodCommit = opts.good;
if (!opts.commit) {
if (!opts.commit && !opts.version) {
if (!badCommit) {
const response = await prompts([
{
Expand Down Expand Up @@ -129,7 +131,10 @@ Builds are stored and cached on disk in ${BUILD_FOLDER}
}

let commit: string | undefined;
if (opts.commit) {
if (opts.version) {
const build = await builds.fetchBuildByVersion(runtime, opts.version);
commit = build.commit;
} else if (opts.commit) {
if (opts.commit === 'latest') {
const allBuilds = await builds.fetchBuilds(runtime, undefined, undefined, opts.releasedOnly);
commit = allBuilds[0].commit;
Expand Down

0 comments on commit c152f63

Please sign in to comment.