Skip to content

convert to mods #2

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 18 commits into from
Nov 10, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ version: 2.1

default:
environment: &envvars
RPC_REPO: github.com/redsift/go-sandbox-rpc
RPC_REPO_COMMIT: e56484a
CONTAINER_NAME: quay.io/redsift/sandbox-go
CIRCLE_REVERSE_DEPENDENCIES: sandbox-go-rocksdb
executors:
Expand Down Expand Up @@ -37,7 +35,7 @@ jobs:
executor: dockexec
steps:
- v_build:
nv: "1.15.3"
nv: "1.15.4"

trigger-builds:
executor: dockexec
Expand Down
21 changes: 7 additions & 14 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
FROM quay.io/redsift/sandbox:latest
LABEL author="Christos Vontas"
LABEL email="christos@redsift.io"
LABEL version="1.0.2"
LABEL author="Anon Cohen"
LABEL email="amnon.cohen@redsift.io"
LABEL version="1.1.0"

RUN export DEBIAN_FRONTEND=noninteractive && \
apt-get update && \
Expand All @@ -10,8 +10,7 @@ RUN export DEBIAN_FRONTEND=noninteractive && \

LABEL io.redsift.sandbox.install="/usr/bin/redsift/install" io.redsift.sandbox.run="/usr/bin/redsift/run"

ARG golang_version=1.10.8
ENV GODEP_V=v0.5.0
ARG golang_version=1.15.4

RUN set -eux; \
url="https://golang.org/dl/go${golang_version}.linux-amd64.tar.gz"; \
Expand All @@ -22,25 +21,19 @@ RUN set -eux; \
go version

COPY root /
COPY go-wrapper /usr/local/bin/

ENV RPC_REPO github.com/redsift/go-sandbox-rpc

ENV GOPATH /usr/lib/redsift/workspace
ENV PATH $GOPATH/bin:/usr/local/go/bin:$PATH
ENV SANDBOX_PATH $GOPATH/src/github.com/redsift/sandbox-go
ENV GO111MODULE on

COPY cmd $SANDBOX_PATH/cmd
COPY sandbox $SANDBOX_PATH/sandbox
COPY Gopkg.* $SANDBOX_PATH/
COPY go.* $SANDBOX_PATH/

WORKDIR $SANDBOX_PATH

RUN wget -O /usr/local/bin/dep "https://github.com/golang/dep/releases/download/${GODEP_V}/dep-linux-amd64" && \
chmod +x /usr/local/bin/dep && \
ln -s /run/sandbox/sift/server $GOPATH/src/server && \
dep ensure -v && dep status && \
rm -rf vendor/$RPC_REPO && \
RUN \
go build -o /usr/bin/redsift/go_install cmd/install/install.go && \
chmod +x /usr/bin/redsift/go_install && \
chown -R sandbox:sandbox $GOPATH
Expand Down
51 changes: 0 additions & 51 deletions Gopkg.lock

This file was deleted.

7 changes: 0 additions & 7 deletions Gopkg.toml

This file was deleted.

6 changes: 0 additions & 6 deletions circle/docker_build
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,6 @@ if [ $tagName == "release" ]; then
fi
imageName=$CONTAINER_NAME:v$GV$SUFFIX

LOCAL_RPC_REPO="root/usr/lib/redsift/workspace/src/${RPC_REPO}"
git clone "git@${RPC_REPO/com\//com:}" $LOCAL_RPC_REPO
pushd $LOCAL_RPC_REPO
git checkout $RPC_REPO_COMMIT
popd

echo "Configuring FROM and ENTRYPOINT in Dockerfile with base=sandbox:${parentVersion}"
sed "s/^\(FROM quay.io\/redsift\/sandbox:\).*$/\1${parentVersion}/" < Dockerfile > Dockerfile.versioned

Expand Down
27 changes: 11 additions & 16 deletions cmd/install/install.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package main

import (
"fmt"
"log"
"os"
"os/exec"
"path"
Expand All @@ -28,23 +28,23 @@ var Computes = map[int]func(sandboxrpc.ComputeRequest) ([]sandboxrpc.ComputeResp
func main() {
info, err := sandbox.NewInit(os.Args[1:])
if err != nil {
die("%s", err.Error())
log.Fatal(err)
}

uniquePaths := map[string]int{}
nodeNames := map[int]string{}
for _, i := range info.Nodes {
node := info.Sift.Dag.Nodes[i]
if node.Implementation == nil || len(node.Implementation.Go) == 0 {
die("Requested to install a non-Go node at index %d\n", i)
log.Fatalf("Requested to install a non-Go node at index %d", i)
}

implPath := node.Implementation.Go
fmt.Printf("Installing node: %s : %s\n", node.Description, implPath)
log.Printf("Installing node: %s : %s\n", node.Description, implPath)

// absolutePath := path.Join(i.SIFT_ROOT, node.Implementation.Go)
if _, err := os.Stat(path.Join(info.SIFT_ROOT, implPath)); os.IsNotExist(err) {
die("Implementation at index %d : %s does not exist!\n", i, implPath)
log.Fatalf("Implementation at index %d : %s does not exist!", i, implPath)
}

packageName := path.Base(implPath)
Expand All @@ -63,22 +63,22 @@ func main() {

fo, err := os.Create(SIFT_GO_LOCATION)
if err != nil {
die("%s", err.Error())
log.Fatal(err)
}
defer func() {
if err := fo.Close(); err != nil {
die("%s", err.Error())
log.Fatal(err)
}
}()

t := template.New("sift.go")
t, _ = t.Parse(sift_temp)
err = t.Execute(fo, struct {
Paths []string
Paths []string
NodeNames map[int]string
}{paths, nodeNames})
if err != nil {
die("Failed to generate sift.go: %s", err.Error())
log.Fatalf("Failed to generate sift.go: %s", err.Error())
}

//
Expand All @@ -91,13 +91,8 @@ func main() {
buildArgs = append(buildArgs, "-v", "-o", "/run/sandbox/sift/server/_run", path.Join(PROJECT_LOCATION, "cmd/run/run.go"))
bcmd := exec.Command("go", buildArgs...)
bstdoutStderr, err := bcmd.CombinedOutput()
fmt.Printf("%s\n", bstdoutStderr)
log.Printf("%s\n", bstdoutStderr)
if err != nil {
die("Building sandbox failed: %s", err)
log.Fatalf("Building sandbox failed: %s", err)
}
}

func die(format string, v ...interface{}) {
fmt.Fprintln(os.Stderr, fmt.Sprintf(format, v...))
os.Exit(1)
}
6 changes: 5 additions & 1 deletion cmd/run/run_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package main
import (
"encoding/json"
"fmt"
"log"
"os"
"os/exec"
"testing"
Expand Down Expand Up @@ -40,7 +41,10 @@ func TestComputeRequest(t *testing.T) {
func TestMain(m *testing.M) {
go func() {
cmd := exec.Command("/usr/bin/redsift/run", "1")
stdoutStderr, _ := cmd.CombinedOutput()
stdoutStderr, err := cmd.CombinedOutput()
if err != nil {
log.Fatalln(err)
}
fmt.Printf("%s\n", stdoutStderr)
}()
os.Exit(m.Run())
Expand Down
97 changes: 0 additions & 97 deletions go-wrapper

This file was deleted.

10 changes: 10 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
module github.com/redsift/sandbox-go

go 1.15

require (
github.com/redsift/go-mangosock v0.2.0
github.com/redsift/go-sandbox-rpc v0.1.0
)

replace server => /run/sandbox/sift/server
33 changes: 33 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
github.com/Microsoft/go-winio v0.4.15 h1:qkLXKzb1QoVatRyd/YlXZ/Kg0m5K3SPuoD82jjSOaBc=
github.com/Microsoft/go-winio v0.4.15/go.mod h1:tTuCMEN+UleMWgg9dVx4Hu52b1bJo+59jBh3ajtinzw=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1 h1:EGx4pi6eqNxGaHF6qqu48+N2wcFQ5qg5FXgOdqsJ5d8=
github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY=
github.com/gorilla/websocket v1.4.2 h1:+/TMaTYc4QFitKJxsQ7Yye35DkWvkdLcvGKqM+x0Ufc=
github.com/gorilla/websocket v1.4.2/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE=
github.com/jtolds/gls v4.20.0+incompatible h1:xdiiI2gbIgH/gLH7ADydsJ1uDOEzR8yvV7C0MuV77Wo=
github.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU=
github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/redsift/go-mangosock v0.2.0 h1:xyKrA77Mgb8n2NuZkgOpm5YnX65cpD+uvr+AHqN6DDA=
github.com/redsift/go-mangosock v0.2.0/go.mod h1:e31gqueU2A91oRF8yla05/XK6yxoKCkUIcw7ZO+DrEo=
github.com/redsift/go-sandbox-rpc v0.1.0 h1:RAMxFMK7XE7qD8KJd6n2Pl5Mof4+9IA9UAe9eiMx8oU=
github.com/redsift/go-sandbox-rpc v0.1.0/go.mod h1:57m4ei6UvUwdB8jFxy5QWDLhIgYngPfI+dIRnoPndUI=
github.com/sirupsen/logrus v1.4.1/go.mod h1:ni0Sbl8bgC9z8RoU9G6nDWqqs/fq4eDPysMBDgk/93Q=
github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d h1:zE9ykElWQ6/NYmHa3jpm/yHnI4xSofP+UP6SpjHcSeM=
github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc=
github.com/smartystreets/goconvey v1.6.4 h1:fv0U8FUIMPNf1L9lnHLvLhgicrIVChEkdzIKYqbNC9s=
github.com/smartystreets/goconvey v1.6.4/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA=
github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190916202348-b4ddaad3f8a3 h1:7TYNF4UdlohbFwpNH04CoPMp1cHUZgO1Ebq5r2hIjfo=
golang.org/x/sys v0.0.0-20190916202348-b4ddaad3f8a3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/tools v0.0.0-20190328211700-ab21143f2384/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
nanomsg.org/go-mangos v1.4.0 h1:pVRLnzXePdSbhWlWdSncYszTagERhMG5zK/vXYmbEdM=
nanomsg.org/go-mangos v1.4.0/go.mod h1:MOor8xUIgwsRMPpLr9xQxe7bT7rciibScOqVyztNxHQ=
Loading