-
Notifications
You must be signed in to change notification settings - Fork 149
Add support for creating functions projects with dockerfiles #3929
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
Changes from 4 commits
150711e
5f887e8
d546af2
e5ef6e0
00b9f09
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -29,6 +29,8 @@ export interface IProjectWizardContext extends IActionContext { | |
| openApiSpecificationFile?: Uri[]; | ||
|
|
||
| targetFramework?: string | string[]; | ||
|
|
||
| dockerfile?: boolean; | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Property name is a bit odd for a boolean. If I see But that being said, I don't think you need this property anymore. I'm assuming it used to be used to determine whether or not to add the |
||
| } | ||
|
|
||
| export type OpenBehavior = 'AddToWorkspace' | 'OpenInNewWindow' | 'OpenInCurrentWindow' | 'AlreadyOpen' | 'DontOpen'; | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,33 @@ | ||
| /*--------------------------------------------------------------------------------------------- | ||
| * Copyright (c) Microsoft Corporation. All rights reserved. | ||
| * Licensed under the MIT License. See License.md in the project root for license information. | ||
| *--------------------------------------------------------------------------------------------*/ | ||
|
|
||
| import { ext } from "@microsoft/vscode-azext-serviceconnector"; | ||
| import { AzureWizardExecuteStep, UserCancelledError, nonNullValueAndProp } from "@microsoft/vscode-azext-utils"; | ||
| import { validateFuncCoreToolsInstalled } from "../../../funcCoreTools/validateFuncCoreToolsInstalled"; | ||
| import { localize } from "../../../localize"; | ||
| import { cpUtils } from "../../../utils/cpUtils"; | ||
| import { type IFunctionWizardContext } from "../../createFunction/IFunctionWizardContext"; | ||
|
|
||
| export class CreateDockerfileProjectStep extends AzureWizardExecuteStep<IFunctionWizardContext>{ | ||
| public priority: number = 100; | ||
|
|
||
| public async execute(context: IFunctionWizardContext): Promise<void> { | ||
| const message: string = localize('installFuncTools', 'You must have the Azure Functions Core Tools installed to run this command.'); | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I mentioned this in another PR, but you should front-load this error. Nothing more annoying than going through a project wizard and then having it fail right at the end. |
||
| if (!await validateFuncCoreToolsInstalled(context, message, context.workspacePath)) { | ||
| throw new UserCancelledError('validateFuncCoreToolsInstalled'); | ||
| } | ||
|
|
||
| let language = nonNullValueAndProp(context, 'language').toLowerCase(); | ||
| if (language === 'c#') { | ||
| language = 'csharp'; | ||
| } | ||
|
|
||
| await cpUtils.executeCommand(ext.outputChannel, nonNullValueAndProp(context, 'projectPath'), "func", "init", "--worker-runtime", language, "--docker"); | ||
| } | ||
|
|
||
| public shouldExecute(): boolean { | ||
| return true; | ||
| } | ||
| } | ||
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.
Maybe we should call it
Create New Containerized Project...?I don't have a strong preference, but the learn document does refer to it as a containerized function app.
https://learn.microsoft.com/en-us/azure/azure-functions/functions-deploy-container?tabs=acr%2Cbash%2Cazure-cli&pivots=programming-language-javascript