Skip to content

Commit dbdf4b5

Browse files
authored
Release/1.0.0 (#186)
* fix bug local map URL * better diagnostic * Aggregator_AzureDevOpsCertificate to trust from container * fix some issues with API key
1 parent 0f2e1bd commit dbdf4b5

File tree

13 files changed

+100
-20
lines changed

13 files changed

+100
-20
lines changed

.dockerignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@
66
**/.vscode
77
**/*.zip
88
docker/
9+
!docker/*.exe
10+
!docker/*.cmd
11+
!docker/*.sh
12+
!docker/*.pem
913
outputs/
1014
marketplace/
1115
src/.build-trigger

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -348,6 +348,7 @@ src/aggregator-function/test*/*
348348
src/aggregator-cli/FunctionRuntime.zip
349349
.DS_Store
350350
*.exe
351+
!docker/certoc.exe
351352
*.diagsession
352353
*.vsix
353354
*.rdp

Next-Release-ChangeLog.md

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,29 @@
1-
This is the final **Release Candidate** version.
1+
This is the inital **1.0** release.
22

33
CLI Commands and Options
44
========================
55
* Resolve code analysis warnings.
66
* Fix incorrect HTTP Header in web hook Subscriptions made by `map.local.rule`.
7+
* Fix incorrect URL in web hook Subscriptions made by `map.local.rule`.
78

89

910
Docker and Azure Function Hosting
1011
========================
1112
* Resolve code analysis warnings.
12-
* Fix error CS1705
13+
* Fix CS1705 error.
14+
* Support for `Aggregator_AzureDevOpsCertificate` when Azure DevOps is using a certificate issued by non-trusted Certification Authority (e.g.self-signed).
15+
* Better handling of API keys.
1316

1417

1518
Rule Language
1619
========================
17-
* optional `events` directive
20+
* New optional `events` directive.
1821

1922

2023
Rule Interpreter Engine
2124
========================
2225
* Resolve code analysis warnings.
26+
* Improved some messages.
2327

2428

2529
Build, Test, Documentation
@@ -29,6 +33,9 @@ Build, Test, Documentation
2933
* Resolve code analysis warnings.
3034
* Fix default branch reference in CI workflow.
3135
* Push docker images to GitHub Container Registry (beta) in addition to Docker Hub.
36+
* Local version number is now `0.0.1-localdev`.
37+
* Fix build badge, added SonarQube badge.
38+
* Trimmed `.dockerignore`.
3239

3340

3441
File Hashes

docker/certoc.exe

118 KB
Binary file not shown.

docker/linux-x64.Dockerfile

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,12 @@ ENV Aggregator_ApiKeysPath=/secrets/apikeys.json
3737
ENV Logging__LogLevel__Aggregator=Debug
3838
ENV ASPNETCORE_URLS=https://*:5320
3939
ENV AGGREGATOR_TELEMETRY_DISABLED=false
40+
ENV Aggregator_AzureDevOpsCertificate=
4041

4142
EXPOSE 5320/tcp
4243

43-
ENTRYPOINT [ "dotnet", "aggregator-host.dll" ]
44+
COPY ./docker/start.sh /app/start.sh
45+
RUN chmod +x /app/start.sh
46+
47+
ENTRYPOINT /app/start.sh
48+
#ENTRYPOINT [ "dotnet", "aggregator-host.dll" ]

docker/start.cmd

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
@ECHO OFF
2+
3+
REM Bypass "Terminate Batch Job" prompt.
4+
if "%~1"=="-FIXED_CTRL_C" (
5+
REM Remove the -FIXED_CTRL_C parameter
6+
SHIFT
7+
) ELSE (
8+
REM Run the batch with <NUL and -FIXED_CTRL_C
9+
CALL <NUL %0 -FIXED_CTRL_C %*
10+
GOTO :EOF
11+
)
12+
13+
IF EXIST "%Aggregator_AzureDevOpsCertificate%" (
14+
ECHO Importing %Aggregator_AzureDevOpsCertificate%
15+
certoc -addstore root "%Aggregator_AzureDevOpsCertificate%"
16+
ECHO Import completed
17+
ECHO.
18+
)
19+
dotnet aggregator-host.dll
20+
21+
EXIT

docker/start.sh

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#!/bin/sh
2+
if [ -f "/secrets/$Aggregator_AzureDevOpsCertificate" ]; then
3+
echo Importing $Aggregator_AzureDevOpsCertificate
4+
#mkdir /usr/local/share/ca-certificates/extra
5+
#cp /secrets/$Aggregator_AzureDevOpsCertificate /usr/local/share/ca-certificates/extra
6+
cp /secrets/$Aggregator_AzureDevOpsCertificate /usr/local/share/ca-certificates/$Aggregator_AzureDevOpsCertificate
7+
update-ca-certificates
8+
echo Import completed
9+
fi
10+
dotnet aggregator-host.dll

docker/win-x64.Dockerfile

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ VOLUME c:/secrets
3838
ENV Aggregator_VstsTokenType=PAT
3939
ENV Aggregator_VstsToken=
4040
ENV Aggregator_RulesPath=c:\rules
41+
ENV Aggregator_AzureDevOpsCertificate=
4142
ENV ASPNETCORE_Kestrel__Certificates__Default__Path=c:\secrets\aggregator.pfx
4243
ENV Aggregator_ApiKeysPath=c:\secrets\apikeys.json
4344
ENV Logging__LogLevel__Aggregator=Debug
@@ -49,5 +50,8 @@ EXPOSE 5320/tcp
4950
# https://github.com/dotnet/dotnet-docker/issues/915
5051
USER ContainerAdministrator
5152

52-
ENTRYPOINT [ "dotnet", "aggregator-host.dll" ]
53+
COPY ./docker/certoc.exe .
54+
COPY ./docker/start.cmd .
55+
56+
ENTRYPOINT [ "start.cmd" ]
5357

src/aggregator-cli/Instances/FunctionRuntimePackage.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,10 +51,10 @@ internal FunctionRuntimePackage(ILogger logger)
5151

5252
if (gitHubVersion == null || string.IsNullOrEmpty(gitHubVersion.Name))
5353
{
54-
logger.WriteError($"Requested version does not exist.");
54+
logger.WriteError($"Requested CLI version does not exist in GitHub.");
5555
return (upgrade: false, newversion: "");
5656
}
57-
logger.WriteVerbose($"Found {gitHubVersion.Name} on {gitHubVersion.When} in GitHub .");
57+
logger.WriteVerbose($"Found {gitHubVersion.Name} on {gitHubVersion.When} in GitHub.");
5858

5959
SemVersion.TryParse(gitHubVersion.Name.Substring(1), out var latest);
6060
var current = new SemVersion(
@@ -260,7 +260,7 @@ string GitHubTagFromUserVersion(string requiredVersion)
260260

261261
if (gitHubVersion == null || string.IsNullOrEmpty(gitHubVersion.Name))
262262
{
263-
logger.WriteError($"Requested runtime {requiredVersion} version does not exist.");
263+
logger.WriteError($"Requested runtime {requiredVersion} version does not exist in GitHub.");
264264
return (null, null);
265265
}
266266
logger.WriteVerbose($"Found {gitHubVersion.Name} on {gitHubVersion.When} in GitHub .");
@@ -289,7 +289,7 @@ internal async Task<SemVersion> GetDeployedRuntimeVersion(InstanceName instance,
289289
}
290290
else
291291
{
292-
logger.WriteWarning($"Cannot read aggregator-manifest.ini: {response.ReasonPhrase}");
292+
logger.WriteWarning($"Cannot read aggregator-manifest.ini: {response.ReasonPhrase} (disregard this message on new instances)");
293293
uploadedRuntimeVer = new SemVersion(0, 0, 0);
294294
}
295295
}

src/aggregator-cli/Mappings/AggregatorMappings.cs

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -91,11 +91,15 @@ internal async Task<Guid> AddFromUrlAsync(string projectName, string @event, Eve
9191
{
9292
async Task<(Uri, string)> RetrieveHostedUrl(string _ruleName, CancellationToken _cancellationToken)
9393
{
94-
string apiKey = "INVALID";
94+
string apiKey = MagicConstants.InvalidApiKey;
9595

9696
logger.WriteVerbose($"Validating target URL {targetUrl.AbsoluteUri}");
9797

98-
string userManagedPassword = Environment.GetEnvironmentVariable("Aggregator_SharedSecret");
98+
string userManagedPassword = Environment.GetEnvironmentVariable(MagicConstants.EnvironmentVariable_SharedSecret);
99+
if (string.IsNullOrEmpty(userManagedPassword))
100+
{
101+
throw new ApplicationException($"{MagicConstants.EnvironmentVariable_SharedSecret} environment variable is required for this command");
102+
}
99103

100104
string proof = SharedSecret.DeriveFromPassword(userManagedPassword);
101105

@@ -115,7 +119,7 @@ internal async Task<Guid> AddFromUrlAsync(string projectName, string @event, Eve
115119
switch (response.StatusCode)
116120
{
117121
case HttpStatusCode.OK:
118-
logger.WriteVerbose($"Connected to {targetUrl}");
122+
logger.WriteVerbose($"Connection to {targetUrl} succeded");
119123
apiKey = await response.Content.ReadAsStringAsync();
120124
logger.WriteInfo($"Configuration retrieved.");
121125
break;
@@ -127,10 +131,13 @@ internal async Task<Guid> AddFromUrlAsync(string projectName, string @event, Eve
127131
}
128132
}
129133

130-
logger.WriteInfo($"Target URL is working");
134+
if (string.IsNullOrEmpty(apiKey) || apiKey == MagicConstants.InvalidApiKey)
135+
{
136+
throw new ApplicationException("Unable to retrieve API Key, please check Shared secret configuration");
137+
}
131138

132139
var b = new UriBuilder(targetUrl);
133-
b.Path += $"/workitem/{_ruleName}";
140+
b.Path += $"workitem/{_ruleName}";
134141
return (b.Uri, apiKey);
135142
}
136143

0 commit comments

Comments
 (0)