[OCI]Cloud Shellを使ってOracle Functionsサンプルを動かしてみた。

Oracle Cloud Infrastructure で Cloud Shellを使ったOracle Functionsのセットアップ方法が提供されたのでサンプルFunctionを動かしてみた。

※ Oracle Functionsとは、Oracle Cloud Infrastructureで提供されるFn Projectのマネージドサービス

# 事前準備
Oracle Functionsが利用できるように以下の作業を実施

- 仮想クラウド・ネットワークの作成
- IAMポリシーの作成
- (オプション) OCIレジストリの作成 

## 仮想クラウド・ネットワークの作成
Functionsが使用する仮想クラウド・ネットワーク（VCN）を作成します。

## IAMポリシーの作成
#### ルートコンパートメントに対してポリシーの作成
任意の名前、説明にも名前と同様の値を持ち、"ポリシーのバージョニング"を"ポリシーを最新の状態に維持"を選択し、以下の2つのステートメントを入力し、ポリシーを作成します。
この2つのポリシーによって、Oracle FunctionsからのVCN(ネットワーク)の使用およびファンクションを格納するレジストリの使用を許可します。

```
allow service FAAS to use virtual-network-family in tenancy
allow service FAAS to read repos in tenancy
```

さらに、Functions 開発者となるOCIユーザが所属するグループに対して以下のステートメントでポリシーを付与します。

```
allow group <fn-devs-group> to manage repos in tenancy
allow group <fn-devs-group> to use cloud-shell in tenancy
allow group <fn-devs-group> to use virtual-network-family in compartment <使用するコンパートメント名>
allow group <fn-devs-group> to manage functions-family in compartment <使用するコンパートメント名>
allow group <fn-devs-group> to read metrics in compartment <使用するコンパートメント名>
```

ここで <fn-devs-group> には Functions開発者となるOCIユーザが所属するグループ名、<使用するコンパートメント名> には、Functionsを作成するコンパートメント名、使用するVCNのコンパートメント名を指定します。

## (オプション)OCIレジストリの作成
オプションでこの後の作業で作成するファンクションの格納場所として事前にOCIレジストリを作成します。

# ファンクションの作成
## ファンクション・アプリケーションの作成
Webコンソールのメニューから[開発者サービス]>[ファンクション]を選択
![図1.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/108635/8fbe1ffa-5333-42eb-ba3e-645a48eb8662.png)
コンパートメントを選択して、[アプリケーションの作成]をクリック
![図2.jpg](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/108635/1e1e559d-c468-13a9-3ff2-d5b64ae0823c.jpeg)
[名前]を入力し、使用するVCNとサブネットをリストから選択し、[作成]をクリックし、アプリケーションを作成
![図3.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/108635/a90bd775-b7cb-537d-55b2-91716e38e58b.png)

## ファンクションの作成
作成した、アプリケーションの詳細画面で[リソース]の[開始]をクリック
![図4.jpg](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/108635/3d8a90c4-7831-5584-db11-ab0079079d76.jpeg)
[Cloud Shell Setup]を選択すると、作業ステップが表示
![図5.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/108635/4f6946ca-ae63-5d86-da05-8fe7334cb269.png)
ここからは、このステップに沿って作業します。
#### Step 1. Cloud Shellの起動
「Launch Cloud Shell」のボタンをクリックし、Cloud Shellを起動
初めて起動する場合、数分かかります。
### fn Shellのセットアップ
Webコンソールに表示されている順にコマンドを実行。
各Stepでコピーボタンが用意され、Cloud Shellのコマンドプロンプトに張り付けが可能
（Windowsで操作している場合はCTRL+v またはマウス右クリックメニューから貼り付け）
#### Step 2.リージョン用のfn コンテキストの設定

```
$ fn list context
CURRENT NAME            PROVIDER        API URL                                         REGISTRY
        default         oracle-cs
*       us-ashburn-1    oracle-cs       https://functions.us-ashburn-1.oraclecloud.com
$ fn use context us-ashburn-1

Fn: Context us-ashburn-1 currently in use

See 'fn <command> --help' for more information. Client version: 0.5.96
```

(上記は us-ashburn-1 リージョンでの実行の例)

#### Step 3. ファンクションのコンパートメントの設定

```
$ fn update context oracle.compartment-id ocid1.compartment.oc1..aaaaaaaa4sXXX
Current context updated oracle.compartment-id with ocid1.compartment.oc1..aaaaaaaa4sXXX
```


#### Step 4. 使用するOCI レジストリの設定
fn update context registry [RegionCode].ocir.io/[Namespace]/[YOUR-OCIR-REPO]
[RegionCode]：リージョンコードと[Namespace]：ネームスペースは事前に入力済み
[YOIR-OCIR-REPO]；を使用するレジストリのリポジトリを指定

```
$ fn update context registry iad.ocir.io/idasftmulid7/
Current context updated registry with iad.ocir.io/idasftmulid7/
```

#### Step 5. 認証トークンの生成
[ Generate an AuthToken ]のリンクをクリックすると、現在WebコンソールにログインしているOCIユーザの認証トークン生成画面が新しいタブで開く
[トークンの生成] ボタンをクリック
![図6.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/108635/af956b70-0b30-7a21-8c3b-581a826d828f.png)
[説明] に任意の文字列を入力して[トークンの生成]をクリック
![図7.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/108635/d3473104-3347-a654-2546-868b365b439a.png)
生成されたトークンをコピーし、再利用できるように管理します。

#### Step 6. OCIレジストリへのログイン
現在WebコンソールにログインしているOCIユーザでOCIレポジトリにログイン
パスワードの入力が求められるので Step 5 で生成したトークンを入力

```
$ docker login -u 'idasftmulid7/oracleidentitycloudservice/FNUSER@ABC.com' iad.ocir.io
Password: 
WARNING! Your password will be stored unencrypted in /home/kenwatan79/.docker/config.json.
Configure a credential helper to remove this warning. See
https://docs.docker.com/engine/reference/commandline/login/#credentials-store

Login Succeeded
```

( コマンドでWebコンソールからコピーすることで、ログインしているユーザ名と操作しているリージョンのOCIレジストリにログインが可能）

#### Step 7. コンパートメント内のファンクションアプリケーションをリストすることで、セットアップを確認

```
$ fn list apps
NAME            ID
SampleFunctions ocid1.fnapp.oc1.iad.aaaaaaaaaXXX
```

### ファンクションの作成・デプロイ・呼び出し
#### Step 8. 'hello-world' boilerplate の作成
Java ベースのサンプルファンクション 'hello-world' を作成

```
$ fn init --runtime java hello-java
Creating function at: ./hello-java
Function boilerplate generated.
func.yaml created.
```

#### Step 9. 作成されたディレクトリの移動

```
$ cd hello-java
```

#### Step 10. ファンクションのデプロイ
ファンクション・アプリケーション名を指定してファンクションをデプロイ
（ファンクション・アプリケーション名は コマンドに記載されています。）

```
Successfully created function: hello-java with iad.ocir.io/<namespace>/hello-java:0.0.2
```

が表示されれば、成功

#### Step 11. ファンクションの呼び出し

```
$ fn invoke SampleFunctions hello-java
Hello, world!
```

[ Hello,world! ] が表示されれば、呼び出しが成功。
（初回は少し時間がかかります）

# おわりに
Cloud Shell Setup を使うことでfn CLIの導入がなされていて、各ステップのコマンドが用意されていて、非常に手軽にファンクションが作成できることが わかりました。

また、あわせて、Github に OCIファンクションのサンプルが提供されているので、参考にして少ない工数でファンクションが作成できそうです。

[oracle-functions-samples](https://github.com/oracle/oracle-functions-samples)

補足：ファンクション開発者に特定のリポジトリのみ使用させる際のポリシー

```
Allow group <group-name> to inspect repos in tenancy
Allow group <group-name> to manage repos in tenancy where all {target.repo.name=/<リポジトリ名>/ }
```

参考：Step. 10 のファンクションデプロイコマンドの全出力

```
$ fn init --runtime java hello-java
Creating function at: ./hello-java
Function boilerplate generated.
func.yaml created.
kenwatan79@cloudshell:~ (us-ashburn-1)$ cd hello-java
kenwatan79@cloudshell:hello-java (us-ashburn-1)$ fn -v deploy --app SampleFunctions
Deploying hello-java to app: SampleFunctions
Bumped to version 0.0.2
Building image iad.ocir.io/idasftmulid7/hello-java:0.0.2 
FN_REGISTRY:  iad.ocir.io/idasftmulid7/
Current Context:  us-ashburn-1
Sending build context to Docker daemon  14.34kB
Step 1/11 : FROM fnproject/fn-java-fdk-build:jdk11-1.0.108 as build-stage
Trying to pull repository docker.io/fnproject/fn-java-fdk-build ... 
jdk11-1.0.108: Pulling from docker.io/fnproject/fn-java-fdk-build
68ced04f60ab: Pull complete 
4874c5772968: Pull complete 
8afa8e973e22: Pull complete 
08c2579437ef: Pull complete 
d4840e618be0: Pull complete 
4438571fdb4e: Pull complete 
03674ef9db55: Pull complete 
4a86b30f21e4: Pull complete 
c352a8675706: Pull complete 
b42437992011: Pull complete 
b79e7240b52d: Pull complete 
c40ab34ca804: Pull complete 
Digest: sha256:d1471a3057c076cf800be6734c36ae0c68edc81f08068a7007cca9ded654cd54
Status: Downloaded newer image for fnproject/fn-java-fdk-build:jdk11-1.0.108
 ---> e3c33b854f29
Step 2/11 : WORKDIR /function
 ---> Running in 0d12e206644e
Removing intermediate container 0d12e206644e
 ---> add7ceb06522
Step 3/11 : ENV MAVEN_OPTS -Dhttp.proxyHost= -Dhttp.proxyPort= -Dhttps.proxyHost= -Dhttps.proxyPort= -Dhttp.nonProxyHosts= -Dmaven.repo.local=/usr/share/maven/ref/repository
 ---> Running in 0e64b8b8a72f
Removing intermediate container 0e64b8b8a72f
 ---> c32f587ac54c
Step 4/11 : ADD pom.xml /function/pom.xml
 ---> 8f2b8c8ccf09
Step 5/11 : RUN ["mvn", "package", "dependency:copy-dependencies", "-DincludeScope=runtime", "-DskipTests=true", "-Dmdep.prependGroupId=true", "-DoutputDirectory=target", "--fail-never"]
 ---> Running in 2960a75f2201
[INFO] Scanning for projects...
Downloading from central: https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-compiler-plugin/3.3/maven-compiler-plugin-3.3.pom
Downloaded from central: https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-compiler-plugin/3.3/maven-compiler-plugin-3.3.pom (11 kB at 21 kB/s)
Downloading from central: https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-plugins/27/maven-plugins-27.pom
Downloaded from central: https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-plugins/27/maven-plugins-27.pom (11 kB at 93 kB/s)
Downloading from central: https://repo.maven.apache.org/maven2/org/apache/maven/maven-parent/26/maven-parent-26.pom
Downloaded from central: https://repo.maven.apache.org/maven2/org/apache/maven/maven-parent/26/maven-parent-26.pom (40 kB at 698 kB/s)
Downloading from central: https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-compiler-plugin/3.3/maven-compiler-plugin-3.3.jar
Downloaded from central: https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-compiler-plugin/3.3/maven-compiler-plugin-3.3.jar (46 kB at 786 kB/s)
Downloading from central: https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-deploy-plugin/2.7/maven-deploy-plugin-2.7.pom
Downloaded from central: https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-deploy-plugin/2.7/maven-deploy-plugin-2.7.pom (5.6 kB at 58 kB/s)
Downloading from central: https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-deploy-plugin/2.7/maven-deploy-plugin-2.7.jar
Downloaded from central: https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-deploy-plugin/2.7/maven-deploy-plugin-2.7.jar (27 kB at 178 kB/s)
[INFO] 
[INFO] ------------------------< com.example.fn:hello >------------------------
[INFO] Building hello 1.0.0
[INFO] --------------------------------[ jar ]---------------------------------
Downloading from fn-release-repo: https://dl.bintray.com/fnproject/fnproject/com/fnproject/fn/api/1.0.108/api-1.0.108.pom
Downloaded from fn-release-repo: https://dl.bintray.com/fnproject/fnproject/com/fnproject/fn/api/1.0.108/api-1.0.108.pom (0 B at 0 B/s)
Downloading from fn-release-repo: https://dl.bintray.com/fnproject/fnproject/com/fnproject/fn/fdk/1.0.108/fdk-1.0.108.pom
Downloaded from fn-release-repo: https://dl.bintray.com/fnproject/fnproject/com/fnproject/fn/fdk/1.0.108/fdk-1.0.108.pom (0 B at 0 B/s)
Downloading from fn-release-repo: https://dl.bintray.com/fnproject/fnproject/com/fnproject/fn/testing-core/1.0.108/testing-core-1.0.108.pom
Downloaded from fn-release-repo: https://dl.bintray.com/fnproject/fnproject/com/fnproject/fn/testing-core/1.0.108/testing-core-1.0.108.pom (0 B at 0 B/s)
Downloading from fn-release-repo: https://dl.bintray.com/fnproject/fnproject/com/fnproject/fn/runtime/1.0.108/runtime-1.0.108.pom
Downloaded from fn-release-repo: https://dl.bintray.com/fnproject/fnproject/com/fnproject/fn/runtime/1.0.108/runtime-1.0.108.pom (0 B at 0 B/s)
Downloading from fn-release-repo: https://dl.bintray.com/fnproject/fnproject/com/fnproject/fn/testing-junit4/1.0.108/testing-junit4-1.0.108.pom
Downloaded from fn-release-repo: https://dl.bintray.com/fnproject/fnproject/com/fnproject/fn/testing-junit4/1.0.108/testing-junit4-1.0.108.pom (0 B at 0 B/s)
Downloading from fn-release-repo: https://dl.bintray.com/fnproject/fnproject/com/fnproject/fn/api/1.0.108/api-1.0.108.jar
Downloading from fn-release-repo: https://dl.bintray.com/fnproject/fnproject/com/fnproject/fn/testing-core/1.0.108/testing-core-1.0.108.jar
Downloading from fn-release-repo: https://dl.bintray.com/fnproject/fnproject/com/fnproject/fn/runtime/1.0.108/runtime-1.0.108.jar
Downloading from fn-release-repo: https://dl.bintray.com/fnproject/fnproject/com/fnproject/fn/testing-junit4/1.0.108/testing-junit4-1.0.108.jar
Downloaded from fn-release-repo: https://dl.bintray.com/fnproject/fnproject/com/fnproject/fn/api/1.0.108/api-1.0.108.jar (0 B at 0 B/s)
Downloaded from fn-release-repo: https://dl.bintray.com/fnproject/fnproject/com/fnproject/fn/runtime/1.0.108/runtime-1.0.108.jar (0 B at 0 B/s)
Downloaded from fn-release-repo: https://dl.bintray.com/fnproject/fnproject/com/fnproject/fn/testing-core/1.0.108/testing-core-1.0.108.jar (0 B at 0 B/s)
Downloaded from fn-release-repo: https://dl.bintray.com/fnproject/fnproject/com/fnproject/fn/testing-junit4/1.0.108/testing-junit4-1.0.108.jar (0 B at 0 B/s)
[INFO] 
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ hello ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory /function/src/main/resources
[INFO] 
[INFO] --- maven-compiler-plugin:3.3:compile (default-compile) @ hello ---
Downloading from central: https://repo.maven.apache.org/maven2/org/apache/maven/reporting/maven-reporting-api/2.2.1/maven-reporting-api-2.2.1.pom
Downloaded from central: https://repo.maven.apache.org/maven2/org/apache/maven/reporting/maven-reporting-api/2.2.1/maven-reporting-api-2.2.1.pom (1.9 kB at 97 kB/s)
Downloading from central: https://repo.maven.apache.org/maven2/org/apache/maven/reporting/maven-reporting/2.2.1/maven-reporting-2.2.1.pom
Downloaded from central: https://repo.maven.apache.org/maven2/org/apache/maven/reporting/maven-reporting/2.2.1/maven-reporting-2.2.1.pom (1.4 kB at 111 kB/s)
Downloading from central: https://repo.maven.apache.org/maven2/org/apache/maven/doxia/doxia-sink-api/1.1/doxia-sink-api-1.1.pom
Downloaded from central: https://repo.maven.apache.org/maven2/org/apache/maven/doxia/doxia-sink-api/1.1/doxia-sink-api-1.1.pom (2.0 kB at 93 kB/s)
Downloading from central: https://repo.maven.apache.org/maven2/org/apache/maven/doxia/doxia/1.1/doxia-1.1.pom
Downloaded from central: https://repo.maven.apache.org/maven2/org/apache/maven/doxia/doxia/1.1/doxia-1.1.pom (15 kB at 147 kB/s)
Downloading from central: https://repo.maven.apache.org/maven2/org/apache/maven/doxia/doxia-logging-api/1.1/doxia-logging-api-1.1.pom
Downloaded from central: https://repo.maven.apache.org/maven2/org/apache/maven/doxia/doxia-logging-api/1.1/doxia-logging-api-1.1.pom (1.6 kB at 75 kB/s)
Downloading from central: https://repo.maven.apache.org/maven2/commons-cli/commons-cli/1.2/commons-cli-1.2.pom
Downloaded from central: https://repo.maven.apache.org/maven2/commons-cli/commons-cli/1.2/commons-cli-1.2.pom (8.0 kB at 170 kB/s)
Downloading from central: https://repo.maven.apache.org/maven2/org/apache/commons/commons-parent/11/commons-parent-11.pom
Downloaded from central: https://repo.maven.apache.org/maven2/org/apache/commons/commons-parent/11/commons-parent-11.pom (25 kB at 211 kB/s)
Downloading from central: https://repo.maven.apache.org/maven2/org/apache/maven/shared/maven-shared-utils/0.7/maven-shared-utils-0.7.pom
Downloaded from central: https://repo.maven.apache.org/maven2/org/apache/maven/shared/maven-shared-utils/0.7/maven-shared-utils-0.7.pom (5.0 kB at 77 kB/s)
Downloading from central: https://repo.maven.apache.org/maven2/org/apache/maven/shared/maven-shared-components/20/maven-shared-components-20.pom
Downloaded from central: https://repo.maven.apache.org/maven2/org/apache/maven/shared/maven-shared-components/20/maven-shared-components-20.pom (5.1 kB at 269 kB/s)
Downloading from central: https://repo.maven.apache.org/maven2/org/codehaus/plexus/plexus-compiler-api/2.5/plexus-compiler-api-2.5.pom
Downloaded from central: https://repo.maven.apache.org/maven2/org/codehaus/plexus/plexus-compiler-api/2.5/plexus-compiler-api-2.5.pom (865 B at 38 kB/s)
Downloading from central: https://repo.maven.apache.org/maven2/org/codehaus/plexus/plexus-compiler/2.5/plexus-compiler-2.5.pom
Downloaded from central: https://repo.maven.apache.org/maven2/org/codehaus/plexus/plexus-compiler/2.5/plexus-compiler-2.5.pom (5.3 kB at 190 kB/s)
Downloading from central: https://repo.maven.apache.org/maven2/org/codehaus/plexus/plexus-components/1.3.1/plexus-components-1.3.1.pom
Downloaded from central: https://repo.maven.apache.org/maven2/org/codehaus/plexus/plexus-components/1.3.1/plexus-components-1.3.1.pom (3.1 kB at 192 kB/s)
Downloading from central: https://repo.maven.apache.org/maven2/org/codehaus/plexus/plexus-compiler-manager/2.5/plexus-compiler-manager-2.5.pom
Downloaded from central: https://repo.maven.apache.org/maven2/org/codehaus/plexus/plexus-compiler-manager/2.5/plexus-compiler-manager-2.5.pom (690 B at 26 kB/s)
Downloading from central: https://repo.maven.apache.org/maven2/org/codehaus/plexus/plexus-compiler-javac/2.5/plexus-compiler-javac-2.5.pom
Downloaded from central: https://repo.maven.apache.org/maven2/org/codehaus/plexus/plexus-compiler-javac/2.5/plexus-compiler-javac-2.5.pom (769 B at 13 kB/s)
Downloading from central: https://repo.maven.apache.org/maven2/org/codehaus/plexus/plexus-compilers/2.5/plexus-compilers-2.5.pom
Downloaded from central: https://repo.maven.apache.org/maven2/org/codehaus/plexus/plexus-compilers/2.5/plexus-compilers-2.5.pom (1.3 kB at 81 kB/s)
Downloading from central: https://repo.maven.apache.org/maven2/org/apache/maven/shared/maven-shared-utils/0.7/maven-shared-utils-0.7.jar
Downloading from central: https://repo.maven.apache.org/maven2/com/google/code/findbugs/jsr305/2.0.1/jsr305-2.0.1.jar
Downloading from central: https://repo.maven.apache.org/maven2/org/codehaus/plexus/plexus-compiler-api/2.5/plexus-compiler-api-2.5.jar
Downloading from central: https://repo.maven.apache.org/maven2/org/codehaus/plexus/plexus-compiler-manager/2.5/plexus-compiler-manager-2.5.jar
Downloading from central: https://repo.maven.apache.org/maven2/org/codehaus/plexus/plexus-compiler-javac/2.5/plexus-compiler-javac-2.5.jar
Downloaded from central: https://repo.maven.apache.org/maven2/org/codehaus/plexus/plexus-compiler-manager/2.5/plexus-compiler-manager-2.5.jar (4.6 kB at 14 kB/s)
Downloaded from central: https://repo.maven.apache.org/maven2/org/codehaus/plexus/plexus-compiler-api/2.5/plexus-compiler-api-2.5.jar (25 kB at 69 kB/s)
Downloading from central: https://repo.maven.apache.org/maven2/org/codehaus/plexus/plexus-container-default/1.5.5/plexus-container-default-1.5.5.jar
Downloading from central: https://repo.maven.apache.org/maven2/org/codehaus/plexus/plexus-classworlds/2.2.2/plexus-classworlds-2.2.2.jar
Downloaded from central: https://repo.maven.apache.org/maven2/org/codehaus/plexus/plexus-compiler-javac/2.5/plexus-compiler-javac-2.5.jar (19 kB at 43 kB/s)
Downloading from central: https://repo.maven.apache.org/maven2/org/apache/xbean/xbean-reflect/3.4/xbean-reflect-3.4.jar
Downloaded from central: https://repo.maven.apache.org/maven2/com/google/code/findbugs/jsr305/2.0.1/jsr305-2.0.1.jar (32 kB at 61 kB/s)
Downloading from central: https://repo.maven.apache.org/maven2/log4j/log4j/1.2.12/log4j-1.2.12.jar
Downloaded from central: https://repo.maven.apache.org/maven2/org/codehaus/plexus/plexus-classworlds/2.2.2/plexus-classworlds-2.2.2.jar (46 kB at 43 kB/s)
Downloaded from central: https://repo.maven.apache.org/maven2/org/apache/maven/shared/maven-shared-utils/0.7/maven-shared-utils-0.7.jar (170 kB at 148 kB/s)
Downloading from central: https://repo.maven.apache.org/maven2/commons-logging/commons-logging-api/1.1/commons-logging-api-1.1.jar
Downloading from central: https://repo.maven.apache.org/maven2/com/google/collections/google-collections/1.0/google-collections-1.0.jar
Downloaded from central: https://repo.maven.apache.org/maven2/org/apache/xbean/xbean-reflect/3.4/xbean-reflect-3.4.jar (134 kB at 108 kB/s)
Downloading from central: https://repo.maven.apache.org/maven2/junit/junit/3.8.2/junit-3.8.2.jar
Downloaded from central: https://repo.maven.apache.org/maven2/commons-logging/commons-logging-api/1.1/commons-logging-api-1.1.jar (45 kB at 24 kB/s)
Downloaded from central: https://repo.maven.apache.org/maven2/org/codehaus/plexus/plexus-container-default/1.5.5/plexus-container-default-1.5.5.jar (217 kB at 104 kB/s)
Downloaded from central: https://repo.maven.apache.org/maven2/junit/junit/3.8.2/junit-3.8.2.jar (121 kB at 50 kB/s)
Downloaded from central: https://repo.maven.apache.org/maven2/log4j/log4j/1.2.12/log4j-1.2.12.jar (358 kB at 137 kB/s)
Downloaded from central: https://repo.maven.apache.org/maven2/com/google/collections/google-collections/1.0/google-collections-1.0.jar (640 kB at 235 kB/s)
[INFO] No sources to compile
[INFO] 
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ hello ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory /function/src/test/resources
[INFO] 
[INFO] --- maven-compiler-plugin:3.3:testCompile (default-testCompile) @ hello ---
[INFO] No sources to compile
[INFO] 
[INFO] --- maven-surefire-plugin:2.22.1:test (default-test) @ hello ---
[INFO] Tests are skipped.
[INFO] 
[INFO] --- maven-jar-plugin:2.4:jar (default-jar) @ hello ---
[WARNING] JAR will be empty - no content was marked for inclusion!
[INFO] Building jar: /function/target/hello-1.0.0.jar
[INFO] 
[INFO] --- maven-dependency-plugin:2.8:copy-dependencies (default-cli) @ hello ---
[INFO] Copying api-1.0.108.jar to /function/target/com.fnproject.fn.api-1.0.108.jar
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  10.656 s
[INFO] Finished at: 2020-04-18T09:49:03Z
[INFO] ------------------------------------------------------------------------
Removing intermediate container 2960a75f2201
 ---> 38fbc5ba9488
Step 6/11 : ADD src /function/src
 ---> 7abdf13fa55f
Step 7/11 : RUN ["mvn", "package"]
 ---> Running in c77f0daaed76
[INFO] Scanning for projects...
[INFO] 
[INFO] ------------------------< com.example.fn:hello >------------------------
[INFO] Building hello 1.0.0
[INFO] --------------------------------[ jar ]---------------------------------
[INFO] 
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ hello ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory /function/src/main/resources
[INFO] 
[INFO] --- maven-compiler-plugin:3.3:compile (default-compile) @ hello ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 1 source file to /function/target/classes
[INFO] 
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ hello ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory /function/src/test/resources
[INFO] 
[INFO] --- maven-compiler-plugin:3.3:testCompile (default-testCompile) @ hello ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 1 source file to /function/target/test-classes
[INFO] 
[INFO] --- maven-surefire-plugin:2.22.1:test (default-test) @ hello ---
[INFO] 
[INFO] -------------------------------------------------------
[INFO]  T E S T S
[INFO] -------------------------------------------------------
[INFO] Running com.example.fn.HelloFunctionTest
Inside Java Hello World function
[INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.706 s - in com.example.fn.HelloFunctionTest
[INFO] 
[INFO] Results:
[INFO] 
[INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0
[INFO] 
[INFO] 
[INFO] --- maven-jar-plugin:2.4:jar (default-jar) @ hello ---
[INFO] Building jar: /function/target/hello-1.0.0.jar
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  6.136 s
[INFO] Finished at: 2020-04-18T09:49:13Z
[INFO] ------------------------------------------------------------------------
Removing intermediate container c77f0daaed76
 ---> acce13c8aed9
Step 8/11 : FROM fnproject/fn-java-fdk:jre11-1.0.108
Trying to pull repository docker.io/fnproject/fn-java-fdk ... 
jre11-1.0.108: Pulling from docker.io/fnproject/fn-java-fdk
68ced04f60ab: Already exists 
4874c5772968: Already exists 
8afa8e973e22: Already exists 
d5c28bc4eb55: Pull complete 
a41f3faed2e8: Pull complete 
2b78f5931a23: Pull complete 
d539129c39f2: Pull complete 
7cb5a85e8da0: Pull complete 
Digest: sha256:96bdac673d78004a3c5bcfe3f91b1182493faae5744a4dd93314d3a33e0ed058
Status: Downloaded newer image for fnproject/fn-java-fdk:jre11-1.0.108
 ---> ea31ad6990fe
Step 9/11 : WORKDIR /function
 ---> Running in 4554f56c6b15
Removing intermediate container 4554f56c6b15
 ---> 6a6d178ae196
Step 10/11 : COPY --from=build-stage /function/target/*.jar /function/app/
 ---> 2f469bdaa6ac
Step 11/11 : CMD ["com.example.fn.HelloFunction::handleRequest"]
 ---> Running in 0bad8ac43c69
Removing intermediate container 0bad8ac43c69
 ---> 8882430cd65e
Successfully built 8882430cd65e
Successfully tagged iad.ocir.io/idasftmulid7/hello-java:0.0.2

Parts:  [iad.ocir.io idasftmulid7 hello-java:0.0.2]
Pushing iad.ocir.io/idasftmulid7/hello-java:0.0.2 to docker registry...The push refers to repository [iad.ocir.io/idasftmulid7/hello-java]
8302f00b6bff: Pushed 
91174bbee9e3: Pushed 
ed7068f75eab: Pushed 
b4301b71b3d1: Pushed 
0822b32d2df7: Pushed 
cb18f283cf97: Pushed 
14cdbe52759f: Pushed 
33328dafa5c7: Pushed 
f2cb0ecef392: Pushed 
0.0.2: digest: sha256:b16eb6c71ada58af245f3a4346ae01903b50a0aabb7424a85612faebd5103bbf size: 2206
Updating function hello-java using image iad.ocir.io/idasftmulid7/hello-java:0.0.2...
Successfully created function: hello-java with iad.ocir.io/idasftmulid7/hello-java:0.0.2


Successfully created function: hello-java with iad.ocir.io/idasftmulid7/hello-java:0.0.2
```