Skip to content
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

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

Olgethorpe
Copy link

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.

@Olgethorpe Olgethorpe requested a review from kennethredler July 28, 2023 13:19
@Olgethorpe
Copy link
Author

@microsoft-github-policy-service agree company="M Science LLC"

Copy link
Collaborator

@chrmarti chrmarti left a 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!

});
return exitCode === 0;
const {exitCode, stdout} = await exec(getSpecCliInfo().command, ['--version'], {});
return exitCode === 0 && stdout === cliVersion;
Copy link
Collaborator

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.

Copy link
Author

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.

Copy link
Collaborator

@chrmarti chrmarti left a 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
Copy link
Collaborator

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;
Copy link
Collaborator

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';
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: Use camelCase.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants