Break New Ground

CI/CD Automation for Fn Project with Oracle FaaS and Developer Cloud Service

Shay Shmeltzer
Director of Product Management - Oracle

By this time you probably seen multiple blogs about the Fn Project - an open-source, multi-languages, container-native serverless platform. And you might have already heard that Oracle is going to offer a cloud hosted Function as a Service (FaaS) for Fn-based functions called Oracle Functions - currently in limited access (get your invite to try it out here).

So how do you create an automated CI/CD chain for your Fn functions?

Oracle Developer Cloud Service now provides built-in functionality to support you.

DevCS supports Fn Project functions life cycle command definition in our CI/CD jobs. This means that you can automate Fn build and deploy steps in a declarative way. We also added support that enables you to leverage the hosted FaaS offering in the cloud and CI/CD directly into that environment.

Here are the basic steps to get DevCS hooked up to your Fn based FaaS service running in the Oracle Cloud Infrastructure.

Your build will have several steps in it including:

(note - I'm assuming here that you already setup your Fn tenancy following the steps here).

Docker Login

This will let you connect to the hosted docker registry in the Oracle Cloud (OCIR)

Provide your OCIR url (phx.ocir.io for example), your user (tenancy/username), and your auth token (note this is not the password but rather the auth token you can get in identity->user->auth tokens).

Docker Login

OCIcli Configuration

The next step is to configure the access to your OCI environment - you do this by picking up the OCIcli build step. Then provide the information including your user's OCID and Fingerprint, your tenancy OCID, your region, and paste in your private key that you generated.


OCI Fn Configuration

Now that your OCI connection is set, let's add the specific configuration for your FaaS instance. From the Fn menu in DevCS pick up the Fn OCI option. Configure it with the details of the Fn environment you created including the compartment ID, the provider (oracle), and the passphrase you used when you created your private key.

Your environment is now ready for using the specific Fn lifecycle commands. We are going to assume that your Fn function code is in your root directory of the Git repository you hooked up to the build job.

Fn Build

The first step will build the function for us. If the code is at the root of your Git, then you only need to specify the Registry Host (phx.ocir.io) and the username (tenant/user), you can also check the box to get verbose output from the build operation.

Fn Deploy

If the Build was successful the next step is to deploy it to our FaaS service. First make sure you created an app in your FaaS function console. Use the name of that app to fill the "Deploy to App" field. Fill out the Registry Host and Username field similar to the previous step, and don't forget to add the API URL (https://functions.us-phoenix-1.oraclecloud.com). You can then decide on some additional options such as verbose output, bumping the version of the app, etc.

Now run the Build and watch the magic take place.

Check out the video below to see it in action.



Join the discussion

Comments ( 1 )
  • Mika Rinne Wednesday, April 24, 2019
    many thanks for the great blog!
    Just a reminder to add the necessary policies to the tenancy to make this work:
    allow service FaaS to manage virtual-network-family in tenancy (or compartment xyz)
    allow service FaaS to read repos in tenancy
Please enter your name.Please provide a valid email address.Please enter a comment.CAPTCHA challenge response provided was incorrect. Please try again.