redhat-actions / openshift-tools-installer

Download, install and cache OpenShift binaries into your GitHub Actions runners.
https://github.com/marketplace/actions/openshift-tools-installer
MIT License
23 stars 24 forks source link

Fix OpenShift Mirror redirect to mirror2 #59

Closed divyansh42 closed 2 years ago

divyansh42 commented 2 years ago

Signed-off-by: divyansh42 diagrawa@redhat.com

Description

After OpenShift Mirror was redirected to the newer OpenShift Mirror (mirror2), this action started failing as it was not able to redirect. This PR includes fix for that.

Related Issue(s)

58

Checklist

Changes made

divyansh42 commented 2 years ago

The other option is to see redirect is supported in the client and explicitly turn it on.

Redirect is automatically done in http client that we are using but the redirect link provided in the Location header is not complete due to which redirect is not working,

curl -i https://mirror.openshift.com/pub/openshift-v4/clients/serverless/0.15.2 
HTTP/2 302 
content-type: application/xml
content-length: 0
date: Thu, 16 Dec 2021 05:31:27 GMT
server: AmazonS3
location: /pub/openshift-v4/x86_64/clients/serverless/0.15.2/
x-cache: Hit from cloudfront
via: 1.1 43ea48c3f6365b58e0e610399bbffb41.cloudfront.net (CloudFront)
x-amz-cf-pop: TLV50-C2
x-amz-cf-id: AC4rnmBJu0hduPCGN4Mlkvw4CjjVC9jBIm1WnQDTZskQSRVAms2tAA==
age: 29022

So we can discuss this with the OpenShift mirror team if they can provide us with the complete URL in the location header.

tetchel commented 2 years ago

Just out of curiousity I looked up the RFC for redirects and relative Location URLs are allowed.

So technically the mirror is follow the spec correctly and this should be considered a bug in the actions HTTP client that it's not resolving the relative URL to an absolute one. This is not surprising because curl and the browser correctly handle this redirect.

https://www.rfc-editor.org/rfc/rfc7231#section-7.1.2 https://www.rfc-editor.org/rfc/rfc3986#section-5.4

divyansh42 commented 2 years ago

@tetchel thanks for the pointers. I wasn't aware of this. I will open a bug in the HTTP client.