Skip to content
This repository was archived by the owner on Jul 18, 2025. It is now read-only.

Add support for loading URLs.#356

Merged
mnottale merged 1 commit intodocker-archive-public:masterfrom
mnottale:load-from-url
Aug 28, 2018
Merged

Add support for loading URLs.#356
mnottale merged 1 commit intodocker-archive-public:masterfrom
mnottale:load-from-url

Conversation

@mnottale
Copy link
Copy Markdown
Contributor

Signed-off-by: Matthieu Nottale matthieu.nottale@docker.com

- What I did

Add support from loading docker-app from an URL (http or https).

- How I did it

Hook Extract(), add a loader.LoadFromURL.

- How to verify it

docker-app render someURL

- Description for the changelog

  • Applications can be loaded from an http or https URL.

@codecov
Copy link
Copy Markdown

codecov Bot commented Aug 23, 2018

Codecov Report

Merging #356 into master will increase coverage by 0.03%.
The diff coverage is 66.66%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #356      +/-   ##
==========================================
+ Coverage   58.63%   58.66%   +0.03%     
==========================================
  Files          56       56              
  Lines        2833     2845      +12     
==========================================
+ Hits         1661     1669       +8     
- Misses        944      946       +2     
- Partials      228      230       +2
Impacted Files Coverage Δ
internal/packager/extract.go 66.66% <100%> (+1.33%) ⬆️
loader/loader.go 85.45% <55.55%> (-5.85%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 32f58af...1dae8e1. Read the comment docs.

Copy link
Copy Markdown
Contributor

@chris-crone chris-crone left a comment

Choose a reason for hiding this comment

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

LGTM, just missing a test

Comment thread loader/loader.go
if err != nil {
return nil, errors.Wrap(err, "failed to download "+url)
}
return LoadFromSingleFile(url, resp.Body, ops...)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

if resp.Body != nil{
 defer resp.Body.Close()
}

Comment thread loader/loader.go
if err != nil {
return nil, errors.Wrap(err, "failed to download "+url)
}
return LoadFromSingleFile(url, resp.Body, ops...)
Copy link
Copy Markdown
Contributor

@silvin-lubecki silvin-lubecki Aug 23, 2018

Choose a reason for hiding this comment

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

What if the response is anything but 200 ? We should return an error here before calling LoadFromSingleFile.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I assumed it would err but you're right it doesn't. Fixed.

Copy link
Copy Markdown
Contributor

@vdemeester vdemeester left a comment

Choose a reason for hiding this comment

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

How do we handle docker-app render https://foo.bar/apps/my.dockerapp.tar.gz (or even a my.dockerapp that is a tarball) ?

We shouldn't make the assumption that the downloaded URL is always a single-file app

@mnottale
Copy link
Copy Markdown
Contributor Author

We don't. This is out of scope for this PR.

Copy link
Copy Markdown
Contributor

@silvin-lubecki silvin-lubecki left a comment

Choose a reason for hiding this comment

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

LGTM, with a test? 😅

@mnottale
Copy link
Copy Markdown
Contributor Author

e2e test added

@chris-crone
Copy link
Copy Markdown
Contributor

@vdemeester are you OK with handling other package formats in a followup?

Copy link
Copy Markdown
Contributor

@vdemeester vdemeester left a comment

Choose a reason for hiding this comment

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

SGTM 🐸

Signed-off-by: Matthieu Nottale <matthieu.nottale@docker.com>
@mnottale mnottale merged commit 1a43d0e into docker-archive-public:master Aug 28, 2018
@mnottale mnottale deleted the load-from-url branch August 28, 2018 12:27
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants