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

Adding Action Annotations #631

Merged
merged 6 commits into from
Nov 1, 2017
Merged

Adding Action Annotations #631

merged 6 commits into from
Nov 1, 2017

Conversation

pritidesai
Copy link
Member

@pritidesai pritidesai commented Oct 27, 2017

Closes #609

Please don't get scared with the number of files changed :) this number includes YAML files for unit tests and updates to YAML files of existing integration test and a new integration test directory.

Here is the list of changes:

  • Moved web action code out of misc.go into webaction.go
  • Populating action annotations irrespective of web-export
  • Crucial changes when action annotations are specified in deployment file:
    • when a deployment file has a new action annotation which is not defined in manifest file, wskdeploy errors out saying Error: wskdeploy.go [125]: [ERROR_COMMAND_FAILED]: wskdeploy: Error: deploymentreader.go [227]: [ERROR_YAML_FORMAT_ERROR]: Annotation key <key> does not exist in manifest file but specified in deployment file.
    • when a deployment file has defined annotation which is also defined in manifest file, wskdeploy overwrites annotation value from deployment i.e. annotation value in deployment file takes higher precedence over the value in manifest file.
  • Added support for annotations on package and triggers with same precedence order as action annotations

reader.bindPackageInputsAndAnnotations()
reader.bindActionInputsAndAnnotations()
reader.bindTriggerInputsAndAnnotations()
if err := reader.bindPackageInputsAndAnnotations(); err != nil {
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 surfacing these errors from the "bind" functions.

}
}
if !keyExistsInManifest {
return utils.NewYAMLFormatError("Annotation key \""+name+"\" does not exist in manifest file but specified in deployment file.")
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 way we can move this string to our translatable file ?

Copy link
Member Author

Choose a reason for hiding this comment

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

Done

}

serviceDeployPack.Package.Annotations = keyValArr
Copy link
Contributor

Choose a reason for hiding this comment

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

Is the array always allocated now?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes if one or more annotations are specified ...

case "aaa":
assert.Equal(t, "this is an annotation", annos.Value, "Failed to get action annotations")
case "action_annotation_1":
assert.Equal(t, "this is a action annotation 1", annos.Value, "Failed to get action annotations")
Copy link
Contributor

Choose a reason for hiding this comment

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

c /a/an/

Copy link
Member Author

Choose a reason for hiding this comment

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

Done

case "action_annotation_1":
assert.Equal(t, "this is a action annotation 1", annos.Value, "Failed to get action annotations")
case "action_annotation_2":
assert.Equal(t, "this is a action annotation 2", annos.Value, "Failed to get action annotations")
Copy link
Contributor

Choose a reason for hiding this comment

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

c /a/an/

Copy link
Member Author

Choose a reason for hiding this comment

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

Done

for _, annos := range wskaction.Annotations {
switch annos.Key {
case "action_annotation_1":
assert.Equal(t, "this is a action annotation 1 from deployment", annos.Value, "Failed to get action annotations")
Copy link
Contributor

Choose a reason for hiding this comment

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

c /a/an/

Copy link
Member Author

Choose a reason for hiding this comment

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

Done

case "action_annotation_1":
assert.Equal(t, "this is a action annotation 1 from deployment", annos.Value, "Failed to get action annotations")
case "action_annotation_2":
assert.Equal(t, "this is a action annotation 2", annos.Value, "Failed to get action annotations")
Copy link
Contributor

Choose a reason for hiding this comment

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

c /a/an/

Copy link
Member Author

Choose a reason for hiding this comment

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

Done

type: string
description: a simple greeting message, Hello World!
annotations:
action_annotation_1: this is annotation 1
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we have a test for more complex (i.e., arrays/JSON) annotations? Should we open another issue (feature) to support this?

Copy link
Member Author

Choose a reason for hiding this comment

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

Nope, created new issue #634

@mrutkows mrutkows merged commit 2d400be into apache:master Nov 1, 2017
@pritidesai pritidesai deleted the fix-for-609-3 branch January 11, 2018 21:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants