From 772fdfa15ce5f69a581212ae7fa2371f2ca50ab8 Mon Sep 17 00:00:00 2001 From: smruthi2187 <34555664+smruthi2187@users.noreply.github.com> Date: Tue, 24 Apr 2018 00:24:46 -0700 Subject: [PATCH] Setting package buildStatus to pending when functions source is updated. (#637) --- fission/function.go | 4 ++++ fission/package.go | 9 ++++++--- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/fission/function.go b/fission/function.go index 92c67ee3..bdbbfba6 100644 --- a/fission/function.go +++ b/fission/function.go @@ -393,6 +393,10 @@ func fnUpdate(c *cli.Context) error { fatal("Need --env or --deploy or --src or --pkg or --entrypoint or --buildcmd or --secret or --secretNamespace or --configmap or --configmapNamespace argument.") } + if len(srcArchiveName) > 0 && len(deployArchiveName) > 0 { + fatal("Need either of --src or --deploy and not both arguments.") + } + if len(secretName) > 0 { if len(function.Spec.Secrets) > 1 { fatal("Please use 'fission spec apply' to update list of secrets") diff --git a/fission/package.go b/fission/package.go index 02250e4c..b562ca8d 100644 --- a/fission/package.go +++ b/fission/package.go @@ -98,6 +98,10 @@ func pkgUpdate(c *cli.Context) error { deployArchiveName := c.String("deploy") buildcmd := c.String("buildcmd") + if len(srcArchiveName) > 0 && len(deployArchiveName) > 0 { + fatal("Need either of --src or --deploy and not both arguments.") + } + if len(srcArchiveName) == 0 && len(deployArchiveName) == 0 && len(envName) == 0 && len(buildcmd) == 0 { fatal("Need --env or --src or --deploy or --buildcmd argument.") @@ -158,9 +162,8 @@ func updatePackage(client *client.Client, pkg *crd.Package, envName, pkg.Spec.Deployment = *deployArchiveMetadata } - // Set package as pending status only when there is no - // deploy archive. - if needToBuild && len(pkg.Spec.Deployment.Type) == 0 { + // Set package as pending status when needToBuild is true + if needToBuild { // change into pending state to trigger package build pkg.Status = fission.PackageStatus{ BuildStatus: fission.BuildStatusPending,