-
Notifications
You must be signed in to change notification settings - Fork 0
117 lines (95 loc) · 4.57 KB
/
oci-cli-functions.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
name: Demo for OCI Functions
run-name: ${{ github.actor }} is testing out GitHub Actions with OCI🚀 Functions
on: [workflow_dispatch]
env:
# Setting an environment variable with the value of a configuration variable
function_runtime: ${{ vars.FUNCTION_RUNTIME }}
function_name: ${{ vars.FUNCTION_NAME }}
app_name: ${{ vars.APP_NAME }}
jobs:
my-instances:
runs-on: ubuntu-latest
name: List the display name and shape of the instances in my compartment
env:
OCI_CLI_USER: ${{ secrets.OCI_CLI_USER }}
OCI_CLI_TENANCY: ${{ secrets.OCI_CLI_TENANCY }}
OCI_CLI_FINGERPRINT: ${{ secrets.OCI_CLI_FINGERPRINT }}
OCI_CLI_KEY_CONTENT: ${{ secrets.OCI_CLI_KEY_CONTENT }}
OCI_CLI_REGION: ${{ secrets.OCI_CLI_REGION_CI }}
OCIR_TOKEN: ${{ secrets.OCIR_TOKEN }}
OCIR_USERNAME: ${{ secrets.OCIR_USERNAME }}
REGISTRY: fra.ocir.io
IMAGE_NAME: ${{ github.repository }}
OCI_COMPARTMENT_ID: ${{ secrets.OCI_COMPARTMENT_ID }}
steps:
- name: "Install Fn"
run: curl -LSs https://raw.githubusercontent.com/fnproject/cli/master/install | sh
shell: bash
- name: "Check runtime language"
run: echo "Hello $runtime"
shell: bash
- name: "Create context"
run: fn create context functions --provider oracle
shell: bash
- name: "Use context"
run: fn use context functions
shell: bash
- name: "Update context compartment"
run: fn update context oracle.compartment-id ocid1.compartment.oc1..aaaaaaaajc733zsnctrcbo6w5ryfdtbifa44nrzaqlpatjptu4qlgr5dccpq
shell: bash
- name: "Update context api url"
run: fn update context api-url https://functions.eu-frankfurt-1.oci.oraclecloud.com
shell: bash
- name: "Update context registry"
run: fn update context registry fra.ocir.io/frsxwtjslf35/${{ github.actor }}
shell: bash
- name: "list context"
run: fn list context
shell: bash
- name: Log in to the Container registry
uses: docker/login-action@65b78e6e13532edd9afa3aa52ac7964289d1a9c1
with:
registry: ${{ env.REGISTRY }}
username: ${{ secrets.OCIR_USERNAME }}
password: ${{ secrets.OCIR_TOKEN }}
- name: Retrieve the OCID of a named compartment in tenancy
uses: oracle-actions/[email protected]
id: find-compartment-id
with:
command: 'iam compartment list --compartment-id-in-subtree=true'
query: "data[?name=='functions'].id"
silent: False
- name: Retrieve the display name of the applications for functions in my compartment
uses: oracle-actions/[email protected]
id: find-applications
with:
command: 'fn application list --compartment-id ${{ steps.find-compartment-id.outputs.raw_output }}'
query: 'data[*].{name: \"display-name\", applicationId: \"id\" }'
silent: False
- name: Retrieve the display name and shape of the instances in my compartment
uses: oracle-actions/[email protected]
id: find-instances
with:
command: 'compute instance list --compartment-id ${{ steps.find-compartment-id.outputs.raw_output }}'
query: 'data[*].{name: \"display-name\", shape: shape}'
- name: Retrieve the id for functions in my application
uses: oracle-actions/[email protected]
id: find-applications-id
with:
command: 'fn function list --application-id ocid1.fnapp.oc1.eu-frankfurt-1.aaaaaaaaj4dgig5nut2su5tjvo3faum5npzr5yhoweid4q4p2r2esmzn222q'
query: 'data[*].{name: \"display-name\", functionId: \"id\" }'
silent: False
- name: Invoke function in my application
uses: oracle-actions/[email protected]
#id: functions-response
with:
command: 'fn function invoke --function-id "ocid1.fnfunc.oc1.eu-frankfurt-1.aaaaaaaaniupaauxysoxzmltd7r2vrrk5mlgxeldaiaexeinbyqg7tbrwwzq" --file "-" --body "`${{ github.actor }}` "'
#query: 'data[*].{name: \"display-name\", functionId: \"id\" }'
#fernandoharris: Change returning type of my hello world to JSON should solve the issue!
silent: False
#- name: "List Apps"
# run: fn list apps
# shell: bash
- name: "Create function"
run: fn init --runtime $function_runtime $function_name ; cd $function_name ; ls -ltr; pwd
shell: bash