Skip to content

[image-builder-bob] Force refresh of oauth token #18620

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

Merged
merged 1 commit into from
Aug 30, 2023
Merged

Conversation

aledbf
Copy link
Member

@aledbf aledbf commented Aug 29, 2023

Description

Borrow code from the soci-snapshotter to force the refresh of the oauth token.

xref ENG-757
xref #18611

Summary generated by Copilot

🤖 Generated by Copilot at ca99984

Workaround a bug in docker authorizer that prevents token refresh for private registries. Modify proxy.go to duplicate registry responses and add a TODO comment.

Preview status

Gitpod was successfully deployed to your preview environment.

Build Options

Build
  • /werft with-werft
    Run the build with werft instead of GHA
  • leeway-no-cache
  • /werft no-test
    Run Leeway with --dont-test
Publish
  • /werft publish-to-npm
  • /werft publish-to-jb-marketplace
Installer
  • analytics=segment
  • with-dedicated-emulation
  • workspace-feature-flags
    Add desired feature flags to the end of the line above, space separated
Preview Environment / Integration Tests
  • /werft with-local-preview
    If enabled this will build install/preview
  • /werft with-preview
  • /werft with-large-vm
  • /werft with-gce-vm
    If enabled this will create the environment on GCE infra
  • with-integration-tests=workspace
    Valid options are all, workspace, webapp, ide, jetbrains, vscode, ssh. If enabled, with-preview and with-large-vm will be enabled.
  • with-monitoring

/hold

@aledbf aledbf requested a review from a team as a code owner August 29, 2023 21:48
@aledbf aledbf changed the title Force oauth token refresh [image-builder-mk3] Force refresh of oauth token Aug 29, 2023
@aledbf aledbf changed the title [image-builder-mk3] Force refresh of oauth token [image-builder-bob] Force refresh of oauth token Aug 29, 2023
kylos101
kylos101 previously approved these changes Aug 29, 2023
Copy link
Contributor

@kylos101 kylos101 left a comment

Choose a reason for hiding this comment

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

Awesome, nice find, @aledbf !

@kylos101 kylos101 self-requested a review August 29, 2023 23:53
@kylos101 kylos101 dismissed their stale review August 29, 2023 23:54

Dismissing so we can address feedback

Copy link
Contributor

@kylos101 kylos101 left a comment

Choose a reason for hiding this comment

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

@aledbf one last question.

Separate from the StatusUnauthorized change you made, what do you think of adding the below?

		if resp.StatusCode == http.StatusBadRequest {
			log.WithField("URL", resp.Request.URL.String()).Warn("bad request")
			time.Sleep(2 * time.Second) // wait for the provider
			return true, nil
		}

My thought is, this is what the user essentially did (retry), so why not have proxy automate retry on 400, too.

@aledbf
Copy link
Member Author

aledbf commented Aug 30, 2023

@aledbf one last question.

Separate from the StatusUnauthorized change you made, what do you think of adding the below?

		if resp.StatusCode == http.StatusBadRequest {
			log.WithField("URL", resp.Request.URL.String()).Warn("bad request")
			time.Sleep(2 * time.Second) // wait for the provider
			return true, nil
		}

My thought is, this is what the user essentially did (retry), so why not have proxy automate retry on 400, too.

I want to address token expiration in the PR.

Copy link
Contributor

@kylos101 kylos101 left a comment

Choose a reason for hiding this comment

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

👍 👍

@roboquat roboquat merged commit 603d2a7 into main Aug 30, 2023
@roboquat roboquat deleted the aledbf/retry branch August 30, 2023 09:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants