Allow using URL as archive source when creating functions (#1360)
In the case of large files, it takes a long time for the user to download the source from the URL and upload it to StorgeSvc through CLI. This PR allows a user to use URL as the function source when creating a function and provides a new flag "--keeparchiveurl" to let the user to decided whether the CLI should download the file first or store the file URL in the archive directly. If "--keeparchiveurl" is true, then no checksum will be generated, it's the user's responsibility to ensure the file won't be changed.
This commit is contained in:
@@ -281,7 +281,7 @@ func applyArchives(fclient *client.Client, specDir string, fr *FissionResources)
|
||||
fmt.Printf("uploading archive %v\n", name)
|
||||
// ar.URL is actually a local filename at this stage
|
||||
ctx := context.Background()
|
||||
uploadedAr, err := pkgutil.UploadArchive(ctx, fclient, ar.URL)
|
||||
uploadedAr, err := pkgutil.UploadArchiveFile(ctx, fclient, ar.URL)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -461,7 +461,7 @@ func localArchiveFromSpec(specDir string, aus *spectypes.ArchiveUploadSpec) (*fv
|
||||
}, nil
|
||||
} else {
|
||||
// checksum
|
||||
csum, err := utils.FileChecksum(archiveFileName)
|
||||
csum, err := utils.GetFileChecksum(archiveFileName)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to calculate archive checksum for %v (%v): %v", aus.Name, archiveFileName, err)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user