Skip to content

Commit 3092f1f

Browse files
authored
Introducing include and exclude in zip action (#991)
* adding include in yaml parser * wip include * wip * wip - dir level include * wip - dir level include * wip - dir level include * wip * wip * wip * wip * wip * wip * wip * wip * wip * include * deleting debugging statement * cleaning up * adding unit test * adding unit test * wip * refactoring * wip * wip * wip * wip * adding more unit tests * fixing unit test * fixing unit test * fixing unit test * adding exclude * fixing unit test * adding warning * adding exclude * refactoring exclude code * adding exclude test case * exclude integration test * cleaning up * adding wski18 strings
1 parent 4ad4b9c commit 3092f1f

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+1283
-95
lines changed

parsers/manifest_parser.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -649,7 +649,7 @@ func (dm *YAMLParser) readActionFunction(manifestFilePath string, manifestFileNa
649649

650650
if utils.IsDirectory(actionFilePath) {
651651
zipFileName = actionFilePath + "." + runtimes.ZIP_FILE_EXTENSION
652-
err := utils.NewZipWritter(actionFilePath, zipFileName).Zip()
652+
err := utils.NewZipWritter(actionFilePath, zipFileName, action.Include, action.Exclude, filepath.Dir(manifestFilePath)).Zip()
653653
if err != nil {
654654
return actionFilePath, nil, err
655655
}

parsers/yamlparser.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,8 +114,8 @@ type Action struct {
114114
Inputs map[string]Parameter `yaml:"inputs"`
115115
Outputs map[string]Parameter `yaml:"outputs"`
116116
Annotations map[string]interface{} `yaml:"annotations,omitempty"`
117-
// TODO() this is propoagated from package to every action within that package
118-
//Parameters map[string]interface{} `yaml:parameters`
117+
Include [][]string `yaml:"include,omitempty"`
118+
Exclude []string `yaml:"exclude,omitempty"`
119119
}
120120

121121
type Limits struct {
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# Licensed to the Apache Software Foundation (ASF) under one or more contributor
2+
# license agreements; and to You under the Apache License, Version 2.0.
3+
4+
packages:
5+
helloworld:
6+
actions:
7+
helloNodejs:
8+
function: actions/
9+
runtime: nodejs:6
10+
include:
11+
- ["actions/hello.js"]
12+
- ["actions/hello.js", "actions/hello.js"]
13+
- ["actions/hello.js", "actions/hello.js", "actions/hello.js"]
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
// Licensed to the Apache Software Foundation (ASF) under one or more contributor
2+
// license agreements; and to You under the Apache License, Version 2.0.
3+
4+
const hello = "Hello Dear";
5+
6+
module.exports = {
7+
hello: hello
8+
};
9+
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
// Licensed to the Apache Software Foundation (ASF) under one or more contributor
2+
// license agreements; and to You under the Apache License, Version 2.0.
3+
4+
/**
5+
* Return a simple greeting message for someone.
6+
*
7+
* @param name A person's name.
8+
* @param place Where the person is from.
9+
*/
10+
11+
12+
var common = require('./common/utils.js')
13+
14+
function main(params) {
15+
var name = params.name || params.payload || 'stranger';
16+
var place = params.place || 'somewhere';
17+
var hello = common.hello || 'Hello';
18+
return {payload: hello + ', ' + name + ' from ' + place + '!'};
19+
}
20+
exports.main = main;
21+
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"name": "my-action",
3+
"main": "index.js",
4+
"dependencies" : {
5+
}
6+
}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
// Licensed to the Apache Software Foundation (ASF) under one or more contributor
2+
// license agreements; and to You under the Apache License, Version 2.0.
3+
4+
/**
5+
* Return a simple greeting message for someone.
6+
*
7+
* @param name A person's name.
8+
* @param place Where the person is from.
9+
*/
10+
11+
12+
var common = require('./common/utils.js')
13+
14+
function main(params) {
15+
var name = params.name || params.payload || 'stranger';
16+
var place = params.place || 'somewhere';
17+
var hello = common.hello || 'Hello';
18+
return {payload: hello + ', ' + name + ' from ' + place + '!'};
19+
}
20+
exports.main = main;
21+
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
// Licensed to the Apache Software Foundation (ASF) under one or more contributor
2+
// license agreements; and to You under the Apache License, Version 2.0.
3+
4+
const hello = "Hello Dear";
5+
6+
module.exports = {
7+
hello: hello
8+
};
9+
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
// Licensed to the Apache Software Foundation (ASF) under one or more contributor
2+
// license agreements; and to You under the Apache License, Version 2.0.
3+
4+
const hello = "Hello Dear";
5+
6+
module.exports = {
7+
hello: hello
8+
};
9+
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
// Licensed to the Apache Software Foundation (ASF) under one or more contributor
2+
// license agreements; and to You under the Apache License, Version 2.0.
3+
4+
const hello = "Hello Dear";
5+
6+
module.exports = {
7+
hello: hello
8+
};
9+

0 commit comments

Comments
 (0)