Updating a Function

Find out how to update existing functions in the OCI Functions server.

For prerequisites and more information, see Updating Functions.

    1. Sign in to the Console as a functions developer.
    2. Open the navigation menu and click Developer Services. Under Functions, click Applications.
    3. Select the region you're using with OCI Functions.

      We recommend that you use the same region as the Docker registry that's specified in the Fn Project CLI context. See Creating an Fn Project CLI Context to Connect to Oracle Cloud Infrastructure.

    4. Select the compartment specified in the Fn Project CLI context. See Creating an Fn Project CLI Context to Connect to Oracle Cloud Infrastructure.

      The Applications page shows the applications defined in the compartment.

    5. Click the name of the application containing the existing function that you want to update.
    6. Click the name of the function that you want to update.
    7. Click Edit and update some or all the following properties:
      • Repository: The repository in the OCI Container Registry in the current region that contains the image.
      • Image: The existing image in the OCI Container Registry repository in the current region. If the image has the same name and tag as the image on which the function was originally based, see Notes About Image Digests.
      • Memory: The maximum amount of memory that the function can use while running.
      • Timeout: The maximum amount of time that the function can run for.
      • Enable provisioned concurrency: You can minimize any initial delays when invoking the function by specifying a minimum number of concurrent function invocations for which you want to have execution infrastructure constantly available.

        If you select this option, you enter a value for Provisioned concurrency units (PCUs) to specify the minimum number of concurrent function invocations. The actual PCUs value you enter must be a multiple of 10. If Memory is set to 256 MB, the PCUs value must be a multiple of 20; if Memory is set to 128 MB, the PCUs value must be a multiple of 40. The total number of PCUs available depends on the size of the function, the tenancy limit, and whether provisioned concurrency has been enabled for other functions in the tenancy. For more information about provisioned concurrency, see Reducing Initial Latency Using Provisioned Concurrency.

    8. Click Save changes to update the function in the OCI Functions server.

    The function's updated properties are shown in the Console.

  • Using the Fn Project CLI

    Tip

    From time to time, new versions of the Fn Project CLI are released. We recommend you regularly check that the latest version is installed. For more information, see Steps to upgrade the Fn Project CLI.

    To use the Fn Project CLI to update an existing function in the OCI Functions server:

    1. Log in to your development environment as a functions developer.

    2. In a terminal window, update properties of an existing function by entering:

      fn update function <app-name> <function-name> --image <image-name> --<property> <value>

      where:

      • <app-name> is the name of an existing application containing the existing function.
      • <function-name> is the name of the existing function you want to update.
      • --image <image-name> (optionally) is the name of an existing image in the Docker registry that you now want to base the function on, instead of the previously specified image. If the image has the same name and tag as the image on which the function was originally based, see Notes About Image Digests.
      • --<property> <value> (optionally) is the property you want to update, and the new value you want it to have. Enter fn update function --help to see a list of properties and valid values.

      For example:

      fn update function acmeapp acme-func --image phx.ocir.io/ansh81vru1zp/acme-repo/acme-func:0.0.4 --timeout 60
      fn update function acmeapp acme-func --memory 256

      The properties of the existing function are updated with the values you specified.

    3. Verify that the function has been updated by entering:

      fn inspect function <app-name> <function-name>

      For example:

      fn inspect function acme-app acme-func

      Output:

      {
          "annotations": {
              "fnproject.io/fn/invokeEndpoint": "https://fht7ns4mn2q.us-phoenix-1.functions.oci.oraclecloud.com/20181201/functions/ocid1.fnfunc.oc1.phx.aaaa____uxoa/actions/invoke",							
              "oracle.com/oci/compartmentId": "ocid1.compartment.oc1..aaaaaaaaw______nyq"
          },
          "app_id": "ocid1.fnapp.oc1.phx.aaaaaaaaaf______r3ca",
          "created_at": "2018-07-26T12:50:53.000Z",
          "format": "default",
          "id": "ocid1.fnfunc.oc1.phx.aaaa____uxoa",
          "image": "phx.ocir.io/ansh81vru1zp/acme-repo/acme-func:0.0.4",
          "memory": 256,
          "name": "acme-func",
          "timeout": 60,
          "updated_at": "2018-07-26T13:59:18.000Z"
      }

    Using the OCI CLI

    Use the oci fn function update command and required parameters to update a function:

    oci fn function update --function-id <function-ocid> [OPTIONS]

    For a complete list of flags and variable options for OCI CLI commands, see the Command Line Reference.

  • Run the UpdateFunction API operation to update functions.