Bug 1987257

Summary: Go-http-client user-agent being used for oc adm mirror requests
Product: OpenShift Container Platform Reporter: Timothy Rees <trees>
Component: ocAssignee: Maciej Szulik <maszulik>
oc sub component: oc QA Contact: zhou ying <yinzhou>
Status: CLOSED ERRATA Docs Contact:
Severity: medium    
Priority: unspecified CC: aos-bugs, mfojtik, trees
Version: 4.8   
Target Milestone: ---   
Target Release: 4.10.0   
Hardware: All   
OS: All   
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Cause: User agent string incorrect in some mirror requests Consequence: The default Go user agent string is used instead of the user agent string for oc Fix: Set the correct user agent string for all mirror requests Result: The expected oc user agent string is now sent to registries
Story Points: ---
Clone Of: Environment:
Last Closed: 2022-03-11 18:15:11 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Description Flags
Kibana screenshot for quay.io logs none

Description Timothy Rees 2021-07-29 10:54:24 UTC
Created attachment 1807043 [details]
Kibana screenshot for quay.io logs

Created attachment 1807043 [details]
Kibana screenshot for quay.io logs

Description of problem:

oc command is inconsistent with user-agent when making requests to registries for mirroring OCP4 core payload.  There was an attempt to address this with https://github.com/openshift/oc/pull/841 , but it has only caught one of the 2 registry requests which show in quay.io logs.

Attached is the screenshot for 2 log entries which are created on quay.io when oc adm mirror is run, along with the kibana json outputs for each request.

Command which I ran:

oc adm release mirror -a ${LOCAL_SECRET_JSON} \

Environment vars:
export OCP_RELEASE=4.8.2
export LOCAL_REGISTRY="registry.redacted.com"
export LOCAL_REPOSITORY=trees/openshift48
export PRODUCT_REPO='openshift-release-dev'
export LOCAL_SECRET_JSON='/Users/trees/tmp/secret.json'
export RELEASE_NAME="ocp-release"
export ARCHITECTURE="x86_64"

Version-Release number of selected component (if applicable):

oc 4.8.2

How reproducible:


Steps to Reproduce:
1.  Run oc adm mirror per the openshift docs
2.  Verify on the logs for the container registry (quay.io) the user-agent used

Actual results:

First log entry for user-agent is 'Go-http-client/2.0'
Second log entry for user-agent is 'oc/4.8.0 (darwin/amd64) kubernetes/1077b05'

Expected results:

Both log entries for user-agent is 'oc/4.8.0 (darwin/amd64) kubernetes/1077b05'

Comment 3 Maciej Szulik 2021-08-19 14:07:27 UTC
Ross I did some initial changes in https://github.com/openshift/oc/pull/841 but Tim claims there's one more edge case not covered.

Comment 9 Arda Guclu 2022-12-08 10:28:54 UTC
*** Bug 1987260 has been marked as a duplicate of this bug. ***