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

Reorganize actions doc. #3816

Merged
merged 7 commits into from Jun 29, 2018
Merged

Reorganize actions doc. #3816

merged 7 commits into from Jun 29, 2018

Conversation

rabbah
Copy link
Member

@rabbah rabbah commented Jun 27, 2018

This PR introduces a language-agnostic (mostly) basic introduction to working with actions. And it splits the language/runtime specific tutorials and references into their own markdowns. This is based on discussion with @csantanapr and @akrabat. All feedback appreciated and welcomed.

Description

Related issue and scope

  • I opened an issue to propose and discuss this change (#????)

My changes affect the following components

  • API
  • Controller
  • Message Bus (e.g., Kafka)
  • Loadbalancer
  • Invoker
  • Intrinsic actions (e.g., sequences, conductors)
  • Data stores (e.g., CouchDB)
  • Tests
  • Deployment
  • CLI
  • General tooling
  • Documentation

Types of changes

  • Bug fix (generally a non-breaking change which closes an issue).
  • Enhancement or new feature (adds new functionality).
  • Breaking change (a bug fix or enhancement which changes existing behavior).

Checklist:

  • I signed an Apache CLA.
  • I reviewed the style guides and followed the recommendations (Travis CI will check :).
  • I added tests to cover my changes.
  • My changes require further changes to the documentation.
  • I updated the documentation where necessary.

@rabbah rabbah added documentation review Review for this PR has been requested and yet needs to be done. labels Jun 27, 2018
@rabbah rabbah force-pushed the docs branch 2 times, most recently from 94c623b to 2f81837 Compare June 27, 2018 22:55
@codecov-io
Copy link

codecov-io commented Jun 27, 2018

Codecov Report

Merging #3816 into master will decrease coverage by 0.03%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #3816      +/-   ##
==========================================
- Coverage   75.19%   75.16%   -0.04%     
==========================================
  Files         136      136              
  Lines        6383     6386       +3     
  Branches      387      389       +2     
==========================================
  Hits         4800     4800              
- Misses       1583     1586       +3
Impacted Files Coverage Δ
...ols/admin/src/main/scala/whisk/core/cli/Main.scala 25.33% <0%> (-1.06%) ⬇️
...c/main/scala/whisk/core/database/UserCommand.scala 97.77% <0%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update c202ba7...ba211ab. Read the comment docs.

docs/actions.md Outdated

In addition, we recommend that you review the following topics:
The rest of this document provides a [basic tutorial](#the-basics) for invoking an action, passing parameters to it, and
inspecting the result. We recommend that you get familiar with the following topics first.
Copy link
Member

Choose a reason for hiding this comment

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

We can't recommend that you get familiar with the following topics first (i.e. before the basic tutorial) when the first prerequisite topic item is the basic tutorial.

docs/actions.md Outdated
For more information regarding action invocations using the REST interface, see [Using REST APIs with OpenWhisk](rest_api.md#actions).

Another way of invoking an action which does not require authentication is via
[web actions](https://github.com/apache/incubator-openwhisk/blob/master/docs/webactions.md#web-actions).
Copy link
Member

Choose a reason for hiding this comment

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

Can we use a relative link here?

@bdelacretaz
Copy link
Member

I like it! I think it makes perfect sense to explain the general principles of Actions and farm out the language-specific details. It might be useful to mention what happens under the hood when running actions (i.e. /init and /run calls to a container) but maybe that's too much detail at this level.


The PHP runtime will automatically include Composer's autoloader for you, so you can immediately use the dependencies in your action code.

Note that if you don't include your own `vendor` folder, then the runtime will include one for you. The packages included are listed in the [reference](https://github.com/apache/incubator-openwhisk/blob/master/docs/reference.md#composer-packages).
Copy link
Member

@akrabat akrabat Jun 28, 2018

Choose a reason for hiding this comment

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

Link is wrong - the composer-packages section is further down the page.

```


See the Swift [reference](./reference.md#swift-actions) for more information about the Swift runtime.
Copy link
Member

Choose a reason for hiding this comment

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

Link is wrong - reference is further down the page now.

```
ok: created action hello
```
The CLI automatically infers the type of the action by using the source file extension. For `.js` source files, the action runs by using a Node.js 6 runtime. You can also create an action that runs with Node.js 8 by explicitly specifying the parameter `--kind nodejs:8`. For more information, see the Node.js 6 vs 8 [reference](./reference.md#javascript-runtime-environments).
Copy link
Member

Choose a reason for hiding this comment

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

Link is wrong - reference is further down the page.

}
```

Note that the action in the example uses the JavaScript `request` library to make an HTTP request to the Yahoo Weather API, and extracts fields from the JSON result. The [References](./reference.md#javascript-runtime-environments) detail the Node.js packages that you can use in your actions.
Copy link
Member

Choose a reason for hiding this comment

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

Link to reference needs updating.

wsk action update example --docker janesmith/blackboxdemo
```

You can find more information about creating Docker actions in the [References](./reference.md#docker-actions) section.
Copy link
Member

Choose a reason for hiding this comment

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

The "Docker actions" section is no longer in reference.md, but I can't find it in docker-actions.md either!

wsk action create helloPHP hello.php
```

The CLI automatically infers the type of the action from the source file extension. For `.php` source files, the action runs using a PHP 7.1 runtime. See the PHP [reference](./reference.md#php-actions) for more information.
Copy link
Member

Choose a reason for hiding this comment

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

Link needs updating

@csantanapr
Copy link
Member

This is great I wanted this split for the longest time +1

What do you think is all files start with “actions-*”? Like “actions-java.md”

I think is my OCD and I will have trouble find the files. What used to be in actions.md now is in actions-java.md also when listing the files all languages are together so it’s easy to see the ones available.

@dgrove-oss
Copy link
Member

This is great. fwiw, it looks like I have the same OCD as Carlos; I'd also put an action prefix on all the files so that an 'ls' grouped them nicely.

@rabbah
Copy link
Member Author

rabbah commented Jun 28, 2018

hehe ok. I named them as I did for tab completion but I will rename.

@rabbah
Copy link
Member Author

rabbah commented Jun 28, 2018

Renamed the files. @akrabat thanks for flagging the broken links - I'll fix these in the next pass. I tried to address the flow in the parent doc per your comment.

@rabbah
Copy link
Member Author

rabbah commented Jun 28, 2018

@bdelacretaz I added a commit to introduce init and run, cold vs warm start.

@rabbah
Copy link
Member Author

rabbah commented Jun 29, 2018

@akrabat I've fixed the links and made a pass to update all the docs for the runtimes as well while at it.

use the dependencies in your action code.

Note that if you don't include your own `vendor` folder, then the runtime will include one for you.
The following PHP extensions are available in addition to the standard ones:
Copy link
Member

Choose a reason for hiding this comment

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

Need to separate PHP extensions list from the Composer info as they aren't the same thing. Composer manages PHP components, PHP extensions are compiled C libraries that are loaded by the language and the the user cannot add to or remove them.

Copy link
Member Author

Choose a reason for hiding this comment

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

thanks @akrabat for the review - I think addressed in my last commit if you can kindly look again.

Copy link
Member

Choose a reason for hiding this comment

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

Yes. That's great. Thanks.

@csantanapr
Copy link
Member

❤️ the move of references to each runtime language

Copy link
Member

@csantanapr csantanapr left a comment

Choose a reason for hiding this comment

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

LGTM 🎉

@csantanapr csantanapr merged commit bad0260 into apache:master Jun 29, 2018
BillZong pushed a commit to BillZong/openwhisk that referenced this pull request Nov 18, 2019
* Refactor actions markdown so each lang/runtime is its own doc file.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation review Review for this PR has been requested and yet needs to be done.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants