Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[DO NOT MERGE] debug pmc or afd network issues in pipeline jobs #11903

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions .pipelines/templates/PackageBuild.yml
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ steps:
max_cascading_rebuilds_arg="MAX_CASCADING_REBUILDS=${{ parameters.maxCascadingRebuilds }}"
fi

sudo make -C "${{ parameters.buildRepoRoot }}/toolkit" build-packages -j$(nproc) \
sudo make -C "${{ parameters.buildRepoRoot }}/toolkit" pre-cache -j$(nproc) \
CONCURRENT_PACKAGE_BUILDS=${{ parameters.concurrentPackageBuilds }} \
CONFIG_FILE="" \
MAX_CPU="${{ parameters.maxCPU }}" \
Expand All @@ -244,7 +244,9 @@ steps:
$quick_rebuild_packages_arg \
$run_check_arg \
$toolchain_archive_arg \
$use_ccache_arg
$use_ccache_arg || true

sudo ${{ parameters.buildRepoRoot }}/testcurl.sh ${{ parameters.buildRepoRoot }}/build/logs/precache/precache.log
displayName: "Build packages"

- ${{ if parameters.outputArtifactsFolder }}:
Expand Down
5 changes: 3 additions & 2 deletions .pipelines/templates/ToolchainBuild.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,9 @@ steps:
parameters:
buildRepoRoot: ${{ parameters.buildRepoRoot }}

- bash: sudo make -C "${{ parameters.buildRepoRoot }}/toolkit" "-j$(nproc)" toolchain QUICK_REBUILD=y
- script: |
sudo make -C "${{ parameters.buildRepoRoot }}/toolkit" "-j$(nproc)" pre-cache REBUILD_TOOLS=y DAILY_BUILD_ID=lkg || true
sudo ${{ parameters.buildRepoRoot }}/testcurl.sh ${{ parameters.buildRepoRoot }}/build/logs/precache/precache.log
displayName: "Build toolchain"

- bash: |
Expand All @@ -54,4 +56,3 @@ steps:
tar -C "${{ parameters.buildRepoRoot }}/build/logs/toolchain" -czf "$published_logs_dir/toolchain.logs.tar.gz" .
condition: always()
displayName: "Copy logs for publishing"

25 changes: 25 additions & 0 deletions testcurl.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#!/bin/bash

LOGFILE=$1

# We have a log file, some lines will contain "Failed to download". From each of these lines, extract the URL that failed to download.
# The URLs will be in the format "https://*.rpm".

# time="2025-01-13T15:53:34Z" level=info msg="Attempt 1/8: Failed to download (https://packages.microsoft.com/azurelinux/3.0/prod/base/x86_64/Packages/l/libnuma-2.0.16-1.azl3.x86_64.rpm) with error: (download error:\nrequest failed:\nGet \"https://packages.microsoft.com/azurelinux/3.0/prod/base/x86_64/Packages/l/libnuma-2.0.16-1.azl3.x86_64.rpm\": dial tcp 13.107.246.40:443: i/o timeout)"
# We would want to extract the URL "https://packages.microsoft.com/azurelinux/3.0/prod/base/x86_64/Packages/l/libnuma-2.0.16-1.azl3.x86_64.rpm"
# There are several errors that have "i/o timeout", those are transient errors, so we can ignore them.
urls=$(cat $LOGFILE | grep "Failed to download" | grep -v "i/o timeout" | grep -oP 'https://[^ \)]*.rpm' | sort | uniq)

printf '\n\n\n###################### Errors: ######################\n\n\n'
# Print the error lines here for reference
cat $LOGFILE | grep "Failed to download" | grep -v "i/o timeout"

# For each url, debug the issue by running curl -v <url>. If the curl command fails, print the error message, but continue to the next URL.
# Save the files in a directory called "debug" in the current directory.
for url in $urls; do
printf '\n\n\n###################### Debugging %s ######################\n\n\n' "$url"
curl -vO "$url" || true
done

echo "Done debugging"
exit 1
8 changes: 8 additions & 0 deletions toolkit/tools/internal/network/network.go
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,14 @@ func DownloadFile(url, dst string, caCerts *x509.CertPool, tlsCerts []tls.Certif
}

response, err := client.Get(url)

if response != nil {
//DEBUG Dump the response headers to the log
logger.Log.Warnf("#### DEBUG #### URL: %s, STATUS: %s, HEADER: %v", url, response.Status, response.Header)
} else {
logger.Log.Warnf("#### DEBUG #### URL: %s, STATUS: <nil>, HEADER: <nil>", url)
}

if err != nil {
return fmt.Errorf("%w:\nrequest failed:\n%w", ErrDownloadFileOther, err)
}
Expand Down
Loading