Skip to content

Commit

Permalink
"Manually" install MSI dependencies instead of using choco install (#…
Browse files Browse the repository at this point in the history
…5553)

* Add "install MSI" helper for pipeline

* Install cppcheck using MSI directly

* TESTING cppcheck

* Install Azure functions using the MSI instead of chocolatey

* Revert "TESTING cppcheck"

This reverts commit 5603b4b.
  • Loading branch information
andrewlock authored May 15, 2024
1 parent d5ac9e9 commit 53a2313
Show file tree
Hide file tree
Showing 3 changed files with 63 additions and 35 deletions.
44 changes: 44 additions & 0 deletions .azure-pipelines/steps/install-msi.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
parameters:
- name: url
type: string

- name: filename
type: string

- name: msiParams
type: string
default: ''

- name: addToPath
type: string
default: ''

- name: retries
type: number
default: 3

steps:
- powershell: |
$ErrorActionPreference = 'Stop'
$url = "${{ parameters.url }}";
$file = "$(Agent.TempDirectory)\${{ parameters.filename }}"
Write-Host "Downloading from $url to $file";
Invoke-WebRequest -Uri $url -OutFile $file
$installArgs = "/i $file ${{ parameters.msiParams }} /norestart"
Write-Host "Installing using msiexec $installArgs";
Start-Process msiexec $installArgs -Wait
Write-Host "Installed";
if("${{ parameters.addToPath }}") {
Write-Host "Adding to PATH";
Write-Host "##vso[task.setvariable variable=PATH;]${env:PATH};${{ parameters.addToPath }}";
}
Import-Module $env:ChocolateyInstall\helpers\chocolateyProfile.psm1
refreshenv
displayName: Installing ${{ parameters.filename }}
condition: and(succeeded(), eq(variables['Agent.OS'], 'Windows_NT')) # TODO: error on non-windows?
retryCountOnTaskFailure: ${{ parameters.retries }}
timeoutInMinutes: 10
43 changes: 17 additions & 26 deletions .azure-pipelines/ultimate-pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1554,13 +1554,17 @@ stages:
targetBranch: $(targetBranch)
- template: steps/install-dotnet-sdks.yml
- template: steps/restore-working-directory.yml

# Not using chocolatey as we're getting 429 Too Many Requests
- template: steps/install-msi.yml
parameters:
url: "https://functionscdn.azureedge.net/public/artifacts/v4/latest/func-cli-x64.msi"
filename: "func-cli-x64.msi"
addToPath: "C:\\Program Files\\Microsoft\\Azure Functions Core Tools"

- script: |
$(runtimeInstall)
func
displayName: 'Install Azure Functions core tools'
- script: func
displayName: 'Display Azure Functions core tools'
workingDirectory: $(Pipeline.Workspace)
retryCountOnTaskFailure: 5

- script: |
"%ProgramFiles(x86)%\Microsoft SDKs\Azure\Storage Emulator\AzureStorageEmulator.exe" start
Expand Down Expand Up @@ -1597,13 +1601,6 @@ stages:
- script: tracer\build.cmd CheckBuildLogsForErrors
displayName: Check logs for errors

- script: |
$(runtimeUninstall)
displayName: 'Uninstall Azure Functions core tools'
workingDirectory: $(Pipeline.Workspace)
condition: succeededOrFailed()
continueOnError: true
- stage: static_analysis_checks_tracer
dependsOn: [merge_commit_id]
variables:
Expand Down Expand Up @@ -1675,20 +1672,14 @@ stages:
timeoutInMinutes: 60 #default value

steps:
- powershell: |
# Required to reload environment apparently
Import-Module $env:ChocolateyInstall\helpers\chocolateyProfile.psm1
choco install cppcheck -y --version 2.12
$errorCode = $LASTEXITCODE
if ($errorCode -ne 0)
{
# something went wrong. Let's retry
exit 1
}
Write-Host "##vso[task.setvariable variable=PATH;]${env:PATH};C:\Program Files\Cppcheck";
refreshenv
displayName: Install CppCheck
retryCountOnTaskFailure: 3
# Based on https://community.chocolatey.org/packages/cppcheck#files
# Not using chocolatey as we're getting 429 Too Many Requests
- template: steps/install-msi.yml
parameters:
url: "https://github.com/danmar/cppcheck/releases/download/2.12.0/cppcheck-2.12.0-x64-Setup.msi"
filename: "cppcheck.msi"
addToPath: "C:\\Program Files\\Cppcheck"
msiParams: "ADDLOCAL=CppcheckCore,CLI,GUI,Translations,ConfigFiles,PlatformFiles,PythonAddons,CRT"

- template: steps/clone-repo.yml
parameters:
Expand Down
11 changes: 2 additions & 9 deletions tracer/build/_build/Build.VariableGenerations.cs
Original file line number Diff line number Diff line change
Expand Up @@ -165,18 +165,11 @@ void GenerateIntegrationTestsDebuggerWindowsMatrix()
}
void GenerateIntegrationTestsWindowsAzureFunctionsMatrix()
{
// TODO: test on both x86 and x64?
// .NET Core 3.1 tests are disabled in CI because they currently fail for unknown reasons
// const string v3Install = @"choco install azure-functions-core-tools-3 --params ""'/x64'""";
// const string v3Uninstall = @"choco uninstall azure-functions-core-tools-3";
const string v4Install = @"choco install azure-functions-core-tools --params ""'/x64'""";
const string v4Uninstall = @"choco uninstall azure-functions-core-tools";
var combos = new []
{
// new {framework = TargetFramework.NETCOREAPP3_1, runtimeInstall = v3Install, runtimeUninstall = v3Uninstall },
new {framework = TargetFramework.NET6_0, runtimeInstall = v4Install, runtimeUninstall = v4Uninstall },
new {framework = TargetFramework.NET7_0, runtimeInstall = v4Install, runtimeUninstall = v4Uninstall },
new {framework = TargetFramework.NET6_0 },
new {framework = TargetFramework.NET7_0 },
};
var matrix = new Dictionary<string, object>();
Expand Down

0 comments on commit 53a2313

Please sign in to comment.