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

fix(docker): added a workaround for port not being set correctly during a redirect to S3 #4733

Merged
merged 4 commits into from Nov 3, 2019

Conversation

fullstackzach
Copy link
Contributor

@fullstackzach fullstackzach commented Oct 27, 2019

The got module has a known bug (sindresorhus/got#719) where if a request is made with a port (for example 5000) and a redirect is returned, got will use the original request's port (5000) except the redirected endpoint is likely expecting 80 or 443 if its AWS s3. If a port is specified in the redirect url, then got uses the new port.

This PR adds a workaround to check to see if there is a port in the url returned by a redirect when attempting to download the docker image blob. If there is not one, then it deletes it from the redirect options and then got will use 80 or 443 as a default. This can probably be removed when Renovate upgrades to got v10.

I had a lot of trouble trying to get the new tests to run in inside datasource/docker.spec.ts since got is mocked there already, and I couldn't get it to unmock. So, I created a new test file instead using nock to try different port combinations between the get and redirect requests. Let me know if you have feedback, I'm willing to make adjustments - Also, I'm fairly new to typescript myself and still learning it.

I'm excited to see this be merged in, once it is, we can begin to renovate dockerfiles!

Closes #4593

@fullstackzach fullstackzach changed the title fix(docker): added a workaround for ports not being set correctly during a redirect to S3 fix(docker): added a workaround for port not being set correctly during a redirect to S3 Oct 27, 2019
@rarkins rarkins merged commit b3a2567 into renovatebot:master Nov 3, 2019
@renovate-release
Copy link
Collaborator

🎉 This PR is included in version 19.66.2 🎉

The release is available on:

Your semantic-release bot 📦🚀

@fullstackzach fullstackzach deleted the docker-port-redirect-fix branch November 4, 2019 03:23
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Dec 16, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

When docker registry redirects to S3, "got" doesn't clear the port in the redirect
3 participants