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

V2 SyncTriggers Improvements #4145

Merged
merged 1 commit into from Apr 24, 2019
Merged

V2 SyncTriggers Improvements #4145

merged 1 commit into from Apr 24, 2019

Conversation

mathewc
Copy link
Member

@mathewc mathewc commented Feb 27, 2019

Addresses #3949. See corresponding v1 PR: #4325.

Because the extended sync triggers payload format is behind a feature flag (WEBSITE_FUNCTIONS_ARMCACHE_ENABLED) these changes can be released before ANT 82. We'll just enable the extended format post ANT 82 by flipping the default in a new runtime release.

@@ -186,11 +189,13 @@ private async Task<IActionResult> AddOrUpdateSecretAsync(string keyName, string
case OperationResult.Created:
{
var keyResponse = ApiModelUtility.CreateApiModel(new { name = keyName, value = operationResult.Secret }, Request);
await _functionsSyncManager.TrySyncTriggersAsync();
Copy link
Member Author

Choose a reason for hiding this comment

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

Now that keys can also be part of the sync triggers payload, we need to sync triggers whenever they are updated.

uriString += $"/{routePrefix.TrimEnd('/')}";
}

if (!string.IsNullOrEmpty(customRoute))
Copy link
Member Author

Choose a reason for hiding this comment

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

There was actually a bug in this code - if a custom route was being used, it was being appended directly to the base route, w/o including the route prefix.


internal static string GetBaseUrl()
{
string hostName = Environment.GetEnvironmentVariable("WEBSITE_HOSTNAME") ?? "localhost";
Copy link
Member Author

@mathewc mathewc Feb 27, 2019

Choose a reason for hiding this comment

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

Previously we were getting the base URL from the active request. However, we're now needing to compute this in the absence of a request (e.g. background sync triggers)

I have a related PR #4338 out for fixing WEBSITE_HOSTNAME

Copy link
Member

Choose a reason for hiding this comment

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

Should this be using IEnvironment rather than Environment?

Copy link
Member Author

Choose a reason for hiding this comment

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

I'll be rebasing on the WEBSITE_HOSTNAME changes that just went in so this will be coming from the HostNameProvider

@mathewc mathewc changed the title [WIP] Functions SyncTriggers improvements Functions SyncTriggers improvements Feb 27, 2019
@mathewc mathewc force-pushed the sync-trigger-ex branch 2 times, most recently from 3141708 to 06c0a18 Compare March 22, 2019 23:40
@mathewc mathewc mentioned this pull request Apr 18, 2019
@mathewc mathewc changed the title Functions SyncTriggers improvements V2 SyncTriggers improvements Apr 19, 2019
@mathewc mathewc changed the title V2 SyncTriggers improvements V2 SyncTriggers Improvements Apr 19, 2019
@mathewc mathewc force-pushed the sync-trigger-ex branch 3 times, most recently from 707d00b to d1ae737 Compare April 23, 2019 18:05
Copy link
Member

@brettsam brettsam left a comment

Choose a reason for hiding this comment

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

A couple of fairly minor comments.

// Add functions secrets to the payload
// Only secret types we own/control can we cache directly
// Encryption is handled by Antares before storage
var secretsStorageType = Environment.GetEnvironmentVariable(EnvironmentSettingNames.AzureWebJobsSecretStorageType);
Copy link
Member

Choose a reason for hiding this comment

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

should this go against _environment instead of Environment?

Copy link
Member Author

Choose a reason for hiding this comment

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

fixed

@@ -59,6 +65,14 @@ public FunctionsSyncManager(IConfiguration configuration, IHostIdProvider hostId
_environment = environment;
}
Copy link
Member

Choose a reason for hiding this comment

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

nit -- can we change this to take an ILogger<FunctionsSyncManager> in the ctor?

Copy link
Member

Choose a reason for hiding this comment

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

If we change the logger category like this, it'll make detectors easier to run as they can filter on it. @FinVamp1 FYI.

Copy link
Member Author

Choose a reason for hiding this comment

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

done


internal static string GetBaseUrl()
{
string hostName = Environment.GetEnvironmentVariable("WEBSITE_HOSTNAME") ?? "localhost";
Copy link
Member

Choose a reason for hiding this comment

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

Should this be using IEnvironment rather than Environment?

@mathewc mathewc merged commit 8c7154c into dev Apr 24, 2019
@ahmelsayed ahmelsayed deleted the sync-trigger-ex branch July 16, 2019 17:43
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

2 participants