-
Notifications
You must be signed in to change notification settings - Fork 63
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
Feature: Allow for cli version specification #253
base: main
Are you sure you want to change the base?
Conversation
@microsoft-github-policy-service agree company="M Science LLC" |
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.
Thanks for the PR! I have left a few comments. Could you take a look and address them. Thanks!
common/src/dev-container-cli.ts
Outdated
}); | ||
return exitCode === 0; | ||
const {exitCode, stdout} = await exec(getSpecCliInfo().command, ['--version'], {}); | ||
return exitCode === 0 && stdout === cliVersion; |
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.
Could stdout include a newline? Maybe use .trim()
on the string.
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.
Good point, I have addressed the change.
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.
Sorry, long delay, but this would still be useful. Left a few more questions.
@@ -63,6 +63,10 @@ inputs: | |||
required: false | |||
default: false | |||
description: Builds the image with `--no-cache` (takes precedence over `cacheFrom`) | |||
cliVersion: | |||
required: false | |||
default: latest |
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.
Is the default now 0?
}); | ||
return exitCode === 0; | ||
const {exitCode, stdout} = await exec(command, ['--version'], {}); | ||
return exitCode === 0 && stdout.trim() === cliVersion; |
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.
===
won't match, e.g., major version 0
with any actual x.y.z
version. 🤔
@@ -6,7 +6,7 @@ import {promisify} from 'util'; | |||
import {ExecFunction} from './exec'; | |||
import {findWindowsExecutable} from './windows'; | |||
|
|||
const cliVersion = "0"; // Use 'latest' to get latest CLI version, or pin to specific version e.g. '0.14.1' if required | |||
export const MAJOR_VERSION_FALLBACK = '0'; |
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.
nit: Use camelCase.
This is in the context of devcontainers/cli#606.
I think this should be enough to allow for CLI version specification according to the other code I saw while reading through this.
The local build in the devcontainer is passing.