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:
@@ -298,9 +298,11 @@ func fnCreate(c *cli.Context) error {
|
||||
}
|
||||
|
||||
buildcmd := c.String("buildcmd")
|
||||
keepURL := c.Bool("keepurl")
|
||||
|
||||
// create new package in the same namespace as the function.
|
||||
pkgMetadata, err = _package.CreatePackage(c, client, fnNamespace, envName, envNamespace, srcArchiveFiles, deployArchiveFiles, buildcmd, specDir, specFile, noZip)
|
||||
pkgMetadata, err = _package.CreatePackage(c, client, fnNamespace, envName, envNamespace,
|
||||
srcArchiveFiles, deployArchiveFiles, buildcmd, specDir, specFile, noZip, keepURL)
|
||||
util.CheckErr(err, "create package")
|
||||
}
|
||||
|
||||
@@ -637,7 +639,9 @@ func fnUpdate(c *cli.Context) error {
|
||||
log.Fatal("Package is used by multiple functions, use --force to force update")
|
||||
}
|
||||
|
||||
pkgMetadata, err = _package.UpdatePackage(client, pkg, envName, envNamespace, srcArchiveFiles, deployArchiveFiles, buildcmd, false, codeFlag)
|
||||
keepURL := c.Bool("keepurl")
|
||||
|
||||
pkgMetadata, err = _package.UpdatePackage(client, pkg, envName, envNamespace, srcArchiveFiles, deployArchiveFiles, buildcmd, false, codeFlag, keepURL)
|
||||
util.CheckErr(err, fmt.Sprintf("update package '%v'", pkgName))
|
||||
|
||||
fmt.Printf("package '%v' updated\n", pkgMetadata.GetName())
|
||||
|
||||
Reference in New Issue
Block a user