Skip to content

Commit eaeef7d

Browse files
authored
Change dnf-update to dnf check-update (#328)
1 parent 2d63652 commit eaeef7d

File tree

4 files changed

+23
-9
lines changed

4 files changed

+23
-9
lines changed

.pipelines/azure-pipelines-linux.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,14 @@ stages:
3838
performMultiLevelLookup: true
3939
workingDirectory: '$(Build.SourcesDirectory)'
4040

41+
- script: |
42+
# Read the content of VERSION
43+
version=$(Build.SourcesDirectory)/VERSION
44+
45+
# Set the file content as a pipeline variable
46+
echo "##vso[task.setvariable variable=VcVersion;isOutput=true]$version"
47+
displayName: 'Set VC Version'
48+
4149
- script: chmod -R +x $(Build.SourcesDirectory)
4250
displayName: 'Allow scripts to be executable on Linux'
4351

.pipelines/azure-pipelines.yml

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ pool:
1818
vmImage: windows-latest
1919

2020
variables:
21-
VcVersion : 1.14.34
21+
VcVersion : 1.0.0
2222
ROOT: $(Build.SourcesDirectory)
2323
CDP_DEFINITION_BUILD_COUNT: $[counter('', 0)] # needed for onebranch.pipeline.version task https://aka.ms/obpipelines/versioning
2424
ENABLE_PRS_DELAYSIGN: 1
@@ -40,12 +40,13 @@ steps:
4040
performMultiLevelLookup: true
4141
workingDirectory: '$(Build.SourcesDirectory)'
4242

43-
#- task: GitVersion@5
44-
# inputs:
45-
# runtime: 'core'
46-
# configFilePath: 'GitVersion.yml'
47-
# updateAssemblyInfo: true
43+
- script: |
44+
# Read the content of VERSION
45+
$version=Get-Content $(Build.SourcesDirectory)\VERSION
4846
47+
# Set the file content as a pipeline variable
48+
echo "##vso[task.setvariable variable=VcVersion;isOutput=true]$version"
49+
displayName: 'Set VC Version'
4950

5051
# Ensure the artifact output/bin/obj directories are clean.
5152
- script: $(Build.SourcesDirectory)\clean.cmd

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
1.14.24
1+
1.14.35

src/VirtualClient/VirtualClient.Dependencies/Packaging/DnfPackageInstallation.cs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,11 @@ namespace VirtualClient.Dependencies
2222
/// </summary>
2323
public class DnfPackageInstallation : VirtualClientComponent
2424
{
25+
/// <summary>
26+
/// The list of exit codes that dnf could return.
27+
/// </summary>
28+
public static readonly IEnumerable<int> DnfSuccessfulCodes = new int[] { 0, 100 };
29+
2530
private const string DnfCommand = "dnf";
2631
private ISystemManagement systemManagement;
2732

@@ -138,7 +143,7 @@ await this.ExecuteCommandAsync(DnfPackageInstallation.DnfCommand, $"config-manag
138143
await this.InstallRetryPolicy.ExecuteAsync(async () =>
139144
{
140145
// Runs Dnf update first.
141-
await this.ExecuteCommandAsync(DnfPackageInstallation.DnfCommand, $"update -y", Environment.CurrentDirectory, telemetryContext, cancellationToken)
146+
await this.ExecuteCommandAsync(DnfPackageInstallation.DnfCommand, $"check-update -y", Environment.CurrentDirectory, telemetryContext, cancellationToken)
142147
.ConfigureAwait(false);
143148

144149
// Runs the installation command with retries and throws if the command fails after all
@@ -214,7 +219,7 @@ private Task ExecuteCommandAsync(string pathToExe, string commandLineArguments,
214219
await this.LogProcessDetailsAsync(process, telemetryContext, "Dnf")
215220
.ConfigureAwait(false);
216221

217-
process.ThrowIfErrored<DependencyException>(errorReason: ErrorReason.DependencyInstallationFailed);
222+
process.ThrowIfErrored<DependencyException>(DnfPackageInstallation.DnfSuccessfulCodes, errorReason: ErrorReason.DependencyInstallationFailed);
218223
}
219224
}
220225
});

0 commit comments

Comments
 (0)