Skip to content

Commit badc3ca

Browse files
author
Tihomir Surdilovic
authored
Use of OpenAPI for function definitions (#145)
* Use of OpenAPI for function definitions Signed-off-by: Tihomir Surdilovic <[email protected]> * Update - adding type param back with its description Signed-off-by: Tihomir Surdilovic <[email protected]> * Update function defs in last example Signed-off-by: Tihomir Surdilovic <[email protected]> * Updated description of function definitions. Cleared up how to define restful vs non-restful services/operations Signed-off-by: Tihomir Surdilovic <[email protected]> * fixed spelling Signed-off-by: Tihomir Surdilovic <[email protected]>
1 parent ede8c1a commit badc3ca

File tree

7 files changed

+145
-150
lines changed

7 files changed

+145
-150
lines changed

examples/examples-argo.md

Lines changed: 16 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -79,9 +79,8 @@ name: Hello World with parameters
7979
version: '1.0'
8080
functions:
8181
- name: whalesayimage
82-
resource: docker/whalesay
83-
type: container
8482
metadata:
83+
image: docker/whalesay
8584
command: cowsay
8685
states:
8786
- name: whalesay
@@ -166,9 +165,8 @@ name: Multi Step Hello
166165
version: '1.0'
167166
functions:
168167
- name: whalesayimage
169-
resource: docker/whalesay
170-
type: container
171168
metadata:
169+
image: docker/whalesay
172170
command: cowsay
173171
states:
174172
- name: hello1
@@ -271,9 +269,8 @@ name: DAG Diamond Example
271269
version: '1.0'
272270
functions:
273271
- name: echo
274-
resource: alpine:3.7
275-
type: container
276272
metadata:
273+
image: alpine:3.7
277274
command: '[echo, "{{inputs.parameters.message}}"]'
278275
states:
279276
- name: A
@@ -396,34 +393,30 @@ name: Scripts and Results Example
396393
version: '1.0'
397394
functions:
398395
- name: gen-random-int-bash
399-
resource: debian:9.4
400-
type: script
401396
metadata:
397+
image: debian:9.4
402398
command: bash
403399
source: |-
404400
cat /dev/urandom | od -N2 -An -i | awk -v f=1 -v r=100 '{printf "%i
405401
", f + r * $1 / 65536}'
406402
- name: gen-random-int-python
407-
resource: python:alpine3.6
408-
type: script
409403
metadata:
404+
image: python:alpine3.6
410405
command: python
411406
source: |
412407
import random
413408
i = random.randint(1, 100)
414409
print(i)
415410
- name: gen-random-int-javascript
416-
resource: node:9.1-alpine
417-
type: script
418411
metadata:
412+
image: node:9.1-alpine
419413
command: node
420414
source: |
421415
var rand = Math.floor(Math.random() * 100);
422416
console.log(rand);
423417
- name: printmessagefunc
424-
resource: alpine:latest
425-
type: container
426418
metadata:
419+
image: alpine:latest
427420
command: sh, -c
428421
source: 'echo result was: {{inputs.parameters.message}}'
429422
states:
@@ -504,9 +497,8 @@ name: Loop over data example
504497
version: '1.0'
505498
functions:
506499
- name: whalesay
507-
resource: docker/whalesay:latest
508-
type: container
509500
metadata:
501+
image: docker/whalesay:latest
510502
command: cowsay
511503
states:
512504
- name: injectdata
@@ -602,16 +594,14 @@ name: Conditionals Example
602594
version: '1.0'
603595
functions:
604596
- name: flip-coin-function
605-
resource: python:alpine3.6
606-
type: script
607597
metadata:
598+
image: python:alpine3.6
608599
command: python
609600
source: import random result = "heads" if random.randint(0,1) == 0 else "tails"
610601
print(result)
611602
- name: echo
612-
resource: alpine:3.6
613-
type: container
614603
metadata:
604+
image: alpine:3.6
615605
command: sh, -c
616606
states:
617607
- name: flip-coin
@@ -703,9 +693,8 @@ name: Retry Example
703693
version: '1.0'
704694
functions:
705695
- name: fail-function
706-
resource: python:alpine3.6
707-
type: container
708696
metadata:
697+
image: python:alpine3.6
709698
command: python
710699
states:
711700
- name: retry-backoff
@@ -790,14 +779,12 @@ name: Recursion Example
790779
version: '1.0'
791780
functions:
792781
- name: heads-function
793-
resource: alpine:3.6
794-
type: container
795782
metadata:
783+
image: alpine:3.6
796784
command: echo "it was heads"
797785
- name: flip-coin-function
798-
resource: python:alpine3.6
799-
type: script
800786
metadata:
787+
image: python:alpine3.6
801788
command: python
802789
source: import random result = "heads" if random.randint(0,1) == 0 else "tail" print(result)
803790
states:
@@ -911,19 +898,16 @@ name: Exit/Error Handling Example
911898
version: '1.0'
912899
functions:
913900
- name: intentional-fail-function
914-
resource: alpine:latest
915-
type: container
916901
metadata:
902+
image: alpine:latest
917903
command: "[sh, -c]"
918904
- name: send-email-function
919-
resource: alpine:latest
920-
type: script
921905
metadata:
906+
image: alpine:latest
922907
command: "[sh, -c]"
923908
- name: celebrate-cry-function
924-
resource: alpine:latest
925-
type: script
926909
metadata:
910+
image: alpine:latest
927911
command: "[sh, -c]"
928912
states:
929913
- name: intentional-fail-state

examples/examples-brigade.md

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,9 @@ events:
7070
type: exec
7171
functions:
7272
- name: greetingFunction
73-
resource: alpine:3.7
74-
type: echo
73+
metadata:
74+
image: alpine:3.7
75+
command: echo
7576
- name: consoleLogFunction
7677
type: console
7778
states:
@@ -150,8 +151,9 @@ events:
150151
type: exec
151152
functions:
152153
- name: greetingFunction
153-
resource: alpine:3.7
154-
type: echo
154+
metadata:
155+
image: alpine:3.7
156+
command: echo
155157
- name: consoleLogFunction
156158
type: console
157159
states:
@@ -324,8 +326,9 @@ events:
324326
type: exec
325327
functions:
326328
- name: echoFunction
327-
resource: alpine:3.7
328-
type: echo
329+
metadata:
330+
image: alpine:3.7
331+
command: echo
329332
states:
330333
- name: FirstGreetGroup
331334
type: event
@@ -481,11 +484,13 @@ events:
481484
type: exec
482485
functions:
483486
- name: greetingFunction
484-
resource: alpine:3.7
485-
type: echo
487+
metadata:
488+
image: alpine:3.7
489+
command: echo
486490
- name: storeToFileFunction
487-
resource: alpine:3.7
488-
type: filestore
491+
metadata:
492+
image: alpine:3.7
493+
command: filestore
489494
states:
490495
- name: ExecActionsAndStoreResults
491496
type: event

0 commit comments

Comments
 (0)