Skip to content
Merged
Show file tree
Hide file tree
Changes from 58 commits
Commits
Show all changes
59 commits
Select commit Hold shift + click to select a range
3f97bf8
Wip
MicroFish91 Nov 29, 2023
63327a8
Wip
MicroFish91 Nov 29, 2023
c141c41
Wip
MicroFish91 Dec 7, 2023
4d4d245
Update verbiage
MicroFish91 Dec 7, 2023
9a2ac95
Remove activity context for api
MicroFish91 Dec 7, 2023
dcfb0e0
Clean up misc
MicroFish91 Dec 7, 2023
0535237
Revert
MicroFish91 Dec 7, 2023
9bca1f4
Hide api command from palette
MicroFish91 Dec 7, 2023
d5f09fc
Api context
MicroFish91 Dec 7, 2023
cc614bf
Misc
MicroFish91 Dec 7, 2023
6238290
Skip checking workspace settings from api entry point
MicroFish91 Dec 9, 2023
3617d8e
Change to fsPath
MicroFish91 Dec 12, 2023
a4941db
invokedFromApi
MicroFish91 Dec 12, 2023
5aaa76e
Add api.d.ts
MicroFish91 Dec 13, 2023
63bc92a
Remove api loading prompt
MicroFish91 Dec 14, 2023
dd588b9
Add subscription ID support
MicroFish91 Dec 18, 2023
8b57bae
Update option name
MicroFish91 Dec 19, 2023
4c98107
Update deployWorkspaceProjectResults
MicroFish91 Dec 19, 2023
976aadb
Misc
MicroFish91 Dec 20, 2023
6cb885a
Updates with shared tools changes
MicroFish91 Dec 21, 2023
c8d93c3
Merge branch 'main' of https://github.com/microsoft/vscode-azureconta…
MicroFish91 Jan 2, 2024
5b04b68
Reset package deps
MicroFish91 Jan 2, 2024
dffdff2
Upgrade deps
MicroFish91 Jan 2, 2024
99c8007
Update comment
MicroFish91 Jan 2, 2024
9928198
Update comments
MicroFish91 Jan 2, 2024
fb52b44
Update comment
MicroFish91 Jan 3, 2024
b3ba7b6
Microsoft header
MicroFish91 Jan 3, 2024
f45ff07
suppressConfirmation
MicroFish91 Jan 3, 2024
645863c
No skip create message
MicroFish91 Jan 3, 2024
ca46995
Merge with main
MicroFish91 Jan 5, 2024
72f5bdc
Simplify output messages
MicroFish91 Jan 5, 2024
1b4c909
Misc
MicroFish91 Jan 5, 2024
64d237a
Add ignoreExistingDeploySettings
MicroFish91 Jan 5, 2024
1da6c7a
Decouple API from deployWorkspaceProject
MicroFish91 Jan 8, 2024
b889b70
Add promptForEnvironmentResources comments
MicroFish91 Jan 8, 2024
4d2afd2
Expose a proper API interface using api provider
MicroFish91 Jan 8, 2024
6436c7b
Update changelog
MicroFish91 Jan 8, 2024
1fd1c21
Remove comment
MicroFish91 Jan 8, 2024
bdcdb92
Change type
MicroFish91 Jan 8, 2024
27e2fa2
Add dwp internal
MicroFish91 Jan 8, 2024
fa02fd4
Revert
MicroFish91 Jan 8, 2024
3521e6f
Merge with internal branch
MicroFish91 Jan 9, 2024
19bee17
centralize getDeployWorkspaceProjectResults
MicroFish91 Jan 9, 2024
17dd935
Remove unused values
MicroFish91 Jan 9, 2024
cdd88f6
Remove unused values
MicroFish91 Jan 9, 2024
e22058d
Merge branch 'mwf/dwp-internal' of https://github.com/microsoft/vscod…
MicroFish91 Jan 9, 2024
ce947c3
Merge branch 'main' of https://github.com/microsoft/vscode-azureconta…
MicroFish91 Jan 9, 2024
8518640
Merge branch 'mwf/dwp-internal' of https://github.com/microsoft/vscod…
MicroFish91 Jan 9, 2024
7f70697
Impl
MicroFish91 Jan 9, 2024
af67aa9
Merge with main
MicroFish91 Jan 25, 2024
c3b466d
Fix merge carryover
MicroFish91 Jan 25, 2024
551513f
Improve source path step
MicroFish91 Jan 26, 2024
251a8e4
Single quote
MicroFish91 Jan 26, 2024
827b864
Feedback
MicroFish91 Jan 29, 2024
dcc8fbe
Add correct path sep
MicroFish91 Jan 29, 2024
aee6b17
better var name
MicroFish91 Jan 29, 2024
bed00a7
Remove promise
MicroFish91 Jan 29, 2024
7499452
Add dockerfile relative path
MicroFish91 Jan 30, 2024
9692af0
Feedback
MicroFish91 Feb 5, 2024
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
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import { ImageNameStep } from "./ImageNameStep";
import { OSPickStep } from "./OSPickStep";
import { RootFolderStep } from "./RootFolderStep";
import { RunStep } from "./RunStep";
import { SourcePathStep } from "./SourcePathStep";
import { TarFileStep } from "./TarFileStep";
import { UploadSourceCodeStep } from "./UploadSourceCodeStep";

Expand Down Expand Up @@ -49,7 +50,7 @@ export class BuildFromProjectListStep extends AzureWizardPromptStep<ImageSourceC

switch (context.buildType) {
case ImageSource.RemoteAcrBuild:
promptSteps.push(new AcrListStep(), new RootFolderStep(), new DockerFileItemStep(), new ImageNameStep(), new OSPickStep());
promptSteps.push(new AcrListStep(), new RootFolderStep(), new DockerFileItemStep(), new SourcePathStep(), new ImageNameStep(), new OSPickStep());
executeSteps.push(new TarFileStep(), new UploadSourceCodeStep(), new RunStep(), new BuildImageStep());
break;
//TODO: case for 'Build from project locally using Docker'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import { type AcrBuildSupportedOS } from './OSPickStep';

export interface BuildImageInAzureImageSourceBaseContext extends ContainerRegistryImageSourceBaseContext {
rootFolder: vscode.WorkspaceFolder;
srcPath: string;
dockerfilePath: string;
imageName: string;
os: AcrBuildSupportedOS;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export class RunStep extends ExecuteActivityOutputStepBase<BuildImageInAzureImag
isPushEnabled: true,
sourceLocation: context.uploadedSourceLocation,
platform: { os: context.os },
dockerFilePath: path.basename(context.dockerfilePath) /* Assume the dockerfile is always in the root of the source */
dockerFilePath: path.relative(context.srcPath, context.dockerfilePath)
};

const retries = 3;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.md in the project root for license information.
*--------------------------------------------------------------------------------------------*/

import { AzureWizardPromptStep, type IAzureQuickPickItem } from '@microsoft/vscode-azext-utils';
import * as path from 'path';
import { browseItem } from '../../../../constants';
import { localize } from '../../../../utils/localize';
import { type BuildImageInAzureImageSourceContext } from './BuildImageInAzureImageSourceContext';

export class SourcePathStep extends AzureWizardPromptStep<BuildImageInAzureImageSourceContext> {
public async prompt(context: BuildImageInAzureImageSourceContext): Promise<void> {
const srcPath: string | undefined = (await context.ui.showQuickPick(this.getPicks(context), {
placeHolder: localize('sourceDirectoryPick', 'Choose your source code directory'),
suppressPersistence: true
})).data;

context.srcPath = srcPath ?? (await context.ui.showOpenDialog({
defaultUri: context.rootFolder?.uri,
canSelectFiles: false,
canSelectFolders: true
}))[0].fsPath;
}

public async configureBeforePrompt(context: BuildImageInAzureImageSourceContext): Promise<void> {
if (this.hasRootDockerfile(context)) {
context.srcPath = context.rootFolder.uri.fsPath;
}
}

public shouldPrompt(context: BuildImageInAzureImageSourceContext): boolean {
return !context.srcPath;
}

private getPicks(context: BuildImageInAzureImageSourceContext): IAzureQuickPickItem<string | undefined>[] {
const rootPath: string = context.rootFolder.uri.fsPath;
const directories: string[] = path.relative(rootPath, path.dirname(context.dockerfilePath)).split(path.sep);
const picks: IAzureQuickPickItem<string | undefined>[] = [{ label: '.' + path.sep, description: 'root', data: rootPath }];

let p: string = '';
for (const directory of directories) {
p += path.sep + directory;
picks.push({ label: '.' + p, data: rootPath + p });
}

(picks.at(-1) as IAzureQuickPickItem).description = 'dockerfile';
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Would it be more helpful to show the name of the dockerfile instead? I'm not sure exactly what the intention of the description is.

Copy link
Copy Markdown
Contributor Author

@MicroFish91 MicroFish91 Feb 1, 2024

Choose a reason for hiding this comment

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

By this step, the user has already chosen a Dockerfile. This description is just indicating to the user that the chosen Dockerfile is present at this folder level.

Yeah, we could show the full name of the Dockerfile instead

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Ohh, I see. 🤔

Shoot, I don't feel like that is super obvious based on just that description. I don't really have any great alternative suggestions.

Part of me is wondering how useful that information is to the user? Because where their dockerfile is may not really be that relevant to where their source code is anyway.

Copy link
Copy Markdown
Contributor Author

@MicroFish91 MicroFish91 Feb 1, 2024

Choose a reason for hiding this comment

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

Yeah, think it's worth waiting for PM feedback for this one then? I don't really have strong opinions either way tbh. I was also on the fence about whether it looked good / was useful.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think we'd be safe to just remove it to be honest. My gut feeling is that they won't really care.

I think it's more likely to confuse a user and I don't think knowing that is where the dockerfile is located is super relevant for this step anyway.

picks.push(browseItem);
return picks;
}

private hasRootDockerfile(context: BuildImageInAzureImageSourceContext): boolean {
if (!context.rootFolder || !context.dockerfilePath) {
return false;
}

const rootPath: string = context.rootFolder.uri.fsPath;
return path.relative(rootPath, context.dockerfilePath) === path.basename(context.dockerfilePath);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,24 +19,22 @@ const vcsIgnoreList = ['.git', '.gitignore', '.bzr', 'bzrignore', '.hg', '.hgign

export class UploadSourceCodeStep extends ExecuteActivityOutputStepBase<BuildImageInAzureImageSourceContext> {
public priority: number = 430;
/** Relative path of src folder from rootFolder and what gets deployed */
private _sourceFilePath: string;

protected async executeCore(context: BuildImageInAzureImageSourceContext, progress: Progress<{ message?: string | undefined; increment?: number | undefined }>): Promise<void> {
/* relative path of src folder from rootFolder and what gets deployed */
this._sourceFilePath = path.dirname(path.relative(context.rootFolder.uri.path, context.dockerfilePath));
this._sourceFilePath = context.rootFolder.uri.fsPath === context.srcPath ? '.' : path.relative(context.rootFolder.uri.fsPath, context.srcPath);
context.telemetry.properties.sourceDepth = this._sourceFilePath === '.' ? '0' : String(this._sourceFilePath.split(path.sep).length);

context.registryName = nonNullValue(context.registry?.name);
context.resourceGroupName = getResourceGroupFromId(nonNullValue(context.registry?.id));
context.client = await createContainerRegistryManagementClient(context);

const uploading: string = localize('uploadingSourceCode', 'Uploading source code...', this._sourceFilePath);
progress.report({ message: uploading });
progress.report({ message: localize('uploadingSourceCode', 'Uploading source code...') });

const source: string = path.join(context.rootFolder.uri.fsPath, this._sourceFilePath);
let items = await AzExtFsExtra.readDirectory(source);
items = items.filter(i => {
return !vcsIgnoreList.includes(i.name)
});
items = items.filter(i => !vcsIgnoreList.includes(i.name));

tar.c({ cwd: source }, items.map(i => i.name)).pipe(fse.createWriteStream(context.tarFilePath));

Expand Down