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

Adding functions examples for azure-nextgen #915

Merged
merged 4 commits into from
Feb 18, 2021
Merged

Conversation

viveklak
Copy link
Contributor

No description provided.

Copy link
Member

@mikhailshilkov mikhailshilkov left a 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
Copy link
Member

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" });
Copy link
Member

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",
Copy link
Member

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.

Copy link
Contributor Author

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)
Copy link
Member

@mikhailshilkov mikhailshilkov Feb 17, 2021

Choose a reason for hiding this comment

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

Nit

Suggested change
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)

Copy link
Contributor Author

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" },
Copy link
Member

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?

Copy link
Contributor Author

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>
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
<AzureFunctionsVersion>v2</AzureFunctionsVersion>
<AzureFunctionsVersion>v3</AzureFunctionsVersion>

Copy link
Contributor Author

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.
Copy link
Member

Choose a reason for hiding this comment

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

2021, here and elsewhere?

Copy link
Contributor Author

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.

Copy link
Member

@lblackstone lblackstone left a 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:
Copy link
Member

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

Copy link
Contributor Author

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).

@viveklak viveklak merged commit 39ac717 into master Feb 18, 2021
@pulumi-bot pulumi-bot deleted the vl/NextgenFunctions branch February 18, 2021 00:34
dixler pushed a commit that referenced this pull request Jan 21, 2022
Adding functions examples for azure-nextgen
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants