From 5cdf4b8cbdfdf18e98490aeea62f3ae22ae365ac Mon Sep 17 00:00:00 2001 From: Sharpz7 Date: Wed, 10 Aug 2022 17:32:49 +0000 Subject: [PATCH 1/4] Added some new tests --- go.sum | 9 --------- sharpdev.yml | 46 +++++++++++++++++++------------------------ testing/external.yml | 4 ++-- testing/external2.yml | 8 ++++++++ 4 files changed, 30 insertions(+), 37 deletions(-) create mode 100644 testing/external2.yml diff --git a/go.sum b/go.sum index 266cc6a..88a432a 100644 --- a/go.sum +++ b/go.sum @@ -8,31 +8,22 @@ github.com/hashicorp/go-version v1.5.0 h1:O293SZ2Eg+AAYijkVK3jR786Am1bhDEh2GHT0t github.com/hashicorp/go-version v1.5.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA= github.com/joho/godotenv v1.4.0 h1:3l4+N6zfMWnkbPEXKng2o2/MR5mSwTrBih4ZEkkz1lg= github.com/joho/godotenv v1.4.0/go.mod h1:f4LDr5Voq0i2e/R5DDNOoa2zzDfwtkZa6DnEwAbqwq4= -github.com/mattn/go-runewidth v0.0.2 h1:UnlwIPBGaTZfPQ6T1IGzPI0EkYAQmT9fAEJ/poFC63o= github.com/mattn/go-runewidth v0.0.2/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU= github.com/mattn/go-runewidth v0.0.9/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m2gUSrubnMI= github.com/mattn/go-runewidth v0.0.13 h1:lTGmDsbAYt5DmK6OnoV7EuIF1wEIFAcxld6ypU4OSgU= github.com/mattn/go-runewidth v0.0.13/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w= -github.com/mitchellh/go-wordwrap v0.0.0-20150314170334-ad45545899c7 h1:DpOJ2HYzCv8LZP15IdmG+YdwD2luVPHITV96TkirNBM= github.com/mitchellh/go-wordwrap v0.0.0-20150314170334-ad45545899c7/go.mod h1:ZXFpozHsX6DPmq2I0TCekCxypsnAUbP2oI0UX1GXzOo= github.com/mitchellh/go-wordwrap v1.0.1 h1:TLuKupo69TCn6TQSyGxwI1EblZZEsQ0vMlAFQflz0v0= github.com/mitchellh/go-wordwrap v1.0.1/go.mod h1:R62XHJLzvMFRBbcrT7m7WgmE1eOyTSsCt+hzestvNj0= -github.com/nsf/termbox-go v0.0.0-20190121233118-02980233997d h1:x3S6kxmy49zXVVyhcnrFqxvNVCBPb2KZ9hV2RBdS840= github.com/nsf/termbox-go v0.0.0-20190121233118-02980233997d/go.mod h1:IuKpRQcYE1Tfu+oAQqaLisqDeXgjyyltCfsaoYN18NQ= github.com/nsf/termbox-go v1.1.1 h1:nksUPLCb73Q++DwbYUBEglYBRPZyoXJdrj5L+TkjyZY= github.com/nsf/termbox-go v1.1.1/go.mod h1:T0cTdVuOwf7pHQNtfhnEbzHbcNyCEcVU4YPpouCbVxo= github.com/rivo/uniseg v0.2.0 h1:S1pD9weZBuJdFmowNwbpi7BJ8TNftyUImj/0WQi72jY= github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc= -golang.org/x/crypto v0.0.0-20220518034528-6f7dac969898 h1:SLP7Q4Di66FONjDJbCYrCRrh97focO6sLogHO7/g8F0= -golang.org/x/crypto v0.0.0-20220518034528-6f7dac969898/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= golang.org/x/crypto v0.0.0-20220525230936-793ad666bf5e h1:T8NU3HyQ8ClP4SEE+KbFlg6n0NhuTsN4MyznaarGsZM= golang.org/x/crypto v0.0.0-20220525230936-793ad666bf5e/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= -golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c h1:F1jZWGFhYfh0Ci55sIpILtKKK8p3i2/krTr0H1rg74I= -golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a h1:dGzPydgVsqGcTRVwiLJ1jVbufYwmzD3LfVPLKsKg+0k= golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/term v0.0.0-20220411215600-e5f449aeb171 h1:EH1Deb8WZJ0xc0WK//leUHXcX9aLE5SymusoTmMZye8= -golang.org/x/term v0.0.0-20220411215600-e5f449aeb171/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/term v0.0.0-20220526004731-065cf7ba2467 h1:CBpWXWQpIRjzmkkA+M7q9Fqnwd2mZr3AFqexg8YTfoM= golang.org/x/term v0.0.0-20220526004731-065cf7ba2467/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= diff --git a/sharpdev.yml b/sharpdev.yml index e603a5b..d659033 100644 --- a/sharpdev.yml +++ b/sharpdev.yml @@ -4,28 +4,22 @@ envfile: .env values: SECRETD: '{\"secret\":\"$PASSD\"}' SECRET: '{\"secret\":\"$PASS\"}' + sharpcd_internal: ./internal/sharpcd -scripts: - build: | - go build -o ./internal/sharpcd ./src - - sharpcd: | - sharpdev build - ./internal/sharpcd $_ARG1 $_ARG2 $_ARG3 $_ARG4 $_ARG5 $_ARG6 $_ARG7 - - sharedserver: | - sharpdev kill - sharpdev build +setup: | + go mod tidy + go build -o ./internal/sharpcd ./src +scripts: server: | - sharpdev sharedserver - sudo ./internal/sharpcd server > /dev/null 2>&1 & + sharpdev kill + sudo sharpcd_internal server > /dev/null 2>&1 & serveropen: | - sharpdev sharedserver - sudo ./internal/sharpcd server + sharpdev kill + sudo sharpcd_internal server - test: | + default: | sharpdev server sharpdev client sharpdev client_test_different_url @@ -34,30 +28,30 @@ scripts: kill: | sudo apt-get install -y lsof - sudo lsof -ti :5666 | sudo xargs --no-run-if-empty kill -9 shared: | sudo docker-compose -f "./internal/sharpcd-data/docker/external_task/docker-compose.yml" down $(sudo docker volume rm memes) > /dev/null 2>&1 || true $(sudo docker network rm memes) > /dev/null 2>&1 || true - sharpdev build client: | sharpdev shared - ./internal/sharpcd --secret $PASSD + sharpcd_internal --secret $PASSD + + clientonly: + sharpcd_internal --secret $PASSD client_test_different_url: | sharpdev shared - sharpdev sharpcd --secret $PASSD --remotefile https://raw.githubusercontent.com/Sharpz7/sharpcd/dev/testing/configs/different_url/sharpcd.yml + sharpcd_internal --secret $PASSD --remotefile https://raw.githubusercontent.com/Sharpz7/sharpcd/dev/testing/configs/different_url/sharpcd.yml client_test_password: | sharpdev shared - sharpdev sharpcd --remotefile https://raw.githubusercontent.com/Sharpz7/sharpcd/dev/testing/configs/passwords/sharpcd.yml + sharpcd_internal --remotefile https://raw.githubusercontent.com/Sharpz7/sharpcd/dev/testing/configs/passwords/sharpcd.yml trak: | - sharpdev build - ./internal/sharpcd --secret $PASSD trak $_ARG1 $_ARG2 $_ARG3 + sharpcd_internal --secret $PASSD trak $_ARG1 $_ARG2 $_ARG3 trakone: | sharpdev trak job local $_ARG1 @@ -71,9 +65,9 @@ scripts: traklogs: | sharpdev trak logs local $_ARG1 - filter: ./internal/sharpcd addfilter https://raw.githubusercontent.com/Sharpz7/ - remove: ./internal/sharpcd removefilter https://raw.githubusercontent.com/Sharpz7/ - token: ./internal/sharpcd changetoken $_ARG1 + filter: sharpcd_internal addfilter https://raw.githubusercontent.com/Sharpz7/ + remove: sharpcd_internal removefilter https://raw.githubusercontent.com/Sharpz7/ + token: sharpcd_internal changetoken $_ARG1 alljobsd: curl -k -X POST -d SECRETD https://localhost:5666/api/jobs alljobs: curl -k -X POST -d SECRET https://173.312.252.82:5666/api/jobs diff --git a/testing/external.yml b/testing/external.yml index 14c92ee..735c587 100644 --- a/testing/external.yml +++ b/testing/external.yml @@ -5,7 +5,7 @@ services: command: tail -f /dev/null volumes: - - "memes:/test" + - "externalv:/test" networks: default: @@ -13,5 +13,5 @@ networks: name: external1 volumes: - external1: + externalv: external: True diff --git a/testing/external2.yml b/testing/external2.yml new file mode 100644 index 0000000..a7ef8ab --- /dev/null +++ b/testing/external2.yml @@ -0,0 +1,8 @@ +version: '3' +services: + hello_world: + image: ubuntu + command: tail -f /dev/null + + volumes: + - "/tmp/doesnotexist:/test" \ No newline at end of file From 17b06e51d1484ce15dc25a10a067cb08dc1116d9 Mon Sep 17 00:00:00 2001 From: Sharpz7 Date: Wed, 10 Aug 2022 17:43:18 +0000 Subject: [PATCH 2/4] Changes from Sharpz7 to SharpSet --- installs/install.sh | 4 ++-- sharpdev.yml | 21 ++++++++++++--------- testing/configs/different_url/sharpcd.yml | 2 +- testing/configs/passwords/sharpcd.yml | 4 ++-- 4 files changed, 17 insertions(+), 14 deletions(-) diff --git a/installs/install.sh b/installs/install.sh index 65327c3..dc785d5 100644 --- a/installs/install.sh +++ b/installs/install.sh @@ -3,7 +3,7 @@ if [[ $1 == "client" ]]; then # Download and unpack - wget https://github.com/Sharpz7/sharpcd/releases/download/XXXXX/linux.tar.gz + wget https://github.com/SharpSet/sharpcd/releases/download/XXXXX/linux.tar.gz sudo mkdir -p /tmp/sharpcd sudo tar -C /tmp/sharpcd -zxvf linux.tar.gz sudo cp /tmp/sharpcd/sharpcd /usr/local/bin/sharpcd @@ -49,7 +49,7 @@ sudo rm /etc/systemd/system/sharpcd.service sudo systemctl daemon-reload # Download and unpack -wget https://github.com/Sharpz7/sharpcd/releases/download/XXXXX/linux.tar.gz +wget https://github.com/SharpSet/sharpcd/releases/download/XXXXX/linux.tar.gz sudo mkdir -p /tmp/sharpcd sudo tar -C /tmp/sharpcd -zxvf linux.tar.gz sudo cp -n -R /tmp/sharpcd/* /usr/local/bin/ diff --git a/sharpdev.yml b/sharpdev.yml index df6b98f..efd23ee 100644 --- a/sharpdev.yml +++ b/sharpdev.yml @@ -44,29 +44,32 @@ scripts: client_test_different_url: | sharpdev shared - sharpcd_internal --secret $PASSD --remotefile https://raw.githubusercontent.com/Sharpz7/sharpcd/dev/testing/configs/different_url/sharpcd.yml + sharpcd_internal --secret $PASSD --remotefile https://raw.githubusercontent.com/SharpSet/sharpcd/dev/testing/configs/different_url/sharpcd.yml client_test_password: | sharpdev shared - sharpcd_internal --remotefile https://raw.githubusercontent.com/Sharpz7/sharpcd/dev/testing/configs/passwords/sharpcd.yml + sharpcd_internal --remotefile https://raw.githubusercontent.com/SharpSet/sharpcd/dev/testing/configs/passwords/sharpcd.yml - trak: | + trak2: | + sharpcd_internal --secret $PASSD trak $_ARG1 $_ARG2 + + trak3: | sharpcd_internal --secret $PASSD trak $_ARG1 $_ARG2 $_ARG3 trakone: | - sharpdev trak job local $_ARG1 + sharpdev trak3 job local $_ARG1 trakall: | - sharpdev trak alljobs local + sharpdev trak2 alljobs local traklist: | - sharpdev trak list local + sharpdev trak2 list local traklogs: | - sharpdev trak logs local $_ARG1 + sharpdev trak3 logs local $_ARG1 - filter: sharpcd_internal addfilter https://raw.githubusercontent.com/Sharpz7/ - remove: sharpcd_internal removefilter https://raw.githubusercontent.com/Sharpz7/ + filter: sharpcd_internal addfilter https://raw.githubusercontent.com/SharpSet/ + remove: sharpcd_internal removefilter https://raw.githubusercontent.com/SharpSet/ token: sharpcd_internal changetoken $_ARG1 alljobsd: curl -k -X POST -d SECRETD https://localhost:5666/api/jobs diff --git a/testing/configs/different_url/sharpcd.yml b/testing/configs/different_url/sharpcd.yml index 88125ea..943a6cf 100644 --- a/testing/configs/different_url/sharpcd.yml +++ b/testing/configs/different_url/sharpcd.yml @@ -8,5 +8,5 @@ tasks: basic_task: name: Basic type: docker - giturl: https://raw.githubusercontent.com/Sharpz7/ + giturl: https://raw.githubusercontent.com/SharpSet/ compose: /sharpcd/dev/testing/basic.yml diff --git a/testing/configs/passwords/sharpcd.yml b/testing/configs/passwords/sharpcd.yml index ca39b20..9aac79c 100644 --- a/testing/configs/passwords/sharpcd.yml +++ b/testing/configs/passwords/sharpcd.yml @@ -9,7 +9,7 @@ tasks: name: Basic type: docker sharpurl: https://localhost:5666 - giturl: https://raw.githubusercontent.com/Sharpz7/ + giturl: https://raw.githubusercontent.com/SharpSet/ compose: /sharpcd/dev/testing/basic.yml env_task: @@ -17,5 +17,5 @@ tasks: type: docker envfile: ./testing/.env sharpurl: https://localhost:5666 - giturl: https://raw.githubusercontent.com/Sharpz7/ + giturl: https://raw.githubusercontent.com/SharpSet/ compose: /sharpcd/dev/testing/env.yml From aa6aa2bf8c3a59fa67f23e7ebb7c346cb4dc17bc Mon Sep 17 00:00:00 2001 From: Sharpz7 Date: Wed, 10 Aug 2022 17:51:38 +0000 Subject: [PATCH 3/4] Changes --- sharpcd.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/sharpcd.yml b/sharpcd.yml index 65ad148..c572aea 100644 --- a/sharpcd.yml +++ b/sharpcd.yml @@ -36,14 +36,13 @@ tasks: giturl: https://raw.githubusercontent.com/SharpSet/ compose: /sharpcd/dev/testing/external.yml - external_task: + external2_task: name: External Host Volume type: docker sharpurl: https://localhost:5666 giturl: https://raw.githubusercontent.com/SharpSet/ compose: /sharpcd/dev/testing/external2.yml - env_task2: name: Enviroment Test Pass type: docker From e0ac8ab513cde135f2faf86350336b4410aed41f Mon Sep 17 00:00:00 2001 From: Sharpz7 Date: Sun, 21 Aug 2022 19:13:51 +0000 Subject: [PATCH 4/4] Ready to push v3.8 --- .version | 2 +- README.md | 4 ++-- sharpdev.yml | 13 +++++-------- src/structs.go | 2 +- src/versions.go | 2 +- 5 files changed, 10 insertions(+), 13 deletions(-) diff --git a/.version b/.version index bb2ba4a..a89d065 100644 --- a/.version +++ b/.version @@ -1 +1 @@ -VERSION=3.7 \ No newline at end of file +VERSION=3.8 \ No newline at end of file diff --git a/README.md b/README.md index a75c0e5..5d16f64 100644 --- a/README.md +++ b/README.md @@ -50,12 +50,12 @@ tasks: # Installation On linux, just run: ```console -sudo curl -s -L https://github.com/SharpSet/sharpcd/releases/download/3.7/install.sh | sudo bash +sudo curl -s -L https://github.com/SharpSet/sharpcd/releases/download/3.8/install.sh | sudo bash ``` Or for just the client: ```console -sudo curl -s -L https://github.com/SharpSet/sharpcd/releases/download/3.7/install.sh | sudo bash -s client +sudo curl -s -L https://github.com/SharpSet/sharpcd/releases/download/3.8/install.sh | sudo bash -s client ``` ## Command Options diff --git a/sharpdev.yml b/sharpdev.yml index efd23ee..9129773 100644 --- a/sharpdev.yml +++ b/sharpdev.yml @@ -21,9 +21,9 @@ scripts: default: | sharpdev server + sharpdev client_test_different_url_and_password sharpdev client - sharpdev client_test_different_url - sharpdev client_test_password + sharpdev client_test_password_fail sharpdev kill kill: | @@ -36,19 +36,16 @@ scripts: $(sudo docker network rm externalv) > /dev/null 2>&1 || true client: | - sharpdev shared sharpcd_internal --secret $PASSD clientonly: sharpcd_internal --secret $PASSD - client_test_different_url: | - sharpdev shared + client_test_different_url_and_password: | sharpcd_internal --secret $PASSD --remotefile https://raw.githubusercontent.com/SharpSet/sharpcd/dev/testing/configs/different_url/sharpcd.yml - client_test_password: | - sharpdev shared - sharpcd_internal --remotefile https://raw.githubusercontent.com/SharpSet/sharpcd/dev/testing/configs/passwords/sharpcd.yml + client_test_password_fail: | + sharpcd_internal --secret "Wrong" --remotefile https://raw.githubusercontent.com/SharpSet/sharpcd/dev/testing/configs/passwords/sharpcd.yml trak2: | sharpcd_internal --secret $PASSD trak $_ARG1 $_ARG2 diff --git a/src/structs.go b/src/structs.go index 1e4cbd0..b056e1e 100644 --- a/src/structs.go +++ b/src/structs.go @@ -4,7 +4,7 @@ import ( "github.com/gorilla/websocket" ) -var sharpCDVersion = "3.7" +var sharpCDVersion = "3.8" type statusCodes struct { NotPostMethod int diff --git a/src/versions.go b/src/versions.go index b0c9a0a..61d981a 100644 --- a/src/versions.go +++ b/src/versions.go @@ -14,7 +14,7 @@ type ScriptVersion struct { var scriptVersions = []ScriptVersion{ { Version: 1.1, - WorksOn: "V3.7 and up", + WorksOn: "V3.8 and up", }, { Version: 1.0,