| # |
| # Licensed to the Apache Software Foundation (ASF) under one or more |
| # contributor license agreements. See the NOTICE file distributed with |
| # this work for additional information regarding copyright ownership. |
| # The ASF licenses this file to You under the Apache License, Version 2.0 |
| # (the "License"); you may not use this file except in compliance with |
| # the License. You may obtain a copy of the License at |
| # |
| # http://www.apache.org/licenses/LICENSE-2.0 |
| # |
| # Unless required by applicable law or agreed to in writing, software |
| # distributed under the License is distributed on an "AS IS" BASIS, |
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| # See the License for the specific language governing permissions and |
| # limitations under the License. |
| # |
| apiVersion: build.knative.dev/v1alpha1 |
| kind: BuildTemplate |
| metadata: |
| name: openwhisk-java-runtime |
| spec: |
| parameters: |
| - 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: "" |
| - name: OW_ACTION_CODE |
| description: Java 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" |
| steps: |
| - name: add-ow-env-to-dockerfile |
| image: "gcr.io/kaniko-project/executor:debug" |
| command: |
| - /busybox/sh |
| args: |
| - -c |
| - | |
| cat <<EOF >> ${DOCKERFILE} |
| ENV __OW_RUNTIME_DEBUG "${OW_RUNTIME_DEBUG}" |
| ENV __OW_RUNTIME_PLATFORM "${OW_RUNTIME_PLATFORM}" |
| ENV __OW_ACTION_NAME "${OW_ACTION_NAME}" |
| ENV __OW_ACTION_CODE "${OW_ACTION_CODE}" |
| ENV __OW_ACTION_MAIN "${OW_ACTION_MAIN}" |
| ENV __OW_ACTION_BINARY "${OW_ACTION_BINARY}" |
| ENV __OW_HTTP_METHODS "${OW_HTTP_METHODS}" |
| ENV __OW_ACTION_RAW "${OW_ACTION_RAW}" |
| EOF |
| - name: build-openwhisk-java-runtime |
| image: "gcr.io/kaniko-project/executor:latest" |
| args: ["--destination=${TARGET_IMAGE_NAME}:${TARGET_IMAGE_TAG}", "--dockerfile=${DOCKERFILE}"] |