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

obtuse and confusing error with local feature under WSL #834 #838

Merged
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions src/spec-configuration/containerFeaturesConfiguration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -698,8 +698,11 @@ export async function getFeatureIdType(params: CommonParams, userFeatureId: stri

// Legacy feature-set ID
if (!userFeatureId.includes('/') && !userFeatureId.includes('\\')) {
output.write(`Legacy feature '${userFeatureId}' not supported. Please check https://containers.dev/features for replacements.`, LogLevel.Error);
throw new ContainerError({ description: `Legacy feature '${userFeatureId}' not supported. Please check https://containers.dev/features for replacements.` });
output.write(`Legacy feature '${userFeatureId}' not supported. Please check https://containers.dev/features for replacements. \n
prathameshzarkar9 marked this conversation as resolved.
Show resolved Hide resolved
If you were hoping to use local Features, remember to prepend your Feature name with "./". Please check https://containers.dev/implementors/features-distribution/#addendum-locally-referenced for more information.`, LogLevel.Error);
throw new ContainerError({
description: `Legacy feature '${userFeatureId}' not supported. Please check https://containers.dev/features for replacements. \n
If you were hoping to use local Features, remember to prepend your Feature name with "./". Please check https://containers.dev/implementors/features-distribution/#addendum-locally-referenced for more information.` });
}

// Direct tarball reference
Expand Down
11 changes: 11 additions & 0 deletions src/test/cli.build.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,17 @@ describe('Dev Containers CLI', function () {

describe('Command build', () => {

it('should fail to build with correct error message for local feature', async () => {
const testFolder = `${__dirname}/configs/image-with-local-feature`;
try {
await shellExec(`${cli} build --workspace-folder ${testFolder} --image-name demo:v1`);
} catch (error) {
const res = JSON.parse(error.stdout);
assert.equal(res.outcome, 'error');
assert.match(res.message, /prepend your Feature name with/);
prathameshzarkar9 marked this conversation as resolved.
Show resolved Hide resolved
prathameshzarkar9 marked this conversation as resolved.
Show resolved Hide resolved
}
});

it('should correctly configure the image name to push from --image-name with --push true', async () => {
const testFolder = `${__dirname}/configs/example`;
try {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"image": "ubuntu:latest",
"features": {
"myfeature": {}
}
}