-
Notifications
You must be signed in to change notification settings - Fork 142
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
Conversation
import { type IProjectWizardContext } from "../IProjectWizardContext"; | ||
|
||
export interface IDockerfileProjectContext extends IActionContext, ExecuteActivityContext, IProjectWizardContext { | ||
projectLanguage?: 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.
IProjectWizardContext
already should have a language: ProjectLanguage
property that you should be able to leverage.
import { ProjectLanguage } from "../../../constants"; | ||
import { type IDockerfileProjectContext } from "./IDockerfileProjectContext"; | ||
|
||
export class DockerfileProjectLanguageStep extends AzureWizardPromptStep<IDockerfileProjectContext> { |
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.
You could probably just use the NewProjectLanguageStep
and add some filtering in the case for DockerfileProjectLanguageStep
instead of creating a new file that does largely the same thing.
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.
I did think about that but the data property in the NewProjectLanguageStep
does not match up with the data property I need. I can utilize language: ProjectLanguage
property that you commented about above but will probably still need the new step since the data is different.
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.
Actually update since I am not using the NewProjectLanguageStep I don't think I can use the language: ProjectLanguage
since the data types don't match up.
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.
Yeah but you should be able to just change the type instead of using a 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.
Looking at this more, I think we should just speak offline about this.
src/commands/createNewProject/dockerfileSteps/DockefileProjectLanguageStep.ts
Outdated
Show resolved
Hide resolved
…o meganmott/dockerfileProject
package.nls.json
Outdated
@@ -18,6 +18,7 @@ | |||
"azureFunctions.createFunctionAppAdvanced": "Create Function App in Azure... (Advanced)", | |||
"azureFunctions.createFunctionAppDetail": "For serverless, event driven apps and automation.", | |||
"azureFunctions.createNewProject": "Create New Project...", | |||
"azureFunctions.createNewProjectWithDockerfile": "Create New Project With Dockerfile...", |
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.
@@ -29,6 +29,8 @@ export interface IProjectWizardContext extends IActionContext { | |||
openApiSpecificationFile?: Uri[]; | |||
|
|||
targetFramework?: string | string[]; | |||
|
|||
dockerfile?: boolean; |
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.
Property name is a bit odd for a boolean. If I see dockerfile
, I think it's the dockerfile path or Uri. I would have called it addDockerfile
or something like that.
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 CreateDockerfileProjectStep
but we've covered that in another way.
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.'); |
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.
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.
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.
It's a just a nit, so if you disagree, feel free to just merge! Looks good!
@@ -54,6 +56,13 @@ export async function createNewProjectInternal(context: IActionContext, options: | |||
const wizardContext: Partial<IFunctionWizardContext> & IActionContext = Object.assign(context, options, { language, version: tryParseFuncVersion(version), projectTemplateKey }); | |||
const optionalExecuteStep = options.executeStep; | |||
|
|||
if (optionalExecuteStep instanceof CreateDockerfileProjectStep) { | |||
const message: string = localize('installFuncTools', 'You must have the Azure Functions Core Tools installed to run this command.'); |
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: Since we know what command they are running, I think we should tell them specifically that they need to have the core tools installed to create a containerized function project or whatever.
Contributes to #3523
Currently the entry point is next to the current "Create New Project..." command in the workspace view:
