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
+4 -5
View File
@@ -70,21 +70,20 @@ func (opts *CreateSubCommand) run(input cli.Input) error {
srcArchiveFiles := input.StringSlice(flagkey.PkgSrcArchive)
deployArchiveFiles := input.StringSlice(flagkey.PkgDeployArchive)
buildcmd := input.String(flagkey.PkgBuildCmd)
keepURL := input.Bool(flagkey.PkgKeepURL)
if len(srcArchiveFiles) == 0 && len(deployArchiveFiles) == 0 {
return errors.Errorf("need --%v or --%v flag", flagkey.PkgSrcArchive, flagkey.PkgDeployArchive)
}
_, err := CreatePackage(input, opts.client, pkgName, pkgNamespace, envName, envNamespace,
srcArchiveFiles, deployArchiveFiles, buildcmd, "", "", false, keepURL)
srcArchiveFiles, deployArchiveFiles, buildcmd, "", "", false)
return err
}
// TODO: get all necessary value from CLI input directly
func CreatePackage(input cli.Input, client *client.Client, pkgName string, pkgNamespace string, envName string, envNamespace string,
srcArchiveFiles []string, deployArchiveFiles []string, buildcmd string, specDir string, specFile string, noZip bool, keepURL bool) (*metav1.ObjectMeta, error) {
srcArchiveFiles []string, deployArchiveFiles []string, buildcmd string, specDir string, specFile string, noZip bool) (*metav1.ObjectMeta, error) {
pkgSpec := fv1.PackageSpec{
Environment: fv1.EnvironmentReference{
@@ -98,7 +97,7 @@ func CreatePackage(input cli.Input, client *client.Client, pkgName string, pkgNa
if len(specFile) > 0 { // we should do this in all cases, i think
pkgStatus = fv1.BuildStatusNone
}
deployment, err := CreateArchive(client, deployArchiveFiles, noZip, keepURL, specDir, specFile)
deployment, err := CreateArchive(client, deployArchiveFiles, noZip, specDir, specFile)
if err != nil {
return nil, err
}
@@ -108,7 +107,7 @@ func CreatePackage(input cli.Input, client *client.Client, pkgName string, pkgNa
}
}
if len(srcArchiveFiles) > 0 {
source, err := CreateArchive(client, srcArchiveFiles, false, keepURL, specDir, specFile)
source, err := CreateArchive(client, srcArchiveFiles, false, specDir, specFile)
if err != nil {
return nil, err
}