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

Commit 5a3bec9

Browse files
rumplsilvin-lubecki
authored andcommitted
Remove loading app from an URL
Signed-off-by: Djordje Lukic <djordje.lukic@docker.com>
1 parent 850f5ee commit 5a3bec9

5 files changed

Lines changed: 1 addition & 32 deletions

File tree

cmd/docker-app/merge.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ func extraFiles(appname string) ([]string, error) {
4242

4343
//handleInPlace returns the operation target path and if it's in-place
4444
func handleInPlace(app *types.App) (string, bool) {
45-
if app.Source == types.AppSourceURL || app.Source == types.AppSourceImage {
45+
if app.Source == types.AppSourceImage {
4646
return internal.DirNameFromAppName(app.Name), false
4747
}
4848
return app.Path + ".tmp", true

e2e/commands_test.go

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -226,12 +226,6 @@ func TestSplitMerge(t *testing.T) {
226226
icmd.RunCmd(cmd).Assert(t, icmd.Success)
227227
}
228228

229-
func TestURL(t *testing.T) {
230-
url := "https://raw.githubusercontent.com/docker/app/v0.4.1/examples/hello-world/hello-world.dockerapp"
231-
result := icmd.RunCommand(dockerApp, "inspect", url).Assert(t, icmd.Success)
232-
golden.Assert(t, result.Combined(), "helloworld-inspect.golden")
233-
}
234-
235229
func TestWithRegistry(t *testing.T) {
236230
r := startRegistry(t)
237231
defer r.Stop(t)

internal/packager/extract.go

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ package packager
33
import (
44
"fmt"
55
"io/ioutil"
6-
"net/url"
76
"os"
87
"path/filepath"
98
"strings"
@@ -110,12 +109,6 @@ func Extract(name string, ops ...func(*types.App) error) (*types.App, error) {
110109
appname := internal.DirNameFromAppName(name)
111110
s, err := os.Stat(appname)
112111
if err != nil {
113-
// URL or docker image
114-
u, err := url.Parse(name)
115-
if err == nil && (u.Scheme == "http" || u.Scheme == "https") {
116-
ops = append(ops, types.WithSource(types.AppSourceURL))
117-
return loader.LoadFromURL(name, ops...)
118-
}
119112
// look for a docker image
120113
ops = append(ops, types.WithSource(types.AppSourceImage))
121114
app, err := extractImage(name, ops...)

loader/loader.go

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ package loader
33
import (
44
"io"
55
"io/ioutil"
6-
"net/http"
76
"os"
87
"path/filepath"
98
"strings"
@@ -14,21 +13,6 @@ import (
1413
"github.com/pkg/errors"
1514
)
1615

17-
// LoadFromURL loads a docker app from an URL that should return a single-file app.
18-
func LoadFromURL(url string, ops ...func(*types.App) error) (*types.App, error) {
19-
resp, err := http.Get(url)
20-
if err != nil {
21-
return nil, errors.Wrap(err, "failed to download "+url)
22-
}
23-
if resp.Body != nil {
24-
defer resp.Body.Close()
25-
}
26-
if resp.StatusCode != 200 {
27-
return nil, errors.Errorf("failed to download %s: %s", url, resp.Status)
28-
}
29-
return LoadFromSingleFile(url, resp.Body, ops...)
30-
}
31-
3216
// LoadFromSingleFile loads a docker app from a single-file format (as a reader)
3317
func LoadFromSingleFile(path string, r io.Reader, ops ...func(*types.App) error) (*types.App, error) {
3418
data, err := ioutil.ReadAll(r)

types/types.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,6 @@ const (
2626
AppSourceMerged
2727
// AppSourceImage represents an Application pulled from an image
2828
AppSourceImage
29-
// AppSourceURL represents an Application fetched from an URL
30-
AppSourceURL
3129
// AppSourceArchive represents an Application in an archive format
3230
AppSourceArchive
3331
)

0 commit comments

Comments
 (0)