-
Notifications
You must be signed in to change notification settings - Fork 875
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
Adding functions examples for azure-nextgen #915
Conversation
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.
LGTM, just minor suggestions
// Run on Linux | ||
Kind = "Linux", | ||
|
||
// Premium SKU |
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.
Let's change to the Consumption plan (that's the default thing for Azure Functions)
{ | ||
public FunctionsStack() | ||
{ | ||
var resourceGroup = new ResourceGroup("functions-rg", new ResourceGroupArgs { ResourceGroupName = "functions-rg", Location = "westus2" }); |
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: Location to config
SiteConfig = new SiteConfigArgs | ||
{ | ||
AlwaysOn = true, | ||
LinuxFxVersion = "DOCKER|mcr.microsoft.com/azure-functions/python:2.0", |
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.
Hmm... This deploys the docker image, not our code, or am I wrong? I think this is not needed.
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.
This was copied from https://github.com/pulumi/examples/blob/master/azure-cs-functions-linux-app/FunctionsStack.cs#L82
Seems to be the base functions runtime image and it seemed to run our code still. However, doesn't work with the addition of the consumption sku. Removed now.
|
||
[Output] public Output<string> Endpoint { get; set; } | ||
|
||
static private Output<string> signedBlobReadUrl(Blob blob, BlobContainer container, StorageAccount account, ResourceGroup resourceGroup) |
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
static private Output<string> signedBlobReadUrl(Blob blob, BlobContainer container, StorageAccount account, ResourceGroup resourceGroup) | |
private static Output<string> SignedBlobReadUrl(Blob blob, BlobContainer container, StorageAccount account, ResourceGroup resourceGroup) |
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.
Fixed.
{ name: "runtime", value: "dotnet" }, | ||
{ name: "FUNCTIONS_WORKER_RUNTIME", value: "dotnet" }, | ||
{ name: "WEBSITE_RUN_FROM_PACKAGE", value: dotnetBlobSignedURL }, | ||
{ name: "WEBSITE_NODE_DEFAULT_VERSION", value: "~12" }, |
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.
Probably not needed for non-node functions?
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.
Yup - removed.
<Project Sdk="Microsoft.NET.Sdk"> | ||
<PropertyGroup> | ||
<TargetFramework>netcoreapp3.1</TargetFramework> | ||
<AzureFunctionsVersion>v2</AzureFunctionsVersion> |
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.
<AzureFunctionsVersion>v2</AzureFunctionsVersion> | |
<AzureFunctionsVersion>v3</AzureFunctionsVersion> |
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.
Fixed.
@@ -0,0 +1,138 @@ | |||
// Copyright 2016-2020, Pulumi Corporation. All rights reserved. |
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.
2021, here and elsewhere?
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.
Thanks for the catch, updated.
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.
Looks good aside from one comment
req_body = req.get_json() | ||
except ValueError: | ||
pass | ||
else: |
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 think this is indented too far
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.
This is a shameless copy of https://github.com/pulumi/examples/blob/master/azure-ts-functions-raw/python/HelloPython/__init__.py.
That said I think the intent is that the else
block is invoked only if no exception is raised (as opposed to a finally block).
Adding functions examples for azure-nextgen
No description provided.