This is an automated email from the ASF dual-hosted git repository.
dgrove pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/openwhisk-runtime-go.git
The following commit(s) were added to refs/heads/master by this push:
new 8e653fa end of life: remove golang1.17 and golang1.18 (#186)
8e653fa is described below
commit 8e653fa98bd6e705a33f1acf87379fe388055aab
Author: David Grove <[email protected]>
AuthorDate: Sat Feb 18 16:29:28 2023 -0500
end of life: remove golang1.17 and golang1.18 (#186)
Go versions 1.17 and 1.18 are both past their end-of-life
and are no longer supported by the upstream language runtime.
---
.github/workflows/ci.yaml | 4 -
docs/BUILD.md | 4 +-
docs/DEPLOY.md | 2 +-
golang1.17/Dockerfile | 52 --------
golang1.17/Makefile | 44 -------
golang1.17/bin/compile | 138 --------------------
golang1.17/build.gradle | 38 ------
golang1.17/lib/launcher.go | 141 ---------------------
golang1.18/Dockerfile | 54 --------
golang1.18/Makefile | 44 -------
golang1.18/bin/compile | 138 --------------------
golang1.18/build.gradle | 38 ------
golang1.18/lib/launcher.go | 141 ---------------------
settings.gradle | 2 -
.../ActionLoopBasicGo17Tests.scala | 31 -----
.../ActionLoopBasicGo18Tests.scala | 31 -----
.../ActionLoopGo17ContainerTests.scala | 31 -----
.../ActionLoopGo18ContainerTests.scala | 31 -----
18 files changed, 3 insertions(+), 961 deletions(-)
diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml
index d3e6e18..7601fc9 100644
--- a/.github/workflows/ci.yaml
+++ b/.github/workflows/ci.yaml
@@ -90,10 +90,6 @@ jobs:
SHORT_COMMIT=$(git rev-parse --short "$GITHUB_SHA")
./gradlew :actionloop:distDocker -PdockerRegistry=docker.io
-PdockerImagePrefix=openwhisk -PdockerImageTag=nightly
./gradlew :actionloop:distDocker -PdockerRegistry=docker.io
-PdockerImagePrefix=openwhisk -PdockerImageTag=$SHORT_COMMIT
- ./gradlew :golang1.17:distDocker -PdockerRegistry=docker.io
-PdockerImagePrefix=openwhisk -PdockerImageTag=nightly
- ./gradlew :golang1.17:distDocker -PdockerRegistry=docker.io
-PdockerImagePrefix=openwhisk -PdockerImageTag=$SHORT_COMMIT
- ./gradlew :golang1.18:distDocker -PdockerRegistry=docker.io
-PdockerImagePrefix=openwhisk -PdockerImageTag=nightly
- ./gradlew :golang1.18:distDocker -PdockerRegistry=docker.io
-PdockerImagePrefix=openwhisk -PdockerImageTag=$SHORT_COMMIT
./gradlew :golang1.19:distDocker -PdockerRegistry=docker.io
-PdockerImagePrefix=openwhisk -PdockerImageTag=nightly
./gradlew :golang1.19:distDocker -PdockerRegistry=docker.io
-PdockerImagePrefix=openwhisk -PdockerImageTag=$SHORT_COMMIT
./gradlew :golang1.20:distDocker -PdockerRegistry=docker.io
-PdockerImagePrefix=openwhisk -PdockerImageTag=nightly
diff --git a/docs/BUILD.md b/docs/BUILD.md
index 76673ed..3e96383 100644
--- a/docs/BUILD.md
+++ b/docs/BUILD.md
@@ -43,8 +43,8 @@ To build the docker images, after compiling go proxy:
This will build the images:
-* `action-golang-v1.17`: an image supporting Go 1.17 sources (does expect an
ack)
-* `action-golang-v1.18`: an image supporting Go 1.18 sources (does expect an
ack)
+* `action-golang-v1.19`: an image supporting Go 1.19 sources (does expect an
ack)
+* `action-golang-v1.20`: an image supporting Go 1.20 sources (does expect an
ack)
* `actionloop-base`: the base image, supporting generic executables ans shell
script (does not expect an ack)
The `actionloop-base` image can be used for supporting other compiled
programming languages as long as they implement a `compile` script and the
*action loop* protocol described below. Please check [ENVVARS.md](ENVVARS.md)
for configuration options
diff --git a/docs/DEPLOY.md b/docs/DEPLOY.md
index e677065..eb0c930 100644
--- a/docs/DEPLOY.md
+++ b/docs/DEPLOY.md
@@ -19,7 +19,7 @@
# Deployment options
-There are a few images provided: the `actionloop-base` and the
`action-golang-v1.17` and `action-golang-v1.18` are available. Each image
accepts different input in the deployment.
+There are a few images provided: the `actionloop-base` and the
`action-golang-v1.19` and `action-golang-v1.20` are available. Each image
accepts different input in the deployment.
<a name="actionloop">
diff --git a/golang1.17/Dockerfile b/golang1.17/Dockerfile
deleted file mode 100644
index d16866f..0000000
--- a/golang1.17/Dockerfile
+++ /dev/null
@@ -1,52 +0,0 @@
-#
-# 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.
-#
-
-# Do not fix the patch level for golang:1.17 to automatically get security
fixes.
-FROM golang:1.17-buster
-
-RUN echo "deb http://deb.debian.org/debian buster-backports main contrib
non-free" \
- >>/etc/apt/sources.list &&\
- echo 'debconf debconf/frontend select Noninteractive' |
debconf-set-selections &&\
- apt-get update &&\
- # Upgrade installed packages to get latest security fixes if the base
image does not contain them already.
- apt-get upgrade -y --no-install-recommends &&\
- apt-get install -y apt-utils &&\
- apt-get install -y \
- curl \
- jq \
- git \
- zip \
- vim &&\
- apt-get -y install \
- librdkafka1=0.11.6-1.1 \
- librdkafka++1=0.11.6-1.1 &&\
- apt-get -y install \
- librdkafka-dev=0.11.6-1.1 &&\
- # Cleanup apt data, we do not need them later on.
- apt-get clean && rm -rf /var/lib/apt/lists/* &&\
- go install github.com/go-delve/delve/cmd/[email protected] &&\
- mkdir /action
-
-WORKDIR /action
-ADD proxy /bin/proxy
-ADD bin/compile /bin/compile
-ADD lib/launcher.go /lib/launcher.go
-ENV OW_COMPILER=/bin/compile
-ENV OW_LOG_INIT_ERROR=1
-ENV OW_WAIT_FOR_ACK=1
-ENV OW_EXECUTION_ENV=openwhisk/action-golang-v1.17
-ENTRYPOINT [ "/bin/proxy" ]
diff --git a/golang1.17/Makefile b/golang1.17/Makefile
deleted file mode 100644
index bc87b7a..0000000
--- a/golang1.17/Makefile
+++ /dev/null
@@ -1,44 +0,0 @@
-#
-# 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.
-#
-IMG=action-golang-v1.17
-
-build:
- ../gradlew distDocker
-
-localbuild:
- GOOS=linux GOARCH=amd64 go build -o proxy -a -ldflags '-extldflags
"-static"' ../main/proxy.go
- docker build -t $(IMG) .
- docker tag $(IMG) whisk/$(IMG)
-
-push: build
- docker tag $(IMG) actionloop/$(IMG)
- docker push actionloop/$(IMG):nightly
-
-clean:
- docker rmi -f whisk/$(IMG) actionloop/$(IMG)
-
-debug: build
- docker run -p 8080:8080 \
- --name go-action --rm -ti --entrypoint=/bin/bash \
- -e OW_COMPILER=/mnt/bin/compile \
- -v $(PWD):/mnt whisk/$(IMG)
-
-enter:
- docker exec -ti go-action bash
-
-
-.PHONY: build push clean debug enter
diff --git a/golang1.17/bin/compile b/golang1.17/bin/compile
deleted file mode 100755
index c3f7ebe..0000000
--- a/golang1.17/bin/compile
+++ /dev/null
@@ -1,138 +0,0 @@
-#!/usr/bin/python -u
-"""Golang Action Compiler
-#
-# 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.
-#
-"""
-from __future__ import print_function
-import os, os.path, sys, re, shutil, subprocess, traceback, codecs
-from os.path import dirname, exists
-from time import sleep
-
-# write a file creating intermediate directories
-def write_file(file, body, executable=False):
- try: os.makedirs(dirname(file), mode=0o755)
- except: pass
- with open(file, mode="wb") as f:
- f.write(body)
- if executable:
- os.chmod(file, 0o755)
-
-# copy a file eventually replacing a substring
-def copy_replace(src, dst, match=None, replacement=""):
- with open(src, 'rb') as s:
- body = s.read()
- if match:
- body = body.replace(match, replacement)
- write_file(dst, body)
-
-
-def sources(launcher, source_dir, main):
- func = main.capitalize()
- has_main = None
-
- # copy the exec to exec.go
- # also check if it has a main in it
- src = "%s/exec" % source_dir
- dst = "%s/exec__.go" % source_dir
- if os.path.isfile(src):
- with codecs.open(src, 'r', 'utf-8') as s:
- with codecs.open(dst, 'w', 'utf-8') as d:
- body = s.read()
- has_main =
re.match(r".*package\s+main\W.*func\s+main\s*\(\s*\)", body, flags=re.DOTALL)
- d.write(body)
-
- # copy the launcher fixing the main
- if not has_main:
- dst = "%s/main__.go" % source_dir
- if os.path.isdir("%s/main" % source_dir):
- dst = "%s/main/main__.go" % source_dir
- with codecs.open(dst, 'w', 'utf-8') as d:
- with codecs.open(launcher, 'r', 'utf-8') as e:
- code = e.read()
- code = code.replace("Main", func)
- d.write(code)
-
-def build(source_dir, target_dir):
- # compile...
- source_dir = os.path.abspath(source_dir)
- parent = dirname(source_dir)
- target = os.path.abspath("%s/exec" % target_dir)
- if os.environ.get("__OW_EXECUTION_ENV"):
- write_file("%s.env" % target,
str.encode(os.environ["__OW_EXECUTION_ENV"]))
-
- env = {
- "GOROOT": "/usr/local/go",
- "GOPATH": "/home/go",
- "PATH": os.environ["PATH"],
- "GOCACHE": "/tmp",
- "GO111MODULE": "on"
- }
-
- gomod = "%s/go.mod" % source_dir
- with open(os.devnull, "w") as dn:
- if exists(gomod):
- ret = subprocess.call(["go", "mod", "download"], cwd=source_dir,
env=env, stderr=dn, stdout=dn)
- if ret != 0:
- print("cannot download modules")
- return
- else:
- ret = subprocess.call(["go", "mod", "init", "exec"],
cwd=source_dir, env=env, stdout=dn, stderr=dn)
- if ret != 0:
- print("cannot init modules")
- return
-
- ldflags = "-s -w"
- gobuild = ["go", "build", "-o", target, "-ldflags", ldflags]
- if os.environ.get("__OW_EXECUTION_ENV"):
- ldflags += " -X main.OwExecutionEnv=%s" %
os.environ["__OW_EXECUTION_ENV"]
- ret = subprocess.call(gobuild, cwd=source_dir, env=env)
- if ret != 0:
- print("failed", " ".join(gobuild), "\nin", source_dir, "\nenv", env)
-
-def debug(source_dir, target_dir, port):
- source_dir = os.path.abspath(source_dir)
- target = os.path.abspath("%s/exec" % target_dir)
- if os.environ.get("__OW_EXECUTION_ENV"):
- write_file("%s/exec.env" % source_dir, os.environ["__OW_EXECUTION_ENV"])
- shutil.rmtree(target_dir)
- shutil.move(source_dir, target_dir)
- write_file(target, """#!/bin/bash
-cd "$(dirname $0)"
-export GOCACHE=/tmp
-export PATH=%s
-exec script -q -c '/go/bin/dlv debug --headless --listen=127.0.0.1:%s
--continue --accept-multiclient --log-dest /tmp/delve.log'
-""" % (os.environ["PATH"], port) , True)
-
-def main(argv):
- if len(argv) < 4:
- print("usage: <main-file> <source-dir> <target-dir>")
- sys.exit(1)
-
- main = argv[1]
- source_dir = argv[2]
- target_dir = argv[3]
- launcher = dirname(dirname(argv[0]))+"/lib/launcher.go"
- sources(launcher, source_dir, main)
-
- # if the debug port is present and not empty build with debug
- if os.environ.get("__OW_DEBUG_PORT"):
- debug(source_dir, target_dir, os.environ["__OW_DEBUG_PORT"])
- else:
- build(source_dir, target_dir)
-
-if __name__ == '__main__':
- main(sys.argv)
diff --git a/golang1.17/build.gradle b/golang1.17/build.gradle
deleted file mode 100644
index 429b380..0000000
--- a/golang1.17/build.gradle
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * 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.
- */
-
-ext.dockerImageName = 'action-golang-v1.17'
-apply from: '../gradle/docker.gradle'
-
-distDocker.dependsOn 'staticBuildProxy'
-distDocker.finalizedBy('cleanup')
-
-task staticBuildProxy(type: Exec) {
- environment CGO_ENABLED: "0"
- environment GOOS: "linux"
- environment GOARCH: "amd64"
- environment GO111MODULE: "on"
-
- commandLine 'go', 'build',
- '-o', 'proxy', '-a',
- '-ldflags', '-extldflags "-static"',
- '../main/proxy.go'
-}
-
-task cleanup(type: Delete) {
- delete 'proxy'
-}
diff --git a/golang1.17/lib/launcher.go b/golang1.17/lib/launcher.go
deleted file mode 100644
index b432b88..0000000
--- a/golang1.17/lib/launcher.go
+++ /dev/null
@@ -1,141 +0,0 @@
-/*
- * 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.
- */
-
-package main
-
-import (
- "bufio"
- "bytes"
- "encoding/json"
- "fmt"
- "io"
- "log"
- "os"
- "reflect"
- "strings"
-)
-
-// OwExecutionEnv is the execution environment set at compile time
-var OwExecutionEnv = ""
-
-func main() {
- // check if the execution environment is correct
- if OwExecutionEnv != "" && OwExecutionEnv !=
os.Getenv("__OW_EXECUTION_ENV") {
- fmt.Println("Execution Environment Mismatch")
- fmt.Println("Expected: ", OwExecutionEnv)
- fmt.Println("Actual: ", os.Getenv("__OW_EXECUTION_ENV"))
- os.Exit(1)
- }
-
- // debugging
- var debug = os.Getenv("OW_DEBUG") != ""
- if debug {
- f, err := os.OpenFile("/tmp/action.log",
os.O_RDWR|os.O_CREATE|os.O_APPEND, 0666)
- if err == nil {
- log.SetOutput(f)
- }
- log.Printf("Environment: %v", os.Environ())
- }
-
- resultKind := reflect.TypeOf(Main).Out(0).Kind()
- if resultKind != reflect.Map && resultKind != reflect.Slice &&
resultKind != reflect.Array {
- fmt.Println("Support map and slice and array only")
- os.Exit(1)
- }
-
- // input
- out := os.NewFile(3, "pipe")
- defer out.Close()
- reader := bufio.NewReader(os.Stdin)
-
- // acknowledgement of started action
- fmt.Fprintf(out, `{ "ok": true}%s`, "\n")
- if debug {
- log.Println("action started")
- }
-
- // read-eval-print loop
- for {
- // read one line
- inbuf, err := reader.ReadBytes('\n')
- if err != nil {
- if err != io.EOF {
- log.Println(err)
- }
- break
- }
- if debug {
- log.Printf(">>>'%s'>>>", inbuf)
- }
- // parse one line
- var input map[string]interface{}
- err = json.Unmarshal(inbuf, &input)
- if err != nil {
- log.Println(err.Error())
- fmt.Fprintf(out, "{ error: %q}\n", err.Error())
- continue
- }
- if debug {
- log.Printf("%v\n", input)
- }
- // set environment variables
- for k, v := range input {
- if k == "value" {
- continue
- }
- if s, ok := v.(string); ok {
- os.Setenv("__OW_"+strings.ToUpper(k), s)
- }
- }
- // get payload if not empty
- isJsonObjectParam := true
- var payloadForJsonObject map[string]interface{}
- var payloadForJsonArray []interface{}
- if value, ok := input["value"].(map[string]interface{}); ok {
- payloadForJsonObject = value
- } else {
- if value, ok := input["value"].([]interface{}); ok {
- payloadForJsonArray = value
- isJsonObjectParam = false
- }
- }
- // process the request
- var result interface{}
- funcMain := reflect.ValueOf(Main)
- if isJsonObjectParam {
- param :=
[]reflect.Value{reflect.ValueOf(payloadForJsonObject)}
- reflectResult := funcMain.Call(param)
- result = reflectResult[0].Interface()
- } else {
- param :=
[]reflect.Value{reflect.ValueOf(payloadForJsonArray)}
- reflectResult := funcMain.Call(param)
- result = reflectResult[0].Interface()
- }
- // encode the answer
- output, err := json.Marshal(&result)
- if err != nil {
- log.Println(err.Error())
- fmt.Fprintf(out, "{ error: %q}\n", err.Error())
- continue
- }
- output = bytes.Replace(output, []byte("\n"), []byte(""), -1)
- if debug {
- log.Printf("<<<'%s'<<<", output)
- }
- fmt.Fprintf(out, "%s\n", output)
- }
-}
diff --git a/golang1.18/Dockerfile b/golang1.18/Dockerfile
deleted file mode 100644
index a81310b..0000000
--- a/golang1.18/Dockerfile
+++ /dev/null
@@ -1,54 +0,0 @@
-#
-# 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.
-#
-
-# Do not fix the patch level for golang:1.18 to automatically get security
fixes.
-FROM golang:1.18-bullseye
-
-RUN echo "deb http://deb.debian.org/debian buster-backports main contrib
non-free" \
- >>/etc/apt/sources.list &&\
- echo 'debconf debconf/frontend select Noninteractive' |
debconf-set-selections &&\
- apt-get update &&\
- # Upgrade installed packages to get latest security fixes if the base
image does not contain them already.
- apt-get upgrade -y --no-install-recommends &&\
- apt-get install -y apt-utils &&\
- apt-get install -y \
- curl \
- jq \
- git \
- zip \
- vim && \
- apt-get -y install \
- librdkafka1 \
- librdkafka++1 &&\
- apt-get -y install \
- librdkafka-dev &&\
- # Cleanup apt data, we do not need them later on.
- apt-get clean && rm -rf /var/lib/apt/lists/* &&\
- go install github.com/go-delve/delve/cmd/dlv@latest &&\
- mkdir /action
-#make python 3 react as python
-RUN ln -s /usr/bin/python3 /usr/bin/python
-
-WORKDIR /action
-ADD proxy /bin/proxy
-ADD bin/compile /bin/compile
-ADD lib/launcher.go /lib/launcher.go
-ENV OW_COMPILER=/bin/compile
-ENV OW_LOG_INIT_ERROR=1
-ENV OW_WAIT_FOR_ACK=1
-ENV OW_EXECUTION_ENV=openwhisk/action-golang-v1.18
-ENTRYPOINT [ "/bin/proxy" ]
diff --git a/golang1.18/Makefile b/golang1.18/Makefile
deleted file mode 100644
index ccf6b60..0000000
--- a/golang1.18/Makefile
+++ /dev/null
@@ -1,44 +0,0 @@
-#
-# 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.
-#
-IMG=action-golang-v1.18
-
-build:
- ../gradlew distDocker
-
-localbuild:
- GOOS=linux GOARCH=amd64 go build -o proxy -a -ldflags '-extldflags
"-static"' ../main/proxy.go
- docker build -t $(IMG) .
- docker tag $(IMG) whisk/$(IMG)
-
-push: build
- docker tag $(IMG) actionloop/$(IMG)
- docker push actionloop/$(IMG):nightly
-
-clean:
- docker rmi -f whisk/$(IMG) actionloop/$(IMG)
-
-debug: build
- docker run -p 8080:8080 \
- --name go-action --rm -ti --entrypoint=/bin/bash \
- -e OW_COMPILER=/mnt/bin/compile \
- -v $(PWD):/mnt whisk/$(IMG)
-
-enter:
- docker exec -ti go-action bash
-
-
-.PHONY: build push clean debug enter
diff --git a/golang1.18/bin/compile b/golang1.18/bin/compile
deleted file mode 100755
index c3f7ebe..0000000
--- a/golang1.18/bin/compile
+++ /dev/null
@@ -1,138 +0,0 @@
-#!/usr/bin/python -u
-"""Golang Action Compiler
-#
-# 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.
-#
-"""
-from __future__ import print_function
-import os, os.path, sys, re, shutil, subprocess, traceback, codecs
-from os.path import dirname, exists
-from time import sleep
-
-# write a file creating intermediate directories
-def write_file(file, body, executable=False):
- try: os.makedirs(dirname(file), mode=0o755)
- except: pass
- with open(file, mode="wb") as f:
- f.write(body)
- if executable:
- os.chmod(file, 0o755)
-
-# copy a file eventually replacing a substring
-def copy_replace(src, dst, match=None, replacement=""):
- with open(src, 'rb') as s:
- body = s.read()
- if match:
- body = body.replace(match, replacement)
- write_file(dst, body)
-
-
-def sources(launcher, source_dir, main):
- func = main.capitalize()
- has_main = None
-
- # copy the exec to exec.go
- # also check if it has a main in it
- src = "%s/exec" % source_dir
- dst = "%s/exec__.go" % source_dir
- if os.path.isfile(src):
- with codecs.open(src, 'r', 'utf-8') as s:
- with codecs.open(dst, 'w', 'utf-8') as d:
- body = s.read()
- has_main =
re.match(r".*package\s+main\W.*func\s+main\s*\(\s*\)", body, flags=re.DOTALL)
- d.write(body)
-
- # copy the launcher fixing the main
- if not has_main:
- dst = "%s/main__.go" % source_dir
- if os.path.isdir("%s/main" % source_dir):
- dst = "%s/main/main__.go" % source_dir
- with codecs.open(dst, 'w', 'utf-8') as d:
- with codecs.open(launcher, 'r', 'utf-8') as e:
- code = e.read()
- code = code.replace("Main", func)
- d.write(code)
-
-def build(source_dir, target_dir):
- # compile...
- source_dir = os.path.abspath(source_dir)
- parent = dirname(source_dir)
- target = os.path.abspath("%s/exec" % target_dir)
- if os.environ.get("__OW_EXECUTION_ENV"):
- write_file("%s.env" % target,
str.encode(os.environ["__OW_EXECUTION_ENV"]))
-
- env = {
- "GOROOT": "/usr/local/go",
- "GOPATH": "/home/go",
- "PATH": os.environ["PATH"],
- "GOCACHE": "/tmp",
- "GO111MODULE": "on"
- }
-
- gomod = "%s/go.mod" % source_dir
- with open(os.devnull, "w") as dn:
- if exists(gomod):
- ret = subprocess.call(["go", "mod", "download"], cwd=source_dir,
env=env, stderr=dn, stdout=dn)
- if ret != 0:
- print("cannot download modules")
- return
- else:
- ret = subprocess.call(["go", "mod", "init", "exec"],
cwd=source_dir, env=env, stdout=dn, stderr=dn)
- if ret != 0:
- print("cannot init modules")
- return
-
- ldflags = "-s -w"
- gobuild = ["go", "build", "-o", target, "-ldflags", ldflags]
- if os.environ.get("__OW_EXECUTION_ENV"):
- ldflags += " -X main.OwExecutionEnv=%s" %
os.environ["__OW_EXECUTION_ENV"]
- ret = subprocess.call(gobuild, cwd=source_dir, env=env)
- if ret != 0:
- print("failed", " ".join(gobuild), "\nin", source_dir, "\nenv", env)
-
-def debug(source_dir, target_dir, port):
- source_dir = os.path.abspath(source_dir)
- target = os.path.abspath("%s/exec" % target_dir)
- if os.environ.get("__OW_EXECUTION_ENV"):
- write_file("%s/exec.env" % source_dir, os.environ["__OW_EXECUTION_ENV"])
- shutil.rmtree(target_dir)
- shutil.move(source_dir, target_dir)
- write_file(target, """#!/bin/bash
-cd "$(dirname $0)"
-export GOCACHE=/tmp
-export PATH=%s
-exec script -q -c '/go/bin/dlv debug --headless --listen=127.0.0.1:%s
--continue --accept-multiclient --log-dest /tmp/delve.log'
-""" % (os.environ["PATH"], port) , True)
-
-def main(argv):
- if len(argv) < 4:
- print("usage: <main-file> <source-dir> <target-dir>")
- sys.exit(1)
-
- main = argv[1]
- source_dir = argv[2]
- target_dir = argv[3]
- launcher = dirname(dirname(argv[0]))+"/lib/launcher.go"
- sources(launcher, source_dir, main)
-
- # if the debug port is present and not empty build with debug
- if os.environ.get("__OW_DEBUG_PORT"):
- debug(source_dir, target_dir, os.environ["__OW_DEBUG_PORT"])
- else:
- build(source_dir, target_dir)
-
-if __name__ == '__main__':
- main(sys.argv)
diff --git a/golang1.18/build.gradle b/golang1.18/build.gradle
deleted file mode 100644
index dbcc4c8..0000000
--- a/golang1.18/build.gradle
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * 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.
- */
-
-ext.dockerImageName = 'action-golang-v1.18'
-apply from: '../gradle/docker.gradle'
-
-distDocker.dependsOn 'staticBuildProxy'
-distDocker.finalizedBy('cleanup')
-
-task staticBuildProxy(type: Exec) {
- environment CGO_ENABLED: "0"
- environment GOOS: "linux"
- environment GOARCH: "amd64"
- environment GO111MODULE: "on"
-
- commandLine 'go', 'build',
- '-o', 'proxy', '-a',
- '-ldflags', '-extldflags "-static"',
- '../main/proxy.go'
-}
-
-task cleanup(type: Delete) {
- delete 'proxy'
-}
diff --git a/golang1.18/lib/launcher.go b/golang1.18/lib/launcher.go
deleted file mode 100644
index b432b88..0000000
--- a/golang1.18/lib/launcher.go
+++ /dev/null
@@ -1,141 +0,0 @@
-/*
- * 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.
- */
-
-package main
-
-import (
- "bufio"
- "bytes"
- "encoding/json"
- "fmt"
- "io"
- "log"
- "os"
- "reflect"
- "strings"
-)
-
-// OwExecutionEnv is the execution environment set at compile time
-var OwExecutionEnv = ""
-
-func main() {
- // check if the execution environment is correct
- if OwExecutionEnv != "" && OwExecutionEnv !=
os.Getenv("__OW_EXECUTION_ENV") {
- fmt.Println("Execution Environment Mismatch")
- fmt.Println("Expected: ", OwExecutionEnv)
- fmt.Println("Actual: ", os.Getenv("__OW_EXECUTION_ENV"))
- os.Exit(1)
- }
-
- // debugging
- var debug = os.Getenv("OW_DEBUG") != ""
- if debug {
- f, err := os.OpenFile("/tmp/action.log",
os.O_RDWR|os.O_CREATE|os.O_APPEND, 0666)
- if err == nil {
- log.SetOutput(f)
- }
- log.Printf("Environment: %v", os.Environ())
- }
-
- resultKind := reflect.TypeOf(Main).Out(0).Kind()
- if resultKind != reflect.Map && resultKind != reflect.Slice &&
resultKind != reflect.Array {
- fmt.Println("Support map and slice and array only")
- os.Exit(1)
- }
-
- // input
- out := os.NewFile(3, "pipe")
- defer out.Close()
- reader := bufio.NewReader(os.Stdin)
-
- // acknowledgement of started action
- fmt.Fprintf(out, `{ "ok": true}%s`, "\n")
- if debug {
- log.Println("action started")
- }
-
- // read-eval-print loop
- for {
- // read one line
- inbuf, err := reader.ReadBytes('\n')
- if err != nil {
- if err != io.EOF {
- log.Println(err)
- }
- break
- }
- if debug {
- log.Printf(">>>'%s'>>>", inbuf)
- }
- // parse one line
- var input map[string]interface{}
- err = json.Unmarshal(inbuf, &input)
- if err != nil {
- log.Println(err.Error())
- fmt.Fprintf(out, "{ error: %q}\n", err.Error())
- continue
- }
- if debug {
- log.Printf("%v\n", input)
- }
- // set environment variables
- for k, v := range input {
- if k == "value" {
- continue
- }
- if s, ok := v.(string); ok {
- os.Setenv("__OW_"+strings.ToUpper(k), s)
- }
- }
- // get payload if not empty
- isJsonObjectParam := true
- var payloadForJsonObject map[string]interface{}
- var payloadForJsonArray []interface{}
- if value, ok := input["value"].(map[string]interface{}); ok {
- payloadForJsonObject = value
- } else {
- if value, ok := input["value"].([]interface{}); ok {
- payloadForJsonArray = value
- isJsonObjectParam = false
- }
- }
- // process the request
- var result interface{}
- funcMain := reflect.ValueOf(Main)
- if isJsonObjectParam {
- param :=
[]reflect.Value{reflect.ValueOf(payloadForJsonObject)}
- reflectResult := funcMain.Call(param)
- result = reflectResult[0].Interface()
- } else {
- param :=
[]reflect.Value{reflect.ValueOf(payloadForJsonArray)}
- reflectResult := funcMain.Call(param)
- result = reflectResult[0].Interface()
- }
- // encode the answer
- output, err := json.Marshal(&result)
- if err != nil {
- log.Println(err.Error())
- fmt.Fprintf(out, "{ error: %q}\n", err.Error())
- continue
- }
- output = bytes.Replace(output, []byte("\n"), []byte(""), -1)
- if debug {
- log.Printf("<<<'%s'<<<", output)
- }
- fmt.Fprintf(out, "%s\n", output)
- }
-}
diff --git a/settings.gradle b/settings.gradle
index 4d79abd..5d8d0c6 100644
--- a/settings.gradle
+++ b/settings.gradle
@@ -18,8 +18,6 @@
include 'tests'
include 'actionloop'
-include 'golang1.17'
-include 'golang1.18'
include 'golang1.19'
include 'golang1.20'
diff --git
a/tests/src/test/scala/runtime/actionContainers/ActionLoopBasicGo17Tests.scala
b/tests/src/test/scala/runtime/actionContainers/ActionLoopBasicGo17Tests.scala
deleted file mode 100644
index aa8269a..0000000
---
a/tests/src/test/scala/runtime/actionContainers/ActionLoopBasicGo17Tests.scala
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * 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.
- */
-package runtime.actionContainers
-
-import common.WskActorSystem
-import org.junit.runner.RunWith
-import org.scalatest.junit.JUnitRunner
-
-@RunWith(classOf[JUnitRunner])
-class ActionLoopBasicGo17Tests
- extends ActionLoopBasicGoTests
- with WskActorSystem {
-
- override lazy val goCompiler = "action-golang-v1.17"
- override lazy val image = goCompiler
- override lazy val requireAck = true
-}
diff --git
a/tests/src/test/scala/runtime/actionContainers/ActionLoopBasicGo18Tests.scala
b/tests/src/test/scala/runtime/actionContainers/ActionLoopBasicGo18Tests.scala
deleted file mode 100644
index 5d6fbc0..0000000
---
a/tests/src/test/scala/runtime/actionContainers/ActionLoopBasicGo18Tests.scala
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * 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.
- */
-package runtime.actionContainers
-
-import common.WskActorSystem
-import org.junit.runner.RunWith
-import org.scalatest.junit.JUnitRunner
-
-@RunWith(classOf[JUnitRunner])
-class ActionLoopBasicGo18Tests
- extends ActionLoopBasicGoTests
- with WskActorSystem {
-
- override lazy val goCompiler = "action-golang-v1.18"
- override lazy val image = goCompiler
- override lazy val requireAck = true
-}
diff --git
a/tests/src/test/scala/runtime/actionContainers/ActionLoopGo17ContainerTests.scala
b/tests/src/test/scala/runtime/actionContainers/ActionLoopGo17ContainerTests.scala
deleted file mode 100644
index bfb7b15..0000000
---
a/tests/src/test/scala/runtime/actionContainers/ActionLoopGo17ContainerTests.scala
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * 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.
- */
-
-package runtime.actionContainers
-
-import common.WskActorSystem
-import org.junit.runner.RunWith
-import org.scalatest.junit.JUnitRunner
-@RunWith(classOf[JUnitRunner])
-class ActionLoopGo17ContainerTests
- extends ActionLoopGoContainerTests
- with WskActorSystem {
-
- override lazy val goCompiler = "action-golang-v1.17"
- override lazy val image = goCompiler
-
-}
diff --git
a/tests/src/test/scala/runtime/actionContainers/ActionLoopGo18ContainerTests.scala
b/tests/src/test/scala/runtime/actionContainers/ActionLoopGo18ContainerTests.scala
deleted file mode 100644
index b9ae1b2..0000000
---
a/tests/src/test/scala/runtime/actionContainers/ActionLoopGo18ContainerTests.scala
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * 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.
- */
-
-package runtime.actionContainers
-
-import common.WskActorSystem
-import org.junit.runner.RunWith
-import org.scalatest.junit.JUnitRunner
-@RunWith(classOf[JUnitRunner])
-class ActionLoopGo18ContainerTests
- extends ActionLoopGoContainerTests
- with WskActorSystem {
-
- override lazy val goCompiler = "action-golang-v1.18"
- override lazy val image = goCompiler
-
-}