diff --git a/Dockerfile b/Dockerfile index c1bd53ba..2610e040 100644 --- a/Dockerfile +++ b/Dockerfile @@ -25,9 +25,11 @@ ARG CGO_EXTRA_CFLAGS COPY . ${BUILD_DIR} WORKDIR ${BUILD_DIR} COPY --from=node-builder /tmp/build ${BUILD_DIR}/ui/build -RUN apk --no-cache add build-base git \ - && make clean build \ - && cp answer /usr/bin/answer +RUN apk --no-cache add build-base git bash \ + && make clean build +RUN chmod 755 answer +RUN ["/bin/bash","-c","script/build_plugin.sh"] +RUN cp answer /usr/bin/answer RUN mkdir -p /data/uploads && chmod 777 /data/uploads \ && mkdir -p /data/i18n && cp -r i18n/*.yaml /data/i18n diff --git a/Makefile b/Makefile index 1f44f3b9..ce3d42c8 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,6 @@ .PHONY: build clean ui -VERSION=1.0.7 +VERSION=1.1.0 BIN=answer DIR_SRC=./cmd/answer DOCKER_CMD=docker diff --git a/go.mod b/go.mod index 40de6032..18d03402 100644 --- a/go.mod +++ b/go.mod @@ -156,3 +156,5 @@ require ( modernc.org/token v1.0.0 // indirect sigs.k8s.io/yaml v1.3.0 // indirect ) + +replace lukechampine.com/uint128 v1.1.1 => github.com/aichy126/uint128 v1.1.1 diff --git a/plugin/sample/connector.go b/plugin/sample/connector.go deleted file mode 100644 index 55d4bfec..00000000 --- a/plugin/sample/connector.go +++ /dev/null @@ -1,20 +0,0 @@ -package sample - -import "github.com/answerdev/answer/plugin" - -type Connector struct { -} - -func init() { - plugin.Register(&Connector{}) -} - -func (c *Connector) Info() plugin.Info { - return plugin.Info{ - Name: plugin.MakeTranslator("plugin.connector.name"), - SlugName: "connector", - //Description: plugin.MakeTranslator("plugin.connector.description"), - Author: "answerdev", - Version: "0.0.1", - } -} diff --git a/plugin/sample/connector_test.go b/plugin/sample/connector_test.go deleted file mode 100644 index 43cff4ed..00000000 --- a/plugin/sample/connector_test.go +++ /dev/null @@ -1,26 +0,0 @@ -package sample - -import ( - "fmt" - "net/http" - "net/http/httptest" - "testing" - - "github.com/answerdev/answer/plugin" - "github.com/gin-gonic/gin" -) - -func TestConnector_Info(t *testing.T) { - c, _ := gin.CreateTestContext(httptest.NewRecorder()) - c.Request, _ = http.NewRequest("", "", nil) - c.Request.Header.Set("Accept-Language", "en_US") - _ = plugin.CallBase(func(base plugin.Base) error { - info := base.Info() - fmt.Println(info.Name.Translate(c)) - fmt.Println(info.SlugName) - fmt.Println(info.Description.Translate(c)) - fmt.Println(info.Author) - fmt.Println(info.Version) - return nil - }) -} diff --git a/script/build_plugin.sh b/script/build_plugin.sh new file mode 100755 index 00000000..010a477e --- /dev/null +++ b/script/build_plugin.sh @@ -0,0 +1,31 @@ +#!/bin/bash +plugin_file=./script/plugin_list +if [ ! -f "$plugin_file" ]; then + echo "plugin_list is not exist" + exit 0 +fi +num=0 +for line in `cat $plugin_file` +do + account=$line + accounts[$num]=$account + ((num++)) +done +if [ $num -eq 0 ]; then + echo "plugin_list is null" + exit 0 +fi +cmd="./answer build " +for repo in ${accounts[@]} +do +echo ${repo} +cmd=$cmd" --with "${repo} +done +$cmd +if [ ! -f "./new_answer" ]; then + echo "new_answer is not exist build failed" + exit 0 +fi +rm answer +mv new_answer answer +./answer plugin \ No newline at end of file diff --git a/script/plugin_list b/script/plugin_list new file mode 100644 index 00000000..a7cfc670 --- /dev/null +++ b/script/plugin_list @@ -0,0 +1 @@ +github.com/answerdev/plugins/connector/basic@latest \ No newline at end of file