This is an automated email from the ASF dual-hosted git repository.
mrutkowski pushed a commit to branch master
in repository
https://gitbox.apache.org/repos/asf/incubator-openwhisk-devtools.git
The following commit(s) were added to refs/heads/master by this push:
new 3393107 Read code from a remote file (#252)
3393107 is described below
commit 3393107b7e9f7d4712b476a0cd5aa5a0cba2b7a4
Author: Priti Desai <[email protected]>
AuthorDate: Wed Apr 24 10:48:55 2019 -0700
Read code from a remote file (#252)
* first version of reading code from remote
* first version of reading code from remote
* first version of reading code from remote
* first version of reading code from remote
* first version of reading code from remote
* first version of reading code from remote
---
knative-build/runtimes/javascript/buildtemplate.yaml | 16 +++++++++++++++-
1 file changed, 15 insertions(+), 1 deletion(-)
diff --git a/knative-build/runtimes/javascript/buildtemplate.yaml
b/knative-build/runtimes/javascript/buildtemplate.yaml
index ab80f99..0760ced 100644
--- a/knative-build/runtimes/javascript/buildtemplate.yaml
+++ b/knative-build/runtimes/javascript/buildtemplate.yaml
@@ -37,6 +37,9 @@ spec:
- name: OW_ACTION_RAW
description: flag to indicate raw HTTP handling, interpret and process an
incoming HTTP body directly
default: "false"
+ - name: OW_PROJECT_URL
+ description: Location to local/remote file storage or public/private
GitHub repo from where JavaScript source code needs to be evaluated
+ default: ""
steps:
- name: add-ow-env-to-dockerfile
image: "gcr.io/kaniko-project/executor:debug"
@@ -45,11 +48,22 @@ spec:
args:
- -c
- |
+ if [ -z ${OW_PROJECT_URL} ]; then
+ OW_ACTION_CODE="${OW_ACTION_CODE}"
+ else
+ TEMPDIR="knative-"$((1 + RANDOM % 100))
+ TEMPFILE=`basename "${OW_PROJECT_URL}"`
+ mkdir $TEMPDIR
+ cd $TEMPDIR
+ wget -O $TEMPFILE "${OW_PROJECT_URL}"
+ OW_ACTION_CODE=`cat $TEMPFILE`
+ cd ..
+ fi
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_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}"