Skip to content

Commit 804da9c

Browse files
committed
move Kudu delays to configuration
1 parent d493ade commit 804da9c

File tree

2 files changed

+7
-9
lines changed

2 files changed

+7
-9
lines changed

.github/workflows/build-and-deploy.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ jobs:
2323
CONFIGURATION: Release
2424
SONAR_ORG: 'tfsaggregator'
2525
SONAR_PROJECTKEY: 'tfsaggregator_aggregator-cli'
26+
# list of TimeSpan controlling reading app logs from Kudu while running Integration tests
27+
AGGREGATOR_KUDU_LOGRETRIEVE_ATTEMPTS: '0:0:30 0:1:00 0:1:30 0:2:00 0:3:00'
2628
outputs:
2729
dockerTag: 'v${{ steps.gitversion.outputs.fullSemVer }}'
2830
releaseTag: ${{ steps.get_git_tag.outputs.tag_name }}

src/aggregator-cli/Kudu/KuduApi.cs

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -112,16 +112,12 @@ internal async Task<string> ReadApplicationLogAsync(string functionName, int log
112112
using var client = new HttpClient();
113113
ListingEntry[] listingResult = null;
114114

115-
TimeSpan[] delay = {
116-
new TimeSpan(0, 0, 5),
117-
new TimeSpan(0, 0, 12),
118-
new TimeSpan(0, 0, 25),
119-
new TimeSpan(0, 0, 55),
120-
new TimeSpan(0, 1, 30),
121-
};
122-
for (int attempt = 0; attempt < delay.Length; attempt++)
115+
string delayList = Environment.GetEnvironmentVariable("AGGREGATOR_KUDU_LOGRETRIEVE_ATTEMPTS")
116+
?? "0:0:5 0:0:12 0:0:25 0:0:55 0:1:30";
117+
var delay = delayList.Split(' ').Select(s => TimeSpan.Parse(s)).ToList();
118+
for (int attempt = 0; attempt < delay.Count; attempt++)
123119
{
124-
logger.WriteVerbose($"Listing attempt #{attempt + 1})");
120+
logger.WriteVerbose($"Attempt #{attempt + 1} to retrieve listing");
125121
using var listingRequest = await GetRequestAsync(HttpMethod.Get, $"{FunctionLogPath}/{functionName}/", cancellationToken);
126122
var listingResponse = await client.SendAsync(listingRequest, cancellationToken);
127123
var listingStream = await listingResponse.Content.ReadAsStreamAsync(cancellationToken);

0 commit comments

Comments
 (0)