Skip to content

Commit a9dc18a

Browse files
[nightly] Update dependencies from syft
1 parent 4607cc7 commit a9dc18a

350 files changed

Lines changed: 3476 additions & 2505 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

eng/common/templates/variables/docker-images.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
variables:
2-
imageNames.imageBuilderName: mcr.microsoft.com/dotnet-buildtools/image-builder:2740300
2+
imageNames.imageBuilderName: mcr.microsoft.com/dotnet-buildtools/image-builder:2744543
33
imageNames.imageBuilder: $(imageNames.imageBuilderName)
44
imageNames.imageBuilder.withrepo: imagebuilder-withrepo:$(Build.BuildId)-$(System.JobId)
55
imageNames.testRunner: mcr.microsoft.com/dotnet-buildtools/prereqs:azurelinux3.0-docker-testrunner
Lines changed: 193 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,193 @@
1+
{{
2+
_ Downloads, validate, and extracts the .NET Runtime, ASP.NET Core Runtime, or .NET SDK
3+
4+
ARGS:
5+
product : Product name, e.g. "dotnet", "aspnet", "sdk"
6+
extract-to : Directory where .NET will be extracted
7+
extract-paths : (optional) Paths within the .NET tarball to extract
8+
^
9+
10+
set product to ARGS["product"] ^
11+
12+
set isWindows to find(OS_VERSION, "server") >= 0 ^
13+
set isAlpine to find(OS_VERSION, "alpine") >= 0 ^
14+
15+
set platform to when(isWindows, "win", when(isAlpine, "linux-musl", "linux"))^
16+
set templatePlatform to when(isWindows, "windows", "linux") ^
17+
set lineEnd to when(isWindows, "; `", " \") ^
18+
set lineContinue to when(isWindows, "`", "\") ^
19+
set continue to when(isWindows, "", "&& ") ^
20+
set remove to when(isWindows, "Remove-Item -Force", "rm") ^
21+
22+
set useFileVariables to isWindows ^
23+
set useExtraLines to isWindows ^
24+
set extraLine to when(useExtraLines, cat("
25+
", lineContinue), "") ^
26+
27+
set dotnetVersion to join(slice(split(PRODUCT_VERSION, "."), 0, 2), ".") ^
28+
set baseUrl to VARIABLES[cat("dotnet|", dotnetVersion, "|base-url|", VARIABLES["branch"])] ^
29+
set checksumsBaseUrl to VARIABLES[cat("dotnet|", dotnetVersion, "|base-url|checksums|", VARIABLES["branch"])] ^
30+
set isInternal to find(baseUrl, "dotnetstage") >= 0 ^
31+
32+
set productVersion to when(product = "sdk",
33+
VARIABLES[cat(product, "|", dotnetVersion, "|product-version")],
34+
VARIABLES[cat("dotnet|", dotnetVersion, "|product-version")]
35+
)^
36+
set buildVersion to VARIABLES[cat(product, "|", dotnetVersion, "|build-version")] ^
37+
set isStableVersion to find(buildVersion, "preview") < 0 ^
38+
set fileVersion to when(isStableVersion, productVersion, buildVersion) ^
39+
40+
set archiveExtension to when(isWindows, ".zip", ".tar.gz") ^
41+
42+
if (product = "runtime"):{{
43+
set downloadPath to cat("/Runtime/", buildVersion, "/dotnet-runtime-", fileVersion, "-", platform, "-", ARCH_SHORT, archiveExtension)
44+
}}^elif (product = "aspnet"):{{
45+
set downloadPath to cat("/aspnetcore/Runtime/", buildVersion, "/aspnetcore-runtime-", fileVersion, "-", platform, "-", ARCH_SHORT, archiveExtension)
46+
}}^elif (product = "aspnet-composite"):{{
47+
set downloadPath to cat("/aspnetcore/Runtime/", buildVersion, "/aspnetcore-runtime-composite-", fileVersion, "-", platform, "-", ARCH_SHORT, archiveExtension)
48+
}}^elif (product = "sdk"):{{
49+
set downloadPath to cat("/Sdk/", buildVersion, "/dotnet-sdk-", fileVersion, "-", platform, "-", ARCH_SHORT, archiveExtension)
50+
}}^
51+
set downloadUrl to cat(baseUrl, downloadPath) ^
52+
53+
set shaFunction to "512" ^
54+
set urlParts to split(downloadUrl, "/") ^
55+
set fileName to urlParts[len(urlParts) - 1] ^
56+
57+
_ For now the aggregate and bare checksum files are mutually exclusive, but
58+
in the future we expect .NET 10 to have non-aggregate, non-bare checksum
59+
files before the other .NET versions, so it's necessary to have a
60+
separate condition for bare checksum files. ^
61+
_ Aggregate checksum files are also not available for internal builds. ^
62+
set shaUrlIsAggregate to (!isInternal && (dotnetVersion = "8.0" || dotnetVersion = "9.0")) ^
63+
set shaUrlIsBare to (isInternal || dotnetVersion = "10.0") ^
64+
65+
set shaUrlPath to when(shaUrlIsAggregate,
66+
VARIABLES[cat("dotnet|", dotnetVersion, "|aggregate-checksums")],
67+
cat(downloadPath, ".sha512")) ^
68+
set shaUrl to cat(checksumsBaseUrl, shaUrlPath) ^
69+
70+
set shaUrlParts to split(shaUrl, "/") ^
71+
set shaFileName to shaUrlParts[len(shaUrlParts) - 1] ^
72+
73+
_ The .NET SDK has two versions associated with it - SDK version and Runtime version.
74+
Aggregate checksum files are associated with the .NET runtime version, so if we're
75+
installing the SDK we need to have a separate variable for the runtime version. ^
76+
if (product = "sdk" && shaUrlIsAggregate):{{
77+
set runtimeVersion to VARIABLES[cat("runtime|", dotnetVersion, "|build-version")]
78+
}}^
79+
80+
set downloadFiles to cat("Dockerfile.", templatePlatform, ".download-files") ^
81+
set validateChecksum to cat("Dockerfile.", templatePlatform, ".validate-checksum") ^
82+
set extractFile to cat("Dockerfile.", templatePlatform, ".extract-file") ^
83+
84+
set variableAssignments to [] ^
85+
86+
_ Replace variables in a string with their values ^
87+
set replaceVariables(string) to:{{
88+
for variable, value in variableAssignments:{{
89+
set string to replace(string, value, cat("$", variable))
90+
}}^
91+
return string
92+
}}^
93+
94+
_ Replace variables in a string, format specifically for the purpose of
95+
assigning to a variable in PowerShell. ^
96+
set replaceVariablesPwshString(string) to:{{
97+
for variable, value in variableAssignments:{{
98+
set found to find(string, value)^
99+
if (found = 0):{{
100+
_ variable at beginning of string ^
101+
return cat(replace(string, value, cat("$", variable, " + '")), "'")
102+
}}^elif (found > 0):{{
103+
_ variable somewhere in the middle of the string ^
104+
set parts to split(string, value)^
105+
return cat("'", parts[0], "' + $", variable, " + '", parts[1], "'")
106+
}}^_
107+
}}^
108+
return cat("'", string, "'")
109+
}}^
110+
111+
set assign(variable, value, isPwshString) to:{{
112+
_ Add variable to collection, return a string that assigns the variable ^
113+
set rhs to when(isWindows,
114+
replaceVariablesPwshString(value),
115+
replaceVariables(value))^
116+
set out to when(isWindows,
117+
cat("$", variable, " = ", rhs),
118+
cat(variable, "=", rhs))^
119+
set variableAssignments to union([variable: value], variableAssignments) ^
120+
return out
121+
}}
122+
123+
}}{{
124+
assign(
125+
when(product = "aspnet" || product = "aspnet-composite",
126+
"aspnetcore_version",
127+
when(product = "sdk",
128+
"dotnet_sdk_version",
129+
"dotnet_version")),
130+
when(isStableVersion, productVersion, buildVersion)
131+
)
132+
}}{{if (isInternal && isStableVersion):{{lineEnd}}
133+
{{continue}}{{
134+
assign(
135+
when(product = "aspnet" || product = "aspnet-composite",
136+
"aspnetcore_build_version",
137+
when(product = "sdk",
138+
"dotnet_sdk_build_version",
139+
"dotnet_build_version")),
140+
buildVersion
141+
)^_
142+
}}}}{{if runtimeVersion:{{lineEnd}}
143+
{{continue}}{{
144+
assign("dotnet_version", runtimeVersion)
145+
}}}}{{if useFileVariables:{{lineEnd}}
146+
{{continue}}{{
147+
set fileNameVar to when(product = "aspnet", "aspnetcore_file", "dotnet_file")^
148+
assign(fileNameVar, fileName)^
149+
set fileName to replaceVariables(fileName)
150+
}}{{lineEnd}}
151+
{{continue}}{{
152+
set shaFileVar to when(shaUrlIsAggregate, "dotnet_checksums_file", "dotnet_sha512_file")^
153+
assign(shaFileVar, shaFileName)^
154+
set shaFileName to replaceVariables(shaFileName)
155+
}}}}{{lineEnd}}{{extraLine}}
156+
{{continue}}{{
157+
set downloadUrl to replaceVariables(downloadUrl) ^
158+
set shaUrl to replaceVariables(shaUrl) ^
159+
set filesToDownload to when(useFileVariables,
160+
[
161+
["out-file": fileName, "url": downloadUrl],
162+
["out-file": shaFileName, "url": shaUrl]
163+
],
164+
[
165+
["url": downloadUrl],
166+
["url": shaUrl]
167+
]
168+
)^
169+
InsertTemplate(downloadFiles, [
170+
"files": filesToDownload
171+
])
172+
}}{{lineEnd}}{{extraLine}}
173+
{{continue}}{{
174+
InsertTemplate(validateChecksum, [
175+
"file": replaceVariables(fileName),
176+
"sha-function": shaFunction,
177+
"sha-file": replaceVariables(shaFileName),
178+
"sha-file-is-bare": shaUrlIsBare,
179+
"sha-file-is-aggregate": shaUrlIsAggregate,
180+
"use-cmd-escape": isWindows && product = "sdk"
181+
])
182+
}}{{if ARGS["extract-to"]:{{lineEnd}}{{extraLine}}
183+
{{continue}}mkdir {{if !isWindows:--parents }}{{ARGS["extract-to"]}}{{lineEnd}}
184+
{{continue}}{{
185+
InsertTemplate(extractFile, [
186+
"file": replaceVariables(fileName),
187+
"dest-dir": ARGS["extract-to"],
188+
"extract-paths": ARGS["extract-paths"]
189+
])
190+
}}}}{{lineEnd}}
191+
{{continue}}{{remove}} {{lineContinue}}
192+
{{replaceVariables(fileName)}}{{if isWindows:,}} {{lineContinue}}
193+
{{replaceVariables(shaFileName)}}

eng/dockerfile-templates/Dockerfile.linux.download-dotnet

Lines changed: 0 additions & 112 deletions
This file was deleted.

eng/dockerfile-templates/Dockerfile.windows.download-file

Lines changed: 0 additions & 27 deletions
This file was deleted.
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
{{
2+
_ Downloads one or more files using PowerShell
3+
4+
ARGS:
5+
files: array of files to download, with the following format:
6+
[
7+
url: URL to download the file from
8+
out-file: (optional) name of the output file
9+
]
10+
^
11+
12+
_ Documentation for using Managed Identity/OAuth tokens to access Azure storage accounts:
13+
https://learn.microsoft.com/en-us/rest/api/storageservices/authorize-with-azure-active-directory#call-storage-operations-with-oauth-tokens ^
14+
15+
set isInternal(url) to:{{
16+
return find(url, "dotnetstage") >= 0
17+
}}^
18+
19+
for i, file in ARGS["files"]:{{
20+
if (!isAnyInternal):{{
21+
set isAnyInternal to isInternal(file["url"])
22+
}}^_
23+
}}^_
24+
25+
}}{{if isAnyInternal:$Headers = @@{ `
26+
Authorization = \"Bearer $env:ACCESSTOKEN\"; `
27+
'x-ms-version' = '2017-11-09'; `
28+
}; `
29+
}}{{
30+
for i, file in ARGS["files"]:Invoke-WebRequest -OutFile {{file["out-file"]}} {{file["url"]}}{{
31+
if (isInternal(file["url"])): -Headers $Headers^
32+
set isLastFile to (i = len(ARGS["files"]) - 1)^
33+
if (!isLastFile):; `
34+
}}}}

eng/dockerfile-templates/Dockerfile.windows.extract-zip renamed to eng/dockerfile-templates/Dockerfile.windows.extract-file

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,4 @@
55
file: Zip to extract
66
extract-paths: Paths within the zip file to extract
77
dest-dir: Destination directory
8-
}}tar --gzip --extract --no-same-owner --file {{ARGS["file"]}}{{if ARGS["dest-dir"]: --directory {{ARGS["dest-dir"]}}}}{{if ARGS["extract-paths"]: {{join(ARGS["extract-paths"], " ")}}}}; `
9-
Remove-Item -Force {{ARGS["file"]}}
8+
}}tar --gzip --extract --no-same-owner --file {{ARGS["file"]}}{{if ARGS["dest-dir"]: --directory {{ARGS["dest-dir"]}}}}{{if ARGS["extract-paths"]: {{join(ARGS["extract-paths"], " ")}}}}

0 commit comments

Comments
 (0)