Skip to content

Commit 5979505

Browse files
author
Andrew
committed
Merge branch 'main' of https://github.com/PowerShell/DSC into issue_282
2 parents 65702f4 + c209290 commit 5979505

File tree

18 files changed

+262
-163
lines changed

18 files changed

+262
-163
lines changed

.github/workflows/rust.yml

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -15,20 +15,20 @@ env:
1515
CARGO_TERM_COLOR: always
1616

1717
jobs:
18-
build-linux:
18+
# build-linux:
1919

20-
runs-on: ubuntu-latest
20+
# runs-on: ubuntu-latest
2121

22-
steps:
23-
- uses: actions/checkout@v3
24-
- name: Build
25-
shell: pwsh
26-
run: ./build.ps1 -clippy
27-
- name: Run tests
28-
shell: pwsh
29-
run: ./build.ps1 -test
22+
# steps:
23+
# - uses: actions/checkout@v3
24+
# - name: Build
25+
# shell: pwsh
26+
# run: ./build.ps1 -clippy
27+
# - name: Run tests
28+
# shell: pwsh
29+
# run: ./build.ps1 -test
3030

31-
build-musl:
31+
build-linux:
3232

3333
runs-on: ubuntu-latest
3434

.pipelines/DSC-Official.yml

Lines changed: 57 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ pr:
55
branches:
66
include:
77
- onebranch
8-
- release*
8+
- release/v*
99

1010
schedules:
1111
- cron: '0 3 * * 1'
@@ -33,7 +33,7 @@ extends:
3333
template: v2/OneBranch.Official.CrossPlat.yml@onebranchTemplates
3434
parameters:
3535
featureFlags:
36-
WindowsHostVersion:
36+
WindowsHostVersion:
3737
Disk: Large
3838
Version: 2022
3939
Network: KS1 # note that this property is sticky so commenting out will use the previous set one
@@ -59,7 +59,7 @@ extends:
5959
apiscan:
6060
enabled: false
6161

62-
stages:
62+
stages:
6363
- stage: BuildAndSign
6464
displayName: Build Native Binaries
6565
dependsOn: []
@@ -225,61 +225,61 @@ extends:
225225
displayName: 'Create msixbundle'
226226
condition: succeeded()
227227
228-
- job: BuildLinux
229-
dependsOn: SetPackageVersion
230-
variables:
231-
LinuxContainerImage: 'onebranch.azurecr.io/linux/ubuntu-2204:latest'
232-
PackageVersion: $[ dependencies.SetPackageVersion.outputs['Package.Version'] ]
233-
ob_outputDirectory: '$(Build.ArtifactStagingDirectory)'
234-
displayName: Linux-x64-gnu
235-
pool:
236-
type: linux
237-
steps:
238-
- task: RustInstaller@1
239-
inputs:
240-
rustVersion: ms-stable
241-
toolchainFeed: https://pkgs.dev.azure.com/mscodehub/Rust/_packaging/Rust/nuget/v3/index.json
242-
additionalTargets: x86_64-unknown-linux-gnu
243-
displayName: Install Rust
244-
env:
245-
ob_restore_phase: true
246-
- pwsh: |
247-
./build.ps1 -Release -Architecture x86_64-unknown-linux-gnu
248-
./build.ps1 -PackageType tgz -Architecture x86_64-unknown-linux-gnu -Release
249-
Copy-Item ./bin/*.tar.gz "$(ob_outputDirectory)"
250-
displayName: 'Build x86_64-unknown-linux-gnu'
251-
condition: succeeded()
228+
# - job: BuildLinux
229+
# dependsOn: SetPackageVersion
230+
# variables:
231+
# LinuxContainerImage: 'onebranch.azurecr.io/linux/ubuntu-2204:latest'
232+
# PackageVersion: $[ dependencies.SetPackageVersion.outputs['Package.Version'] ]
233+
# ob_outputDirectory: '$(Build.ArtifactStagingDirectory)'
234+
# displayName: Linux-x64-gnu
235+
# pool:
236+
# type: linux
237+
# steps:
238+
# - task: RustInstaller@1
239+
# inputs:
240+
# rustVersion: ms-stable
241+
# toolchainFeed: https://pkgs.dev.azure.com/mscodehub/Rust/_packaging/Rust/nuget/v3/index.json
242+
# additionalTargets: x86_64-unknown-linux-gnu
243+
# displayName: Install Rust
244+
# env:
245+
# ob_restore_phase: true
246+
# - pwsh: |
247+
# ./build.ps1 -Release -Architecture x86_64-unknown-linux-gnu
248+
# ./build.ps1 -PackageType tgz -Architecture x86_64-unknown-linux-gnu -Release
249+
# Copy-Item ./bin/*.tar.gz "$(ob_outputDirectory)"
250+
# displayName: 'Build x86_64-unknown-linux-gnu'
251+
# condition: succeeded()
252252

253-
- job: BuildLinuxArm64
254-
dependsOn: SetPackageVersion
255-
variables:
256-
LinuxContainerImage: 'onebranch.azurecr.io/linux/ubuntu-2004-arm64:latest'
257-
PackageVersion: $[ dependencies.SetPackageVersion.outputs['Package.Version'] ]
258-
ob_outputDirectory: '$(Build.ArtifactStagingDirectory)'
259-
displayName: Linux-ARM64-gnu
260-
pool:
261-
type: linux
262-
hostArchitecture: arm64
263-
steps:
264-
- task: RustInstaller@1
265-
inputs:
266-
rustVersion: ms-stable
267-
toolchainFeed: https://pkgs.dev.azure.com/mscodehub/Rust/_packaging/Rust/nuget/v3/index.json
268-
additionalTargets: aarch64-unknown-linux-gnu
269-
displayName: Install Rust
270-
env:
271-
ob_restore_phase: true
272-
- pwsh: |
273-
apt update
274-
apt -y install gcc-aarch64-linux-gnu
275-
if ((openssl version -d) -match 'OPENSSLDIR: "(?<dir>.*?)"') {
276-
$env:OPENSSL_LIB_DIR = $matches['dir']
277-
}
278-
./build.ps1 -Release -Architecture aarch64-unknown-linux-gnu
279-
./build.ps1 -PackageType tgz -Architecture aarch64-unknown-linux-gnu -Release
280-
Copy-Item ./bin/*.tar.gz "$(ob_outputDirectory)"
281-
displayName: 'Build aarch64-unknown-linux-gnu'
282-
condition: succeeded()
253+
# - job: BuildLinuxArm64
254+
# dependsOn: SetPackageVersion
255+
# variables:
256+
# LinuxContainerImage: 'onebranch.azurecr.io/linux/ubuntu-2004-arm64:latest'
257+
# PackageVersion: $[ dependencies.SetPackageVersion.outputs['Package.Version'] ]
258+
# ob_outputDirectory: '$(Build.ArtifactStagingDirectory)'
259+
# displayName: Linux-ARM64-gnu
260+
# pool:
261+
# type: linux
262+
# hostArchitecture: arm64
263+
# steps:
264+
# - task: RustInstaller@1
265+
# inputs:
266+
# rustVersion: ms-stable
267+
# toolchainFeed: https://pkgs.dev.azure.com/mscodehub/Rust/_packaging/Rust/nuget/v3/index.json
268+
# additionalTargets: aarch64-unknown-linux-gnu
269+
# displayName: Install Rust
270+
# env:
271+
# ob_restore_phase: true
272+
# - pwsh: |
273+
# apt update
274+
# apt -y install gcc-aarch64-linux-gnu
275+
# if ((openssl version -d) -match 'OPENSSLDIR: "(?<dir>.*?)"') {
276+
# $env:OPENSSL_LIB_DIR = $matches['dir']
277+
# }
278+
# ./build.ps1 -Release -Architecture aarch64-unknown-linux-gnu
279+
# ./build.ps1 -PackageType tgz -Architecture aarch64-unknown-linux-gnu -Release
280+
# Copy-Item ./bin/*.tar.gz "$(ob_outputDirectory)"
281+
# displayName: 'Build aarch64-unknown-linux-gnu'
282+
# condition: succeeded()
283283

284284
- job: BuildLinuxMusl
285285
dependsOn: SetPackageVersion

.vscode/settings.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,5 +25,6 @@
2525
"sarif-viewer.connectToGithubCodeScanning": "off",
2626
"vscode-nmake-tools.workspaceBuildDirectories": [
2727
"."
28-
]
28+
],
29+
"azure-pipelines.1ESPipelineTemplatesSchemaFile": true
2930
}

build.ps1

Lines changed: 30 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@ param(
1515
[switch]$UseX64MakeAppx,
1616
[switch]$UseCratesIO,
1717
[switch]$UpdateLockFile,
18-
[switch]$Audit
18+
[switch]$Audit,
19+
[switch]$UseCFSAuth
1920
)
2021

2122
if ($GetPackageVersion) {
@@ -197,21 +198,25 @@ if (!$SkipBuild) {
197198
${env:CARGO_SOURCE_crates-io_REPLACE_WITH} = $null
198199
$env:CARGO_REGISTRIES_CRATESIO_INDEX = $null
199200

200-
if ($null -eq (Get-Command 'az' -ErrorAction Ignore)) {
201-
throw "Azure CLI not found"
202-
}
201+
if ($UseCFSAuth -or $null -ne $env:TF_BUILD) {
202+
if ($null -eq (Get-Command 'az' -ErrorAction Ignore)) {
203+
throw "Azure CLI not found"
204+
}
203205

204-
if ($null -ne $env:CARGO_REGISTRIES_POWERSHELL_TOKEN) {
205-
Write-Host "Using existing token"
206-
} else {
207-
Write-Host "Getting token"
208-
$accessToken = az account get-access-token --query accessToken --resource 499b84ac-1321-427f-aa17-267ca6975798 -o tsv
209-
if ($LASTEXITCODE -ne 0) {
210-
Write-Warning "Failed to get access token, use 'az login' first, or use '-useCratesIO' to use crates.io. Proceeding with anonymous access."
211-
} else {
212-
$header = "Bearer $accessToken"
213-
$env:CARGO_REGISTRIES_POWERSHELL_TOKEN = $header
214-
$env:CARGO_REGISTRIES_POWERSHELL_CREDENTIAL_PROVIDER = 'cargo:token'
206+
if ($null -ne (Get-Command az -ErrorAction Ignore)) {
207+
Write-Host "Getting token"
208+
$accessToken = az account get-access-token --query accessToken --resource 499b84ac-1321-427f-aa17-267ca6975798 -o tsv
209+
if ($LASTEXITCODE -ne 0) {
210+
Write-Warning "Failed to get access token, use 'az login' first, or use '-useCratesIO' to use crates.io. Proceeding with anonymous access."
211+
} else {
212+
$header = "Bearer $accessToken"
213+
$env:CARGO_REGISTRIES_POWERSHELL_INDEX = "sparse+https://pkgs.dev.azure.com/powershell/PowerShell/_packaging/powershell~force-auth/Cargo/index/"
214+
$env:CARGO_REGISTRIES_POWERSHELL_TOKEN = $header
215+
$env:CARGO_REGISTRIES_POWERSHELL_CREDENTIAL_PROVIDER = 'cargo:token'
216+
}
217+
}
218+
else {
219+
Write-Warning "Azure CLI not found, proceeding with anonymous access."
215220
}
216221
}
217222
}
@@ -661,7 +666,16 @@ if ($packageType -eq 'msixbundle') {
661666
}
662667
}
663668

664-
$packageName = "DSC-$productVersion-$architecture.tar"
669+
# for Linux, we only build musl as its statically linked, so we remove the musl suffix
670+
$productArchitecture = if ($architecture -eq 'aarch64-unknown-linux-musl') {
671+
'aarch64-linux'
672+
} elseif ($architecture -eq 'x86_64-unknown-linux-musl') {
673+
'x86_64-linux'
674+
} else {
675+
$architecture
676+
}
677+
678+
$packageName = "DSC-$productVersion-$productArchitecture.tar"
665679
$tarFile = Join-Path $PSScriptRoot 'bin' $packageName
666680
tar cvf $tarFile -C $tgzTarget .
667681
if ($LASTEXITCODE -ne 0) {

dsc/Cargo.lock

Lines changed: 15 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dsc/Cargo.toml

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "dsc"
3-
version = "3.0.0-preview.11"
3+
version = "3.0.0-rc.1"
44
edition = "2021"
55

66
[profile.release]
@@ -11,22 +11,22 @@ opt-level = 2
1111
lto = true
1212

1313
[dependencies]
14-
clap = { version = "4.5.17", features = ["derive"] }
15-
clap_complete = { version = "4.5.28" }
16-
crossterm = { version = "0.28.1" }
17-
ctrlc = { version = "3.4.0" }
14+
clap = { version = "4.5", features = ["derive"] }
15+
clap_complete = { version = "4.5" }
16+
crossterm = { version = "0.28" }
17+
ctrlc = { version = "3.4" }
1818
dsc_lib = { path = "../dsc_lib" }
1919
indicatif = { version = "0.17" }
20-
jsonschema = { version = "0.23.0", default-features = false }
21-
path-absolutize = { version = "3.1.1" }
20+
jsonschema = { version = "0.23", default-features = false }
21+
path-absolutize = { version = "3.1" }
2222
# reqwest = { version = "0.12.8", features = ["native-tls"], default-features = false }
23-
schemars = { version = "0.8.12" }
24-
serde = { version = "1.0.210", features = ["derive"] }
25-
serde_json = { version = "1.0.128", features = ["preserve_order"] }
26-
serde_yaml = { version = "0.9.3" }
23+
schemars = { version = "0.8" }
24+
serde = { version = "1.0", features = ["derive"] }
25+
serde_json = { version = "1.0", features = ["preserve_order"] }
26+
serde_yaml = { version = "0.9" }
2727
syntect = { version = "5.0", features = ["default-fancy"], default-features = false }
28-
sysinfo = { version = "0.32.0" }
29-
thiserror = "1.0.52"
28+
sysinfo = { version = "0.32" }
29+
thiserror = "1.0"
3030
tracing = { version = "0.1.37" }
31-
tracing-subscriber = { version = "0.3.17", features = ["ansi", "env-filter", "json"] }
32-
tracing-indicatif = { version = "0.3.6" }
31+
tracing-subscriber = { version = "0.3", features = ["ansi", "env-filter", "json"] }
32+
tracing-indicatif = { version = "0.3" }

dsc_lib/Cargo.lock

Lines changed: 14 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)