Skip to content

Commit 8f877ab

Browse files
Merge branch 'master' into nacho/RetrryDownloadLibDatadog
2 parents 6fdee61 + b70d8ff commit 8f877ab

File tree

81 files changed

+1984
-1144
lines changed

Some content is hidden

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

81 files changed

+1984
-1144
lines changed

.azure-pipelines/steps/clone-repo.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@ steps:
3030
echo "Adding remote $BUILD_REPOSITORY_URI ..."
3131
git remote add origin "$BUILD_REPOSITORY_URI"
3232
git config gc.auto 0
33+
git config http.retry $(GIT_HTTP_RETRY)
34+
git config http.retryDelay $(GIT_HTTP_RETRY_DELAY)
3335
git config --get-all http.$BUILD_REPOSITORY_URI.extraheader
3436
git config --get-all http.extraheader
3537
git config --get-regexp .*extraheader
@@ -104,6 +106,8 @@ steps:
104106
git remote add origin "$repoUri"
105107
106108
git config gc.auto 0
109+
git config http.retry $(GIT_HTTP_RETRY)
110+
git config http.retryDelay $(GIT_HTTP_RETRY_DELAY)
107111
git config --get-all http.$repoUri.extraheader
108112
git config --get-all http.extraheader
109113
git config --get-regexp .*extraheader

.azure-pipelines/steps/install-docker-compose-v1.yml

Lines changed: 28 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,40 @@ parameters:
1010
steps:
1111
- ${{ if eq(parameters.isLinux, true) }}:
1212
- bash: |
13-
sudo mkdir -p "$(dirname "${{ parameters.dockerComposePath }}")"
14-
sudo curl -SL https://github.com/docker/compose/releases/download/1.29.2/docker-compose-linux-x86_64 -o ${{ parameters.dockerComposePath }}
13+
sudo mkdir -p "$(dirname "${{ parameters.dockerComposePath }}")"
14+
sudo curl -SL $(CURL_RETRY_FLAGS) \
15+
https://github.com/docker/compose/releases/download/1.29.2/docker-compose-linux-x86_64 \
16+
-o ${{ parameters.dockerComposePath }}
1517
sudo chmod 755 ${{ parameters.dockerComposePath }}
1618
displayName: Download docker-compose
1719
- ${{ else }}:
1820
- powershell: |
1921
$dir= (Split-Path -parent "${{ parameters.dockerComposePath }}")
2022
mkdir -f -p $dir
23+
2124
# GitHub now requires TLS1.2. In PowerShell, run the following
2225
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
23-
Invoke-WebRequest "https://github.com/docker/compose/releases/download/1.29.1/docker-compose-windows-x86_64.exe" -OutFile "${{ parameters.dockerComposePath }}"
26+
27+
# Download with retry logic (inlined to avoid file dependency issues)
28+
$uri = "https://github.com/docker/compose/releases/download/1.29.1/docker-compose-windows-x86_64.exe"
29+
$outFile = "${{ parameters.dockerComposePath }}"
30+
$maxRetries = $(PWSH_MAX_RETRY_COUNT)
31+
$retryIntervalSec = $(PWSH_RETRY_INTERVAL_SEC)
32+
$timeoutSec = $(PWSH_TIMEOUT_SEC)
33+
34+
for ($i = 0; $i -le $maxRetries; $i++) {
35+
try {
36+
Write-Host "Attempt $($i + 1) of $($maxRetries + 1): Downloading from $uri"
37+
Invoke-WebRequest -Uri $uri -OutFile $outFile -TimeoutSec $timeoutSec
38+
Write-Host "Download successful"
39+
break
40+
} catch {
41+
if ($i -eq $maxRetries) {
42+
Write-Host "All retry attempts failed"
43+
throw
44+
}
45+
Write-Host "Download failed: $($_.Exception.Message). Retrying in $retryIntervalSec seconds..."
46+
Start-Sleep -Seconds $retryIntervalSec
47+
}
48+
}
2449
displayName: Download docker-compose

.azure-pipelines/steps/install-dotnet-sdk-manually.yml

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,30 @@ steps:
2020
$sdkVersion = "${{ parameters.sdkVersion }}"
2121
2222
echo "Downloading dotnet-install.ps1"
23-
Invoke-WebRequest -Uri "https://raw.githubusercontent.com/dotnet/install-scripts/2bdc7f2c6e00d60be57f552b8a8aab71512dbcb2/src/dotnet-install.ps1" -OutFile dotnet-install.ps1
23+
24+
# Download with retry logic (inlined to avoid file dependency issues)
25+
$uri = "https://raw.githubusercontent.com/dotnet/install-scripts/2bdc7f2c6e00d60be57f552b8a8aab71512dbcb2/src/dotnet-install.ps1"
26+
$outFile = "dotnet-install.ps1"
27+
$maxRetries = $(PWSH_MAX_RETRY_COUNT)
28+
$retryIntervalSec = $(PWSH_RETRY_INTERVAL_SEC)
29+
$timeoutSec = $(PWSH_TIMEOUT_SEC)
30+
31+
for ($i = 0; $i -le $maxRetries; $i++) {
32+
try {
33+
Write-Host "Attempt $($i + 1) of $($maxRetries + 1): Downloading from $uri"
34+
Invoke-WebRequest -Uri $uri -OutFile $outFile -TimeoutSec $timeoutSec
35+
Write-Host "Download successful"
36+
break
37+
} catch {
38+
if ($i -eq $maxRetries) {
39+
Write-Host "All retry attempts failed"
40+
throw
41+
}
42+
Write-Host "Download failed: $($_.Exception.Message). Retrying in $retryIntervalSec seconds..."
43+
Start-Sleep -Seconds $retryIntervalSec
44+
}
45+
}
46+
2447
$dotnetInstall = "./dotnet-install.ps1"
2548
echo "Downloaded dotnet-install.ps1 to $dotnetInstall"
2649

.azure-pipelines/steps/install-dotnet.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,27 +6,31 @@ parameters:
66
steps:
77
- task: UseDotNet@2
88
displayName: install dotnet core ${{ parameters.packageType }} 2.1
9+
condition: not(and(eq(variables['Agent.OS'], 'Darwin'), eq(variables['Agent.OSArchitecture'], 'ARM64'))) # not available on macos ARM64
910
inputs:
1011
packageType: ${{ parameters.packageType }}
1112
version: 2.1.x
1213
retryCountOnTaskFailure: 5
1314

1415
- task: UseDotNet@2
1516
displayName: install dotnet core ${{ parameters.packageType }} 3.0
17+
condition: not(and(eq(variables['Agent.OS'], 'Darwin'), eq(variables['Agent.OSArchitecture'], 'ARM64'))) # not available on macos ARM64
1618
inputs:
1719
packageType: ${{ parameters.packageType }}
1820
version: 3.0.x
1921
retryCountOnTaskFailure: 5
2022

2123
- task: UseDotNet@2
2224
displayName: install dotnet core ${{ parameters.packageType }} 3.1
25+
condition: not(and(eq(variables['Agent.OS'], 'Darwin'), eq(variables['Agent.OSArchitecture'], 'ARM64'))) # not available on macos ARM64
2326
inputs:
2427
packageType: ${{ parameters.packageType }}
2528
version: 3.1.x
2629
retryCountOnTaskFailure: 5
2730

2831
- task: UseDotNet@2
2932
displayName: install dotnet core ${{ parameters.packageType }} 5.0
33+
condition: not(and(eq(variables['Agent.OS'], 'Darwin'), eq(variables['Agent.OSArchitecture'], 'ARM64'))) # not available on macos ARM64
3034
inputs:
3135
packageType: ${{ parameters.packageType }}
3236
version: 5.0.x

.azure-pipelines/steps/install-msi.yml

Lines changed: 24 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,28 @@ steps:
2424
$url = "${{ parameters.url }}";
2525
$file = "$(Agent.TempDirectory)\${{ parameters.filename }}"
2626
Write-Host "Downloading from $url to $file";
27-
Invoke-WebRequest -Uri $url -OutFile $file
28-
27+
28+
# Download with retry logic (inlined to avoid file dependency issues)
29+
$maxRetries = $(PWSH_MAX_RETRY_COUNT)
30+
$retryIntervalSec = $(PWSH_RETRY_INTERVAL_SEC)
31+
$timeoutSec = $(PWSH_TIMEOUT_SEC)
32+
33+
for ($i = 0; $i -le $maxRetries; $i++) {
34+
try {
35+
Write-Host "Attempt $($i + 1) of $($maxRetries + 1): Downloading from $url"
36+
Invoke-WebRequest -Uri $url -OutFile $file -TimeoutSec $timeoutSec
37+
Write-Host "Download successful"
38+
break
39+
} catch {
40+
if ($i -eq $maxRetries) {
41+
Write-Host "All retry attempts failed"
42+
throw
43+
}
44+
Write-Host "Download failed: $($_.Exception.Message). Retrying in $retryIntervalSec seconds..."
45+
Start-Sleep -Seconds $retryIntervalSec
46+
}
47+
}
48+
2949
$installArgs = "/i $file ${{ parameters.msiParams }} /norestart"
3050
Write-Host "Installing using msiexec $installArgs";
3151
Start-Process msiexec $installArgs -Wait
@@ -35,10 +55,10 @@ steps:
3555
Write-Host "Adding to PATH";
3656
Write-Host "##vso[task.setvariable variable=PATH;]${env:PATH};${{ parameters.addToPath }}";
3757
}
38-
58+
3959
Import-Module $env:ChocolateyInstall\helpers\chocolateyProfile.psm1
4060
refreshenv
4161
displayName: Installing ${{ parameters.filename }}
42-
condition: and(succeeded(), eq(variables['Agent.OS'], 'Windows_NT')) # TODO: error on non-windows?
62+
condition: and(succeeded(), eq(variables['Agent.OS'], 'Windows_NT')) # TODO: error on non-windows?
4363
retryCountOnTaskFailure: ${{ parameters.retries }}
4464
timeoutInMinutes: 10

.azure-pipelines/steps/update-github-status.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,12 @@ steps:
2323
for stageToSkip in $allChecks; do
2424
TARGET_URL="https://dev.azure.com/datadoghq/$(AZURE_PROJECT_NAME)/_build/results?buildId=$(Build.BuildId)"
2525
curl_fail_with_body -X POST --silent --show-error \
26+
$(CURL_RETRY_FLAGS) \
2627
-H "Accept: application/vnd.github.v3+json" \
2728
-H "Authorization: token $GITHUB_TOKEN" \
2829
-H "X-GitHub-Api-Version: 2022-11-28" \
2930
https://api.github.com/repos/DataDog/$(GITHUB_REPOSITORY_NAME)/statuses/$(OriginalCommitId) \
30-
-d '{"state":"${{ parameters.status }}","context":"'"$stageToSkip"'","description":"${{ parameters.description }}","target_url":"'"$TARGET_URL"'"}'
31+
-d '{"state":"${{ parameters.status }}","context":"'"$stageToSkip"'","description":"${{ parameters.description }}","target_url":"'"$TARGET_URL"'"}'
3132
done
3233
displayName: Set GitHub Status ${{ parameters.status }}
3334
failOnStderr: true

.azure-pipelines/ultimate-pipeline.yml

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,14 @@ variables:
9898
OriginalCommitId: $[coalesce(variables['System.PullRequest.SourceCommitId'], variables['Build.SourceVersion'])]
9999
NUGET_ENABLE_EXPERIMENTAL_HTTP_RETRY: true
100100
NUGET_EXPERIMENTAL_CHAIN_BUILD_RETRY_POLICY: 3,1000
101+
# Retry parameters for network operations to improve CI resilency
102+
CURL_RETRY_FLAGS: '--retry 5 --retry-delay 2 --retry-connrefused --connect-timeout 30 --max-time 120'
103+
GIT_RETRY_CONFIG: '-c http.retry=5 -c http.retryDelay=2'
104+
GIT_HTTP_RETRY: 5
105+
GIT_HTTP_RETRY_DELAY: 2
106+
PWSH_MAX_RETRY_COUNT: 5
107+
PWSH_RETRY_INTERVAL_SEC: 2
108+
PWSH_TIMEOUT_SEC: 120
101109
DefaultTimeout: 60
102110
DD_INSTRUMENTATION_TELEMETRY_ENABLED: 0
103111
NUKE_TELEMETRY_OPTOUT: 1
@@ -198,7 +206,7 @@ stages:
198206
echo "Using target branch $TARGET_BRANCH"
199207
200208
rm -rf ./s
201-
git clone --quiet --no-checkout --depth 1 --branch $TARGET_BRANCH $BUILD_REPOSITORY_URI ./s
209+
git $(GIT_RETRY_CONFIG) clone --quiet --no-checkout --depth 1 --branch $TARGET_BRANCH $BUILD_REPOSITORY_URI ./s
202210
cd s
203211
TARGET_SHA=$(git rev-parse origin/$TARGET_BRANCH)
204212
rm -rf ./s
@@ -4258,7 +4266,8 @@ stages:
42584266
REF=$(Build.SourceBranch)
42594267
BRANCH_NAME="latest_snapshot"
42604268
if [ "$(Build.Reason)" = "PullRequest" ]; then
4261-
LABELS=$(curl -s -H "Authorization: token $GITHUB_TOKEN" \
4269+
LABELS=$(curl -s $(CURL_RETRY_FLAGS) \
4270+
-H "Authorization: token $GITHUB_TOKEN" \
42624271
"https://api.github.com/repos/DataDog/dd-trace-dotnet/pulls/$(System.PullRequest.PullRequestNumber)" \
42634272
| jq -r '.labels[].name')
42644273
@@ -4277,6 +4286,7 @@ stages:
42774286
42784287
echo "Creating dispatch event for https://github.com/DataDog/dd-trace-dotnet/actions/workflows/create-system-test-docker-base-images.yml with ref=$REF and azdo_build_id=$(Build.BuildId) and is_release_version=False"
42794288
curl \
4289+
$(CURL_RETRY_FLAGS) \
42804290
-X POST \
42814291
-H "Accept: application/vnd.github+json" \
42824292
-H "Authorization: token $GITHUB_TOKEN"\
@@ -4734,7 +4744,7 @@ stages:
47344744
versionSpec: '3.12'
47354745
displayName: Install python 3.12
47364746

4737-
- script: git clone --depth 1 https://github.com/DataDog/system-tests.git
4747+
- script: git $(GIT_RETRY_CONFIG) clone --depth 1 https://github.com/DataDog/system-tests.git
47384748
displayName: Get system tests repo
47394749

47404750
- script: |
@@ -4836,7 +4846,7 @@ stages:
48364846
versionSpec: '3.12'
48374847
displayName: Install python 3.12
48384848

4839-
- script: git clone --depth 1 https://github.com/DataDog/system-tests.git
4849+
- script: git $(GIT_RETRY_CONFIG) clone --depth 1 https://github.com/DataDog/system-tests.git
48404850
displayName: Get system tests repo
48414851

48424852
- template: steps/download-artifact.yml
@@ -6284,7 +6294,7 @@ stages:
62846294
62856295
- script: |
62866296
python --version
6287-
pip install ddapm-test-agent
6297+
pip install --retries 5 --timeout 120 ddapm-test-agent
62886298
62896299
# copied from run-snapshot-test
62906300
echo "##vso[task.setvariable variable=TOKEN]$(System.JobId)"
@@ -6304,6 +6314,7 @@ stages:
63046314
failOnStderr: true
63056315
63066316
- script: |
6317+
dotnet --info
63076318
dotnet tool install dd-trace --tool-path $(smokeTestAppDir)/publish --add-source $(smokeTestAppDir)/artifacts/. --version $(ToolVersion)
63086319
displayName: Install tracer
63096320

0 commit comments

Comments
 (0)