Configuring the deployment

Next, click Add a Tool again to put a new entry into the pipeline, and then click Delivery Pipeline for the tool to add, as shown in the following screenshot:

Once the delivery pipeline tool is in place, click on it and then go ahead and click Add Stage. There are three tabs at the top—Input, Jobs, and Environment properties. These govern how the deployment activity itself is set up. Here's a quick overview of these tabs: 

 $ bx iam api-key-create myFunction
Creating API key myFunction as user@email.com...
OK
API key myFunction was created
Please preserve the API key! It cannot be retrieved after it's
created.

Name myFunction
Description
Created At 2018-02-24T19:16+0000
API Key X4klg0XvNotJqN_haPWpPirPLhckCA9OFdZDufjcIxLY

The following deploy job shell script will grab the Cloud Functions plugin for the command (find out more about the Bluemix command-line tool in the documentation at https://console.bluemix.net/docs/cli/reference/bluemix_cli/get_started.html#getting-started), and then log in with the API key that we configured earlier and target the desired Bluemix organization and space. Add the following shell script to the Deploy Script column of JOBS and click on Save

#!/bin/bash
bx plugin install Cloud-Functions -r Bluemix -f
#bx login -a https://api.ng.bluemix.net --apikey $APIKEY -o <email_address> -s development
bx login -a api.eu-gb.bluemix.net --apikey $APIKEY -o <email_address> -s dev
# handy for debugging
bx wsk action invoke /whisk.system/utils/echo -p message helloWorld --blocking --result
# now set up your actions etc
zip helloWorld.zip index.js
bx wsk action update helloWorld --kind nodejs:6 helloWorld.zip
# check everything is as expected
bx wsk action list

After adding the Cloud Functions plugin to the Bluemix command-line tool, this script logs us in using the API key we created when configuring the deployment tool. Using the built in /whisk.system/utils/echo action will show us the output in the logs if everything is configured correctly to work with Cloud Functions, or cause a (hopefully helpful and informative) error if that's not the case. The action update command does the actual deployment, taking the newly zipped file and deploying it as an action. The final call to the action list simply shows us that the action is there as expected. 

Check that everything works as expected by checking the green play button on this task, as depicted in the following screenshot. If it plays, you're all set!