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

handle redirects while trying to get console output #15599

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

wfurt
Copy link
Member

@wfurt wfurt commented Mar 6, 2025

To double check:

I'm not sure if this is best fix @mmitche but at least this demonstrates the problem and outline one way how to fix it.

OsobCli exec -q osx.13.arm64   -t AAAAA   -v -c wfurt -- 'bash -c set'
No payload specified
Sending job to osx.13.arm64..
Created job list at https://helixd0107v0xd6tv7v8isja.blob.core.windows.net/helix-job-b4ae9d3c-0aa7-4a5f-a629-6770e43d22a29120eec537546f6a0/job-list-3eeed72d-d49c-4664-bc4c-96b27060b9c8.json
Sent job: https://helix.int-dot.net/api/2019-06-17/jobs/a3f2f316-6a85-4c26-a5a9-e1e7ef31ff91
Console log: 'bash-c-set' from job a3f2f316-6a85-4c26-a5a9-e1e7ef31ff91 workitem 23043c4f-8a19-4b55-a582-de6e02d3826a (osx.13.arm64) executed on machine dci-macm2-build-047 running macOS-13.7.2
BASH=/bin/bash
BASH_ARGC=()
BASH_ARGV=()
BASH_EXECUTION_STRING=set
BASH_LINENO=()
BASH_SOURCE=()
BASH_VERSINFO=([0]="3" [1]="2" [2]="57" [3]="1" [4]="release" [5]="arm64-apple-darwin22")
BASH_VERSION='3.2.57(1)-release'
DIRSTACK=()
EUID=504
GROUPS=()
....

fixes #15598

Note that I was trying to use Client.SendAsync to send the retry. But that always adds 'Authorization` header and makes the request aways fail with 403 Authorization error. (that make sense since the token was originally for different host)

@mmitche
Copy link
Member

mmitche commented Mar 6, 2025

@dotnet/dnceng or @riarenas or someone versed on the Helix side should take a look at this.

@dougbu dougbu requested a review from Copilot March 7, 2025 21:38
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR Overview

This PR addresses an issue with handling redirects while retrieving console output by detecting a 302 status and sending a new GET request without the interfering Authorization header.

  • Added a condition to check for an HTTP 302 status on the response.
  • If a redirect is detected, a new HttpClient is instantiated to retrieve the stream from the provided Location header.

Reviewed Changes

File Description
src/Microsoft.DotNet.Helix/Client/CSharp/generated-code/WorkItem.cs Added namespace reference for System.Net.Http and logic to handle HTTP redirects without the Authorization header

Copilot reviewed 1 out of 1 changed files in this pull request and generated 1 comment.

@wfurt wfurt marked this pull request as ready for review March 8, 2025 11:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ConsoleLogAsync is failing to get console output
3 participants