Skip to content
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

Introducing include and exclude in zip action #991

Merged
merged 40 commits into from
Oct 16, 2018

Conversation

pritidesai
Copy link
Member

@pritidesai pritidesai commented Oct 5, 2018

Closes #991

  • Adding support for include and exclude in zip action:
packages:
    zipactionwithinclude:
        actions:
            greeting1:
                function: actions/greeting1
                runtime: nodejs:6
                include:
                    - ["actions/common/utils.js", "common/utils.js"]
            greeting2:
                function: actions/greeting2
                runtime: nodejs:6
                include:
                    - ["actions/common/utils.js", "common/utils.js"]

For the directory structure:

ls -1 actions/common/
utility.js
ls -1 actions/greeting1/
index.js
package.json
ls -1 actions/greeting2/
index.js
package.json

Exclude Use Case:

packages:
    zipactionwithexclude:
        actions:
            greeting1:
                function: actions
                runtime: nodejs:6
                exclude:
                    - actions/*
                include:
                    - ["actions/common/utils.js", "common/utils.js"]
                    - ["actions/index.js", "index.js"]
                    - ["actions/package.json", "package.json"]

For the directory structure:

ls -1 actions/
common/
greeting/
index.js
libs/
package.json

ls -1 actions/common/
utils.js

ls -1 actions/greeting/
index.js
package.json

ls -1 actions/libs/
lib1/
lib2/
lib3/

Added two integration test zipactionwithinclude and zipactionwithexclude.

@pritidesai pritidesai added the wip label Oct 5, 2018
@pritidesai pritidesai changed the title Introducing include in zip action Introducing include and exclude in zip action Oct 12, 2018
@pritidesai pritidesai added review Issue is ready for review and removed wip labels Oct 12, 2018
@pritidesai pritidesai requested a review from mrutkows October 12, 2018 20:16
@@ -649,7 +649,7 @@ func (dm *YAMLParser) readActionFunction(manifestFilePath string, manifestFileNa

if utils.IsDirectory(actionFilePath) {
zipFileName = actionFilePath + "." + runtimes.ZIP_FILE_EXTENSION
err := utils.NewZipWritter(actionFilePath, zipFileName).Zip()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is there a reason this is called "Writter" and not 'Writer" ?

@@ -649,7 +649,7 @@ func (dm *YAMLParser) readActionFunction(manifestFilePath string, manifestFileNa

if utils.IsDirectory(actionFilePath) {
zipFileName = actionFilePath + "." + runtimes.ZIP_FILE_EXTENSION
err := utils.NewZipWritter(actionFilePath, zipFileName).Zip()
err := utils.NewZipWritter(actionFilePath, zipFileName, action.Include, action.Exclude, filepath.Dir(manifestFilePath)).Zip()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good, this keeps a pipeline concept going for the future...

@@ -0,0 +1,152 @@
/*
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for splitting out this module.

@pritidesai pritidesai merged commit 3092f1f into apache:master Oct 16, 2018
jthomas pushed a commit to jthomas/ibm-cloud-functions-rest-api that referenced this pull request Nov 27, 2018
Use the new include in the wskdeploy manifest to avoid code
duplication. The new functionality is implemented and spec
at apache/openwhisk-wskdeploy#991
@pritidesai pritidesai deleted the include1 branch January 10, 2020 18:54
@musa-pro
Copy link

I was following your article at medium -
https://medium.com/openwhisk/whisk-deploy-zip-actions-with-include-exclude-30ba6d96ad8b
But I couldn't make it working. I followed exactly what you did except my manifest.yml file is in root, not under actions. Could you put all your codes in a repo so I can try that to deploy in ibm cloud if that works or not.

@mrutkows
Copy link
Contributor

@musa-pro @pritidesai Hi Mohammad, If you believe there is a bug in the utility, please open an issue and include your manifest contents and any other config. info (.wskconfig file for example). It is not customary to comment on merged PRs and expect any action to be taken. In addition, I am not sure how old the blog is, but there are testcases within the repo. that test this functionality with every change to the code. You can likely find one or more within the https://github.com/apache/openwhisk-wskdeploy/tree/master/tests/src/integration directory structure.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
review Issue is ready for review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants