mirror of
https://github.com/tektoncd/catalog.git
synced 2024-11-21 05:55:35 +00:00
Port openwhisk to v1beta1 🦇
Signed-off-by: Vincent Demeester <vdemeest@redhat.com>
This commit is contained in:
parent
4341bae32d
commit
75e7349ef5
@ -1,13 +1,16 @@
|
||||
# Task to define Runtime Parameters
|
||||
apiVersion: tekton.dev/v1alpha1
|
||||
apiVersion: tekton.dev/v1beta1
|
||||
kind: Task
|
||||
metadata:
|
||||
name: openwhisk
|
||||
spec:
|
||||
inputs:
|
||||
resources:
|
||||
inputs:
|
||||
- name: runtime-git
|
||||
type: git
|
||||
outputs:
|
||||
- name: runtime-image
|
||||
type: image
|
||||
params:
|
||||
- name: DOCKERFILE
|
||||
description: The path to the dockerfile to build from Runtime Repo
|
||||
@ -38,10 +41,6 @@ spec:
|
||||
- name: OW_PROJECT_URL
|
||||
description: Location to local or remote file storage or public or private GitHub repo from where action source code needs to be evaluated
|
||||
default: ""
|
||||
outputs:
|
||||
resources:
|
||||
- name: runtime-image
|
||||
type: image
|
||||
steps:
|
||||
- name: add-ow-env-to-dockerfile
|
||||
image: ubuntu
|
||||
@ -50,31 +49,31 @@ spec:
|
||||
args:
|
||||
- -c
|
||||
- |
|
||||
if [ -z $(inputs.params.OW_PROJECT_URL) ]; then
|
||||
OW_ACTION_CODE="$(inputs.params.OW_ACTION_CODE)"
|
||||
if [ -z $(params.OW_PROJECT_URL) ]; then
|
||||
OW_ACTION_CODE="$(params.OW_ACTION_CODE)"
|
||||
else
|
||||
TEMPDIR="knative-"$((1 + RANDOM % 100))
|
||||
TEMPFILE=`basename "$(inputs.params.OW_PROJECT_URL)"`
|
||||
TEMPFILE=`basename "$(params.OW_PROJECT_URL)"`
|
||||
mkdir $TEMPDIR
|
||||
cd $TEMPDIR
|
||||
wget -O $TEMPFILE "$(inputs.params.OW_PROJECT_URL)"
|
||||
if [ "$(inputs.params.OW_ACTION_BINARY)" = true ]; then
|
||||
wget -O $TEMPFILE "$(params.OW_PROJECT_URL)"
|
||||
if [ "$(params.OW_ACTION_BINARY)" = true ]; then
|
||||
OW_ACTION_CODE=`base64 $TEMPFILE | tr -d '[:space:]'`
|
||||
else
|
||||
OW_ACTION_CODE=`cat $TEMPFILE`
|
||||
fi
|
||||
cd ..
|
||||
fi
|
||||
cat <<EOF >> $(inputs.params.DOCKERFILE)
|
||||
ENV __OW_RUNTIME_DEBUG "$(inputs.params.OW_RUNTIME_DEBUG)"
|
||||
ENV __OW_RUNTIME_PLATFORM "$(inputs.params.OW_RUNTIME_PLATFORM)"
|
||||
ENV __OW_ACTION_NAME "$(inputs.params.OW_ACTION_NAME)"
|
||||
cat <<EOF >> $(params.DOCKERFILE)
|
||||
ENV __OW_RUNTIME_DEBUG "$(params.OW_RUNTIME_DEBUG)"
|
||||
ENV __OW_RUNTIME_PLATFORM "$(params.OW_RUNTIME_PLATFORM)"
|
||||
ENV __OW_ACTION_NAME "$(params.OW_ACTION_NAME)"
|
||||
ENV __OW_ACTION_CODE "${OW_ACTION_CODE}"
|
||||
ENV __OW_ACTION_MAIN "$(inputs.params.OW_ACTION_MAIN)"
|
||||
ENV __OW_ACTION_BINARY "$(inputs.params.OW_ACTION_BINARY)"
|
||||
ENV __OW_HTTP_METHODS "$(inputs.params.OW_HTTP_METHODS)"
|
||||
ENV __OW_ACTION_RAW "$(inputs.params.OW_ACTION_RAW)"
|
||||
ENV __OW_PROJECT_URL "$(inputs.params.OW_PROJECT_URL)"
|
||||
ENV __OW_ACTION_MAIN "$(params.OW_ACTION_MAIN)"
|
||||
ENV __OW_ACTION_BINARY "$(params.OW_ACTION_BINARY)"
|
||||
ENV __OW_HTTP_METHODS "$(params.OW_HTTP_METHODS)"
|
||||
ENV __OW_ACTION_RAW "$(params.OW_ACTION_RAW)"
|
||||
ENV __OW_PROJECT_URL "$(params.OW_PROJECT_URL)"
|
||||
EOF
|
||||
- name: update-dockerfile-for-tekton
|
||||
image: ubuntu
|
||||
@ -84,11 +83,11 @@ spec:
|
||||
- -i
|
||||
- -e
|
||||
- 's/COPY ./COPY .\/runtime-git/g'
|
||||
- $(inputs.params.DOCKERFILE)
|
||||
- $(params.DOCKERFILE)
|
||||
- name: build-openwhisk-nodejs-runtime
|
||||
image: "gcr.io/kaniko-project/executor:latest"
|
||||
command:
|
||||
- /kaniko/executor
|
||||
args:
|
||||
- --dockerfile=$(inputs.params.DOCKERFILE)
|
||||
- --destination=$(outputs.resources.runtime-image.url)
|
||||
- --dockerfile=$(params.DOCKERFILE)
|
||||
- --destination=$(resources.outputs.runtime-image.url)
|
||||
|
@ -110,7 +110,7 @@ spec:
|
||||
---
|
||||
|
||||
# Task Run to build NodeJS image with the action source
|
||||
apiVersion: tekton.dev/v1alpha1
|
||||
apiVersion: tekton.dev/v1beta1
|
||||
kind: TaskRun
|
||||
metadata:
|
||||
name: openwhisk-nodejs-helloworld
|
||||
@ -120,11 +120,15 @@ spec:
|
||||
name: task-openwhisk
|
||||
trigger:
|
||||
type: manual
|
||||
inputs:
|
||||
resources:
|
||||
inputs:
|
||||
- name: runtime-git
|
||||
resourceRef:
|
||||
name: openwhisk-nodejs-runtime-git
|
||||
outputs:
|
||||
- name: runtime-image
|
||||
resourceRef:
|
||||
name: openwhisk-nodejs-helloworld-image
|
||||
params:
|
||||
- name: DOCKERFILE
|
||||
value: "./runtime-git/core/nodejs10Action/knative/Dockerfile"
|
||||
@ -134,11 +138,6 @@ spec:
|
||||
value: "function main() {return {payload: 'Hello World!'};}"
|
||||
- name: OW_PROJECT_URL
|
||||
value: ""
|
||||
outputs:
|
||||
resources:
|
||||
- name: runtime-image
|
||||
resourceRef:
|
||||
name: openwhisk-nodejs-helloworld-image
|
||||
---
|
||||
```
|
||||
</details>
|
||||
@ -303,7 +302,7 @@ spec:
|
||||
---
|
||||
|
||||
# Task Run to build NodeJS image with the action source
|
||||
apiVersion: tekton.dev/v1alpha1
|
||||
apiVersion: tekton.dev/v1beta1
|
||||
kind: TaskRun
|
||||
metadata:
|
||||
name: openwhisk-nodejs-helloworld-with-params
|
||||
@ -313,11 +312,15 @@ spec:
|
||||
name: task-openwhisk
|
||||
trigger:
|
||||
type: manual
|
||||
inputs:
|
||||
resources:
|
||||
inputs:
|
||||
- name: runtime-git
|
||||
resourceRef:
|
||||
name: openwhisk-nodejs-runtime-git
|
||||
outputs:
|
||||
- name: runtime-image
|
||||
resourceRef:
|
||||
name: openwhisk-nodejs-helloworld-with-params-image
|
||||
params:
|
||||
- name: DOCKERFILE
|
||||
value: "./runtime-git/core/nodejs10Action/knative/Dockerfile"
|
||||
@ -327,11 +330,6 @@ spec:
|
||||
value: "function main(params) {return {payload: 'Hello ' + params.name + ' from ' + params.place + '!'};}"
|
||||
- name: OW_PROJECT_URL
|
||||
value: ""
|
||||
outputs:
|
||||
resources:
|
||||
- name: runtime-image
|
||||
resourceRef:
|
||||
name: openwhisk-nodejs-helloworld-with-params-image
|
||||
---
|
||||
```
|
||||
</details>
|
||||
@ -403,7 +401,7 @@ spec:
|
||||
---
|
||||
|
||||
# Task Run to build NodeJS image with the action source
|
||||
apiVersion: tekton.dev/v1alpha1
|
||||
apiVersion: tekton.dev/v1beta1
|
||||
kind: TaskRun
|
||||
metadata:
|
||||
name: openwhisk-nodejs-raw-github
|
||||
@ -413,11 +411,15 @@ spec:
|
||||
name: openwhisk
|
||||
trigger:
|
||||
type: manual
|
||||
inputs:
|
||||
resources:
|
||||
inputs:
|
||||
- name: runtime-git
|
||||
resourceRef:
|
||||
name: openwhisk-nodejs-runtime-git
|
||||
outputs:
|
||||
- name: runtime-image
|
||||
resourceRef:
|
||||
name: openwhisk-nodejs-raw-github-image
|
||||
params:
|
||||
- name: DOCKERFILE
|
||||
value: "./runtime-git/core/nodejs10Action/knative/Dockerfile"
|
||||
@ -427,11 +429,6 @@ spec:
|
||||
value: ""
|
||||
- name: OW_PROJECT_URL
|
||||
value: "https://raw.githubusercontent.com/tektoncd/catalog/openwhisk/openwhisk/runtimes/javascript/examples/03-github/hello.js"
|
||||
outputs:
|
||||
resources:
|
||||
- name: runtime-image
|
||||
resourceRef:
|
||||
name: openwhisk-nodejs-raw-github-image
|
||||
---
|
||||
```
|
||||
</details>
|
||||
@ -506,7 +503,7 @@ spec:
|
||||
---
|
||||
|
||||
# Task Run to build NodeJS image with the action source
|
||||
apiVersion: tekton.dev/v1alpha1
|
||||
apiVersion: tekton.dev/v1beta1
|
||||
kind: TaskRun
|
||||
metadata:
|
||||
name: openwhisk-nodejs-zip
|
||||
@ -516,11 +513,15 @@ spec:
|
||||
name: openwhisk
|
||||
trigger:
|
||||
type: manual
|
||||
inputs:
|
||||
resources:
|
||||
inputs:
|
||||
- name: runtime-git
|
||||
resourceRef:
|
||||
name: openwhisk-nodejs-runtime-git
|
||||
outputs:
|
||||
- name: runtime-image
|
||||
resourceRef:
|
||||
name: openwhisk-nodejs-zip-image
|
||||
params:
|
||||
- name: DOCKERFILE
|
||||
value: "./runtime-git/core/nodejs10Action/knative/Dockerfile"
|
||||
@ -530,11 +531,6 @@ spec:
|
||||
value: ""
|
||||
- name: OW_PROJECT_URL
|
||||
value: "https://github.com/tektoncd/catalog/raw/master/openwhisk/runtimes/javascript/examples/04-zip/action.zip"
|
||||
outputs:
|
||||
resources:
|
||||
- name: runtime-image
|
||||
resourceRef:
|
||||
name: openwhisk-nodejs-zip-image
|
||||
---
|
||||
```
|
||||
</details>
|
||||
|
@ -25,7 +25,7 @@ spec:
|
||||
---
|
||||
|
||||
# Task Run to build NodeJS image with the action source
|
||||
apiVersion: tekton.dev/v1alpha1
|
||||
apiVersion: tekton.dev/v1beta1
|
||||
kind: TaskRun
|
||||
metadata:
|
||||
name: openwhisk-nodejs-helloworld
|
||||
@ -35,11 +35,15 @@ spec:
|
||||
name: openwhisk
|
||||
trigger:
|
||||
type: manual
|
||||
inputs:
|
||||
resources:
|
||||
inputs:
|
||||
- name: runtime-git
|
||||
resourceRef:
|
||||
name: openwhisk-nodejs-runtime-git
|
||||
outputs:
|
||||
- name: runtime-image
|
||||
resourceRef:
|
||||
name: openwhisk-nodejs-helloworld-image
|
||||
params:
|
||||
- name: DOCKERFILE
|
||||
value: "./runtime-git/core/nodejs10Action/knative/Dockerfile"
|
||||
@ -49,11 +53,4 @@ spec:
|
||||
value: "function main() {return {payload: 'Hello World!'};}"
|
||||
- name: OW_PROJECT_URL
|
||||
value: ""
|
||||
outputs:
|
||||
resources:
|
||||
- name: runtime-image
|
||||
resourceRef:
|
||||
name: openwhisk-nodejs-helloworld-image
|
||||
---
|
||||
|
||||
|
||||
|
@ -25,7 +25,7 @@ spec:
|
||||
---
|
||||
|
||||
# Task Run to build NodeJS image with the action source
|
||||
apiVersion: tekton.dev/v1alpha1
|
||||
apiVersion: tekton.dev/v1beta1
|
||||
kind: TaskRun
|
||||
metadata:
|
||||
name: openwhisk-nodejs-helloworld-with-params
|
||||
@ -35,11 +35,15 @@ spec:
|
||||
name: openwhisk
|
||||
trigger:
|
||||
type: manual
|
||||
inputs:
|
||||
resources:
|
||||
inputs:
|
||||
- name: runtime-git
|
||||
resourceRef:
|
||||
name: openwhisk-nodejs-runtime-git
|
||||
outputs:
|
||||
- name: runtime-image
|
||||
resourceRef:
|
||||
name: openwhisk-nodejs-helloworld-with-params-image
|
||||
params:
|
||||
- name: DOCKERFILE
|
||||
value: "./runtime-git/core/nodejs10Action/knative/Dockerfile"
|
||||
@ -49,11 +53,4 @@ spec:
|
||||
value: "function main(params) {return {payload: 'Hello ' + params.name + ' from ' + params.place + '!'};}"
|
||||
- name: OW_PROJECT_URL
|
||||
value: ""
|
||||
outputs:
|
||||
resources:
|
||||
- name: runtime-image
|
||||
resourceRef:
|
||||
name: openwhisk-nodejs-helloworld-with-params-image
|
||||
---
|
||||
|
||||
|
||||
|
@ -25,7 +25,7 @@ spec:
|
||||
---
|
||||
|
||||
# Task Run to build NodeJS image with the action source
|
||||
apiVersion: tekton.dev/v1alpha1
|
||||
apiVersion: tekton.dev/v1beta1
|
||||
kind: TaskRun
|
||||
metadata:
|
||||
name: openwhisk-nodejs-raw-github
|
||||
@ -35,11 +35,15 @@ spec:
|
||||
name: openwhisk
|
||||
trigger:
|
||||
type: manual
|
||||
inputs:
|
||||
resources:
|
||||
inputs:
|
||||
- name: runtime-git
|
||||
resourceRef:
|
||||
name: openwhisk-nodejs-runtime-git
|
||||
outputs:
|
||||
- name: runtime-image
|
||||
resourceRef:
|
||||
name: openwhisk-nodejs-raw-github-image
|
||||
params:
|
||||
- name: DOCKERFILE
|
||||
value: "./runtime-git/core/nodejs10Action/knative/Dockerfile"
|
||||
@ -49,11 +53,4 @@ spec:
|
||||
value: ""
|
||||
- name: OW_PROJECT_URL
|
||||
value: "https://raw.githubusercontent.com/tektoncd/catalog/openwhisk/openwhisk/runtimes/javascript/examples/03-github/hello.js"
|
||||
outputs:
|
||||
resources:
|
||||
- name: runtime-image
|
||||
resourceRef:
|
||||
name: openwhisk-nodejs-raw-github-image
|
||||
---
|
||||
|
||||
|
||||
|
@ -25,7 +25,7 @@ spec:
|
||||
---
|
||||
|
||||
# Task Run to build NodeJS image with the action source
|
||||
apiVersion: tekton.dev/v1alpha1
|
||||
apiVersion: tekton.dev/v1beta1
|
||||
kind: TaskRun
|
||||
metadata:
|
||||
name: openwhisk-nodejs-zip
|
||||
@ -35,11 +35,15 @@ spec:
|
||||
name: openwhisk
|
||||
trigger:
|
||||
type: manual
|
||||
inputs:
|
||||
resources:
|
||||
inputs:
|
||||
- name: runtime-git
|
||||
resourceRef:
|
||||
name: openwhisk-nodejs-runtime-git
|
||||
outputs:
|
||||
- name: runtime-image
|
||||
resourceRef:
|
||||
name: openwhisk-nodejs-zip-image
|
||||
params:
|
||||
- name: DOCKERFILE
|
||||
value: "./runtime-git/core/nodejs10Action/knative/Dockerfile"
|
||||
@ -51,11 +55,4 @@ spec:
|
||||
value: "true"
|
||||
- name: OW_PROJECT_URL
|
||||
value: "https://github.com/tektoncd/catalog/blob/openwhisk/openwhisk/runtimes/javascript/examples/04-zip/action.zip?raw=true"
|
||||
outputs:
|
||||
resources:
|
||||
- name: runtime-image
|
||||
resourceRef:
|
||||
name: openwhisk-nodejs-zip-image
|
||||
---
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user