New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Provide an easier way to create archive for pkg #769

Closed
life1347 opened this Issue Jul 3, 2018 · 8 comments

Comments

Projects
None yet
5 participants
@life1347
Member

life1347 commented Jul 3, 2018

It will be nice to provide additional flags to create archive when creating function/pkg.

Solution 1. Add new flags

--sourcearchive value, --src value     Local path or URL for source archive
--deployarchive value, --deploy value  Local path or URL for binary archive
--sourcedir value, --srcdir value     Local path for source directory
--deploydir value, --deploydir value     Local path for deploy directory

Solution 2. Change behavior of current flag, and retired some flag alias.

--src value     Local path to source directory/archive or URL for source archive
--deploy value  Local path to deployment directory/archive or URL for deployment archive
@erwinvaneyk

This comment has been minimized.

Member

erwinvaneyk commented Jul 3, 2018

Agree fully with solving this issue. Though I am a bit worried that we degrade user experience if we keep adding parameters to the command.

What about allowing users to simply input a directory for --src or --deploy, and let the CLI handle both cases based on whether the input is a file, glob or a directory?

@erwinvaneyk

This comment has been minimized.

Member

erwinvaneyk commented Jul 3, 2018

--src hello.go => build single file
--src hello.go --src world.go or --src *.go => build package from multiple files
--src myFnDir/ => build package from directory

@life1347

This comment has been minimized.

Member

life1347 commented Jul 3, 2018

@erwinvaneyk Oh! You're absolutely right! In this way, we don't need to add more flags to CLI

@life1347

This comment has been minimized.

Member

life1347 commented Jul 3, 2018

But looks like we need to retire sourcearchive and deployarchive as well to avoid confusion.
And --src hello.go --src world.go is not possible for now due to pkg constraint.

@erwinvaneyk

This comment has been minimized.

Member

erwinvaneyk commented Jul 3, 2018

I am all in favor of retiring some of the parameters, but I imagine that that is part of another discussion/issue. 😄

And --src hello.go --src world.go is not possible for now due to pkg constraint.

Could you explain this constraint a bit?

@life1347

This comment has been minimized.

Member

life1347 commented Jul 27, 2018

Sorry, I missed the thread notification. Originally, I thought that the flag can only accept one input, but I noticed we can use StringSlice to handle multiple inputs so the constraint I mentioned is no longer exists.

@soamvasani soamvasani added this to the 0.11.0 milestone Aug 8, 2018

@vishal-biyani vishal-biyani self-assigned this Aug 29, 2018

@vishal-biyani vishal-biyani modified the milestones: 0.11.0, 0.12.0 Sep 26, 2018

@vishal-biyani

This comment has been minimized.

Collaborator

vishal-biyani commented Oct 10, 2018

While working on this, I realized a few more cases/variations and I am documenting them here for future reference:

Following variations will work

--src hello.go => build single file 
--src hello.go --src world.go or --src "*.go" => build package from multiple files
--src myFnDir/ => build package from directory
--src pkg.zip => Source archive - should work as it works today

--deploy somedir/ => deployment package from a directory
--deploy pkg.zip => Deploy archive - should work as it works today

--src/--deploy http://someurl/somefile.js - this should work but no tests  currently

Following is not supported as of now:

--src dir1/ --src dir2/ => Multiple directory combinations
--deploy dir1/ --deploy dir2/ => Currently only single flag supported for deploy flag
@life1347

This comment has been minimized.

Member

life1347 commented Oct 15, 2018

Just wondering why --src dir1/ --src dir2/ is not support.
Won't fetcher extracts them under the same directory like following?

. 
├── dir1
└── dir2

For example,

kind: ArchiveUploadSpec
name: bank-go-zip
include:
  - "functions/*.go"
  - "functions/vendor"

The final directory structure will be:

<pkg-dir-name> 
├── *.go
└── vendor

@smruthi2187 smruthi2187 removed this from the 0.12.0 milestone Oct 22, 2018

@life1347 life1347 closed this Nov 29, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment