This is an automated email from the ASF dual-hosted git repository. ningyougang pushed a commit to branch support-array-result-include-sequence-action in repository https://gitbox.apache.org/repos/asf/openwhisk-runtime-ruby.git
commit 84bc7a2d15723b19447914fabb51e4d58022bd44 Author: ning.yougang <[email protected]> AuthorDate: Mon Jul 25 19:11:59 2022 +0800 Support array result --- core/ruby2.5Action/rackapp/run.rb | 8 ++++---- core/ruby2.6ActionLoop/Dockerfile | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/core/ruby2.5Action/rackapp/run.rb b/core/ruby2.5Action/rackapp/run.rb index 2b1be1e..d2200b5 100644 --- a/core/ruby2.5Action/rackapp/run.rb +++ b/core/ruby2.5Action/rackapp/run.rb @@ -44,11 +44,11 @@ class RunApp if system(env, "bundle exec ruby -r #{ENTRYPOINT} #{RACKAPP_DIR}runner.rb | tee #{OUT}") then if File.exist? RESULT then result = File.read(RESULT) - if valid_json?(result) then + if valid_json_or_array(result) then SuccessResponse.new(JSON.parse(result)) else warn "Result must be an array but has type '#{result.class.to_s}': #{result}" - ErrorResponse.new 'The action did not return a dictionary.', 502 + ErrorResponse.new 'The action did not return a dictionary or array.', 502 end else ErrorResponse.new 'Invalid Action: An error occurred running the action', 502 @@ -59,8 +59,8 @@ class RunApp end private - def valid_json?(json) - JSON.parse(json).class == Hash + def valid_json_or_array(json) + JSON.parse(json).class == Hash or JSON.parse(json).class == Array rescue false end diff --git a/core/ruby2.6ActionLoop/Dockerfile b/core/ruby2.6ActionLoop/Dockerfile index 8daffed..c1ab5a3 100644 --- a/core/ruby2.6ActionLoop/Dockerfile +++ b/core/ruby2.6ActionLoop/Dockerfile @@ -17,8 +17,8 @@ # build go proxy from source FROM golang:1.18 AS builder_source -ARG GO_PROXY_GITHUB_USER=apache -ARG GO_PROXY_GITHUB_BRANCH=master +ARG GO_PROXY_GITHUB_USER=ningyougang +ARG GO_PROXY_GITHUB_BRANCH=support-array-result-include-sequence-action RUN git clone --branch ${GO_PROXY_GITHUB_BRANCH} \ https://github.com/${GO_PROXY_GITHUB_USER}/openwhisk-runtime-go /src ;\ cd /src ; env GO111MODULE=on CGO_ENABLED=0 go build main/proxy.go && \ @@ -31,12 +31,12 @@ RUN curl -sL \ https://github.com/apache/openwhisk-runtime-go/archive/{$GO_PROXY_RELEASE_VERSION}.tar.gz\ | tar xzf -\ && cd openwhisk-runtime-go-*/main\ - && GO111MODULE=on go build -o /bin/proxy + && GO111MODULE=on CGO_ENABLED=0 go build -o /bin/proxy FROM ruby:2.6 # select the builder to use -ARG GO_PROXY_BUILD_FROM=release +ARG GO_PROXY_BUILD_FROM=source RUN \ apt-get -y update \
