Always embed URL provided by user in the archive (#1413)

To keep archive creation implementation simple and prevent any
confusion, we decided to remove `--keepurl` flag and embed URL
directly without downloading the file from it . In this way, we can
ensure consistent behavior in either package creation or spec file
creation. Also, it increases the portability of spec file.
This commit is contained in:
Ta-Ching Chen
2019-11-18 10:05:49 +08:00
committed by GitHub
parent b97a3c4b0a
commit f8e98f9f14
10 changed files with 26 additions and 64 deletions
+2 -2
View File
@@ -38,7 +38,7 @@ func Commands() *cobra.Command {
// TODO retired pkg related flag from function cmd
flag.FnCode, flag.PkgSrcArchive, flag.PkgDeployArchive,
flag.HtUrl, flag.HtMethod, flag.FnKeepURL,
flag.HtUrl, flag.HtMethod,
// flag for newdeploy to use.
flag.RunTimeMinCPU, flag.RunTimeMaxCPU, flag.RunTimeMinMemory,
@@ -84,7 +84,7 @@ func Commands() *cobra.Command {
flag.FnSpecializationTimeout, flag.FnExecutionTimeout,
flag.FnCode, flag.PkgSrcArchive, flag.PkgDeployArchive,
flag.FnKeepURL, flag.FnBuildCmd, flag.PkgForce,
flag.FnBuildCmd, flag.PkgForce,
flag.RunTimeMinCPU, flag.RunTimeMaxCPU, flag.RunTimeMinMemory,
flag.RunTimeMaxMemory, flag.ReplicasMin, flag.ReplicasMax,
+3 -3
View File
@@ -169,11 +169,11 @@ func (opts *CreateSubCommand) complete(input cli.Input) error {
}
buildcmd := input.String(flagkey.PkgBuildCmd)
keepURL := input.Bool(flagkey.PkgKeepURL)
pkgName := fmt.Sprintf("%v-%v", fnName, uuid.NewV4().String())
// create new package in the same namespace as the function.
pkgMetadata, err = _package.CreatePackage(input, opts.client, fnName, fnNamespace, envName, envNamespace,
srcArchiveFiles, deployArchiveFiles, buildcmd, specDir, opts.specFile, noZip, keepURL)
pkgMetadata, err = _package.CreatePackage(input, opts.client, pkgName, fnNamespace, envName, envNamespace,
srcArchiveFiles, deployArchiveFiles, buildcmd, specDir, opts.specFile, noZip)
if err != nil {
return errors.Wrap(err, "error creating package")
}
+1 -3
View File
@@ -226,9 +226,7 @@ func (opts *UpdateSubCommand) complete(input cli.Input) error {
return errors.New("package is used by multiple functions, use --force to force update")
}
keepURL := input.Bool(flagkey.PkgKeepURL)
pkgMetadata, err = _package.UpdatePackage(opts.client, pkg, envName, envNamespace, srcArchiveFiles, deployArchiveFiles, buildcmd, false, codeFlag, keepURL)
pkgMetadata, err = _package.UpdatePackage(opts.client, pkg, envName, envNamespace, srcArchiveFiles, deployArchiveFiles, buildcmd, false, codeFlag)
if err != nil {
return errors.Wrap(err, fmt.Sprintf("error updating package '%v'", pkgName))
}