Skip to content

Commit

Permalink
Various updates
Browse files Browse the repository at this point in the history
  • Loading branch information
Guy Fankam committed Jun 22, 2022
1 parent 28e1a09 commit 4ae5d5e
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 10 deletions.
35 changes: 32 additions & 3 deletions configuration.prod.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,33 @@
apimServiceName: [your target environment apim instance name goes here]
namedValues:
- name: abc
displayName: bcdee
value: efghi
- name: [name goes here. e.g. environment or SearchEngineBackendURL. It doesn't have to exist in the target environment]
displayName: [display name goes here]
value: [replacement value in the target environment. e.g. name value can be dev in dev environment and prod in the prod environment]
loggers:
- name: [source environment app insight name goes here. e.g. apim-dev-insights]
loggerType: applicationInsights
description: [app insight description goes here]
resourceId: "/subscriptions/[Azure subscription id for the target environment goes here]/resourceGroups/
[resource group name for the target environment goes here]/providers/microsoft.insights/components/
[target environment app insight name goes here. e.g. apim-prod-insights]"
credentials:
instrumentationKey: "destination environment namevalue key for the application insights goes here. You can use the display name to avoid hard coding the key here e.g. {{Logger-Credentials--62390d98217d201158b4bfb3}}.
The assumption is that the namevalue key is already populated in the target environment. This happens automatically when you associate an application insight to your target apim instance"
isBuffered: true
diagnostics:
- name: applicationinsights
verbosity: Error
loggerId: "/subscriptions/[Azure subscription id for the target environment goes here]/resourceGroups/[resource group name for the target environment goes here]
/providers/Microsoft.ApiManagement/service/[apim instance name for the target environment goes here]/loggers/[target environment app insight name goes here. e.g. apim-prod-insights]"
apis:
- name: "[target api version & revision to apply application insights to e.g. 'my-api', 'my-api-v2', 'my-api-v2;rev=2']"
diagnostics:
- name: applicationinsights
verbosity: Error
loggerId: "/subscriptions/[Azure subscription id for the target environment goes here]/resourceGroups/[resource group name for the target environment goes here]
/providers/Microsoft.ApiManagement/service/[apim instance name for the target environment goes here]/loggers/[target environment app insight name goes here. e.g. apim-prod-insights]"





2 changes: 1 addition & 1 deletion tools/code/publisher/Git.cs
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ private static IEnumerable<IGrouping<CommitStatus, FileInfo>> ParseDiffTreeOutpu
var getFileFromOutputLine = (string outputLine) => new FileInfo(Path.Combine(baseDirectory.FullName, outputLine[1..].Trim()));

return
from outputLine in output.Split(Environment.NewLine, StringSplitOptions.RemoveEmptyEntries)
from outputLine in output.Split('\n', StringSplitOptions.RemoveEmptyEntries)
let commitStatus = TryGetCommitStatusFromOutputLine(outputLine)
where commitStatus is not null
let nonNullCommitStatus = commitStatus ?? throw new NullReferenceException() // Shouldn't be null here, adding to satisfy nullable compiler check
Expand Down
17 changes: 11 additions & 6 deletions tools/code/publisher/Publisher.cs
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ private async ValueTask Run(CancellationToken cancellationToken)
logger.LogInformation("Deleting files...");
await DeleteFiles(filesToDelete, cancellationToken);
}

if (dictionary.TryGetValue(Action.Put, out var filesToPut))
{
logger.LogInformation("Putting files...");
Expand All @@ -138,11 +139,16 @@ private async Task<ImmutableDictionary<Action, ImmutableList<FileRecord>>> GetFi
logger.LogInformation("Configuration file was modified in commit ID, will include its contents.");

var configurationFileRecords = GetFileRecordsFromServiceDirectory()
.Where(IsFileRecordInConfiguration);

return commitIdFileRecords.SetItem(Action.Put,
commitIdFileRecords[Action.Put].Union(configurationFileRecords)
.ToImmutableList());
.Where(IsFileRecordInConfiguration)
.ToImmutableList();

return configurationFileRecords.Any()
// If the commit included artifacts to put, merge them with configuration records.
? commitIdFileRecords.SetItem(Action.Put,
commitIdFileRecords.TryGetValue(Action.Put, out var existingCommitIdArtifacts)
? existingCommitIdArtifacts.Union(configurationFileRecords).ToImmutableList()
: configurationFileRecords)
: commitIdFileRecords;
}
else
{
Expand Down Expand Up @@ -839,7 +845,6 @@ private async ValueTask PutApi(common.Models.Api api, ApiSpecificationFile? spec
{
logger.LogInformation("Putting api {api}...", api.Name);


if (specificationFile is not null)
{
logger.LogInformation("Updating api with specification file {specificationFile}...", specificationFile.Path);
Expand Down

0 comments on commit 4ae5d5e

Please sign in to comment.