-
-
Save SugandhaAgrawal/872ee5067543f417840f674994cbb064 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
apiVersion: tekton.dev/v1alpha1 | |
kind: Task | |
metadata: | |
name: task-build | |
spec: | |
inputs: | |
resources: | |
- name: docker-source | |
type: git | |
params: | |
- name: TARGET_IMAGE_NAME | |
description: name of the image to be tagged and pushed | |
- name: TARGET_IMAGE_TAG | |
description: tag the image before pushing | |
default: "latest" | |
- name: DOCKERFILE | |
description: name of the dockerfile | |
- name: OW_RUNTIME_DEBUG | |
description: flag to indicate debug mode should be on/off | |
default: "false" | |
- name: OW_RUNTIME_PLATFORM | |
description: flag to indicate the platform, one of ["openwhisk", "knative", ... ] | |
default: "knative" | |
- name: OW_ACTION_NAME | |
description: name of the action | |
default: "foo" | |
- name: OW_ACTION_CODE | |
description: JavaScript source code to be evaluated | |
default: "" | |
- name: OW_ACTION_MAIN | |
description: name of the function in the "__OW_ACTION_CODE" to call as the action handler | |
default: "main" | |
- name: OW_ACTION_BINARY | |
description: flag to indicate zip function, for zip actions, "__OW_ACTION_CODE" must be base64 encoded string | |
default: "false" | |
- name: OW_HTTP_METHODS | |
description: list of HTTP methods, any combination of [GET, POST, PUT, and DELETE], default is [POST] | |
default: "[POST]" | |
- name: OW_ACTION_RAW | |
description: flag to indicate raw HTTP handling, interpret and process an incoming HTTP body directly | |
default: "false" | |
outputs: | |
resources: | |
- name: builtImage | |
type: image | |
steps: | |
- name: add-ow-env-to-dockerfile | |
image: "gcr.io/kaniko-project/executor:debug" | |
command: | |
- /busybox/sh | |
args: | |
- -c | |
- | | |
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}" | |
ENV __OW_ACTION_CODE "${inputs.params.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}" | |
EOF | |
- name: adapt-dockerfile-to-tekton | |
image: "gcr.io/kaniko-project/executor:debug" | |
command: | |
- sed | |
args: | |
- -i | |
- -e | |
- 's/COPY ./COPY .\/docker-source/g' | |
- ${inputs.params.DOCKERFILE} | |
- name: build-openwhisk-nodejs-runtime | |
image: "gcr.io/kaniko-project/executor:latest" | |
args: ["--destination=${inputs.params.TARGET_IMAGE_NAME}:${inputs.params.TARGET_IMAGE_TAG}", "--dockerfile=${inputs.params.DOCKERFILE}"] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment