From d9ce7737cc40363a2d3de4ce7e7fd148d94e62d2 Mon Sep 17 00:00:00 2001 From: Sarah Jamie Lewis Date: Tue, 2 Jan 2024 12:24:33 -0800 Subject: [PATCH 01/17] Fix Contact Retry Failure to Restart When toggling between connected and disconnected, the Contact Retry plugin could find itself in a state where the new event would never get requeued. Also: Make the unsigned nature of limit in GetMessage* Apis explicit. --- app/plugins/contactRetry.go | 11 +++++------ peer/cwtch_peer.go | 4 ++-- peer/cwtchprofilestorage.go | 2 +- peer/profile_interface.go | 4 ++-- 4 files changed, 10 insertions(+), 11 deletions(-) diff --git a/app/plugins/contactRetry.go b/app/plugins/contactRetry.go index 1cb0cab..8853c1c 100644 --- a/app/plugins/contactRetry.go +++ b/app/plugins/contactRetry.go @@ -302,8 +302,7 @@ func (cr *contactRetry) run() { cr.authorizedPeers.Store(id, true) if c, ok := cr.connections.Load(id); ok { contact := c.(*contact) - if contact.state == connections.DISCONNECTED && !contact.queued { - + if contact.state == connections.DISCONNECTED { // prioritize connections made in the last week if time.Since(contact.lastSeen).Hours() < PriorityQueueTimeSinceQualifierHours { cr.priorityQueue.insert(contact) @@ -461,10 +460,10 @@ func (cr *contactRetry) addConnection(id string, state connections.ConnectionSta cr.connections.Store(id, p) return } else { - // we have rerequested this connnection. Force set the queued parameter to true. - p, _ := cr.connections.Load(id) - if !p.(*contact).queued { - p.(*contact).queued = true + // we have rerequested this connnection, probably via an explicit ask, update it's state + if c, ok := cr.connections.Load(id); ok { + contact := c.(*contact) + contact.state = state } } } diff --git a/peer/cwtch_peer.go b/peer/cwtch_peer.go index 3ecc838..7b9aa1d 100644 --- a/peer/cwtch_peer.go +++ b/peer/cwtch_peer.go @@ -94,7 +94,7 @@ func (cp *cwtchPeer) EnhancedImportBundle(importString string) string { return cp.ImportBundle(importString).Error() } -func (cp *cwtchPeer) EnhancedGetMessages(conversation int, index int, count int) string { +func (cp *cwtchPeer) EnhancedGetMessages(conversation int, index int, count uint) string { var emessages = make([]EnhancedMessage, count) messages, err := cp.GetMostRecentMessages(conversation, 0, index, count) @@ -888,7 +888,7 @@ func (cp *cwtchPeer) GetChannelMessageCount(conversation int, channel int) (int, } // GetMostRecentMessages returns a selection of messages, ordered by most recently inserted -func (cp *cwtchPeer) GetMostRecentMessages(conversation int, channel int, offset int, limit int) ([]model.ConversationMessage, error) { +func (cp *cwtchPeer) GetMostRecentMessages(conversation int, channel int, offset int, limit uint) ([]model.ConversationMessage, error) { return cp.storage.GetMostRecentMessages(conversation, channel, offset, limit) } diff --git a/peer/cwtchprofilestorage.go b/peer/cwtchprofilestorage.go index 74496c8..37330e9 100644 --- a/peer/cwtchprofilestorage.go +++ b/peer/cwtchprofilestorage.go @@ -781,7 +781,7 @@ func (cps *CwtchProfileStorage) SearchMessages(conversation int, channel int, pa } // GetMostRecentMessages returns the most recent messages in a channel up to a given limit at a given offset -func (cps *CwtchProfileStorage) GetMostRecentMessages(conversation int, channel int, offset int, limit int) ([]model.ConversationMessage, error) { +func (cps *CwtchProfileStorage) GetMostRecentMessages(conversation int, channel int, offset int, limit uint) ([]model.ConversationMessage, error) { channelID := ChannelID{Conversation: conversation, Channel: channel} cps.mutex.Lock() diff --git a/peer/profile_interface.go b/peer/profile_interface.go index 9d70504..08591b7 100644 --- a/peer/profile_interface.go +++ b/peer/profile_interface.go @@ -131,7 +131,7 @@ type CwtchPeer interface { GetChannelMessage(conversation int, channel int, id int) (string, model.Attributes, error) GetChannelMessageCount(conversation int, channel int) (int, error) GetChannelMessageByContentHash(conversation int, channel int, contenthash string) (int, error) - GetMostRecentMessages(conversation int, channel int, offset int, limit int) ([]model.ConversationMessage, error) + GetMostRecentMessages(conversation int, channel int, offset int, limit uint) ([]model.ConversationMessage, error) UpdateMessageAttribute(conversation int, channel int, id int, key string, value string) error SearchConversations(pattern string) string @@ -142,7 +142,7 @@ type CwtchPeer interface { EnhancedGetMessageByContentHash(conversation int, hash string) string // EnhancedGetMessages returns a set of json-encoded enhanced messages, suitable for rendering in a UI - EnhancedGetMessages(conversation int, index int, count int) string + EnhancedGetMessages(conversation int, index int, count uint) string // Server Token APIS // TODO move these to feature protected interfaces -- 2.25.1 From 347ac3cf48da4964fa252dfa09c4029c2695c6a3 Mon Sep 17 00:00:00 2001 From: Sarah Jamie Lewis Date: Tue, 2 Jan 2024 12:33:31 -0800 Subject: [PATCH 02/17] Fixup Formatting and Quality Script ineffassign and misspell are no longer compatible with previous go workflows and the latest versions do not work. Commenting for now with intent to replace with better tooling. --- app/plugins/contactRetry.go | 4 ++-- go.mod | 1 + go.sum | 2 ++ testing/quality.sh | 8 ++++---- 4 files changed, 9 insertions(+), 6 deletions(-) diff --git a/app/plugins/contactRetry.go b/app/plugins/contactRetry.go index 8853c1c..74a3ef9 100644 --- a/app/plugins/contactRetry.go +++ b/app/plugins/contactRetry.go @@ -462,8 +462,8 @@ func (cr *contactRetry) addConnection(id string, state connections.ConnectionSta } else { // we have rerequested this connnection, probably via an explicit ask, update it's state if c, ok := cr.connections.Load(id); ok { - contact := c.(*contact) - contact.state = state + contact := c.(*contact) + contact.state = state } } } diff --git a/go.mod b/go.mod index afcb490..7c7f8f3 100644 --- a/go.mod +++ b/go.mod @@ -16,6 +16,7 @@ require ( require ( filippo.io/edwards25519 v1.0.0 // indirect git.openprivacy.ca/openprivacy/bine v0.0.5 // indirect + github.com/client9/misspell v0.3.4 // indirect github.com/google/go-cmp v0.5.8 // indirect github.com/gtank/merlin v0.1.1 // indirect github.com/mimoo/StrobeGo v0.0.0-20220103164710-9a04d6ca976b // indirect diff --git a/go.sum b/go.sum index a033e11..2893bb5 100644 --- a/go.sum +++ b/go.sum @@ -8,6 +8,8 @@ git.openprivacy.ca/openprivacy/connectivity v1.11.0 h1:roASjaFtQLu+HdH5fa2wx6F00 git.openprivacy.ca/openprivacy/connectivity v1.11.0/go.mod h1:OQO1+7OIz/jLxDrorEMzvZA6SEbpbDyLGpjoFqT3z1Y= git.openprivacy.ca/openprivacy/log v1.0.3 h1:E/PMm4LY+Q9s3aDpfySfEDq/vYQontlvNj/scrPaga0= git.openprivacy.ca/openprivacy/log v1.0.3/go.mod h1:gGYK8xHtndRLDymFtmjkG26GaMQNgyhioNS82m812Iw= +github.com/client9/misspell v0.3.4 h1:ta993UF76GwbvJcIo3Y68y/M3WxlpEHPWIGDkJYwzJI= +github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= diff --git a/testing/quality.sh b/testing/quality.sh index 0827cb5..0961079 100755 --- a/testing/quality.sh +++ b/testing/quality.sh @@ -19,9 +19,9 @@ echo "Time to format" gofmt -l -s -w . # ineffassign (https://github.com/gordonklaus/ineffassign) -echo "Checking for ineffectual assignment of errors (unchecked errors...)" -ineffassign ./.. +# echo "Checking for ineffectual assignment of errors (unchecked errors...)" +# ineffassign . # misspell (https://github.com/client9/misspell/cmd/misspell) -echo "Checking for misspelled words..." -misspell . | grep -v "testing/" | grep -v "vendor/" | grep -v "go.sum" | grep -v ".idea" +# echo "Checking for misspelled words..." +# misspell . | grep -v "testing/" | grep -v "vendor/" | grep -v "go.sum" | grep -v ".idea" -- 2.25.1 From daea5128c00798903aca7c574edbebe916ed6b4a Mon Sep 17 00:00:00 2001 From: Sarah Jamie Lewis Date: Tue, 2 Jan 2024 12:45:39 -0800 Subject: [PATCH 03/17] Fixup Connection Test to check reconnecting status --- app/plugins/contactRetry_test.go | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/app/plugins/contactRetry_test.go b/app/plugins/contactRetry_test.go index 946ced8..0ebbd72 100644 --- a/app/plugins/contactRetry_test.go +++ b/app/plugins/contactRetry_test.go @@ -64,18 +64,9 @@ func TestContactRetryQueue(t *testing.T) { // If we didn't do this we would have to wait 30 seconds for a check-in bus.Publish(event.NewEvent(event.PeerStateChange, map[event.Field]string{event.RemotePeer: "test2", event.ConnectionState: "Disconnected"})) time.Sleep(time.Second) - if pinf.(*contact).queued != false { - t.Fatalf("test connection should not be queued, actually: %v", pinf.(*contact).queued) - } - - // Publish a new peer request... - bus.Publish(event.NewEvent(event.QueuePeerRequest, map[event.Field]string{event.RemotePeer: testOnion})) - time.Sleep(time.Second) // yield for a second so the event can catch up... - - // Peer test should be forced to queue.... pinf, _ = cr.connections.Load(testOnion) - if pinf.(*contact).queued != true { - t.Fatalf("test connection should be forced to queue after new queue peer request") + if pinf.(*contact).state != 1 { + t.Fatalf("test connection should be in connecting after update, actually: %v", pinf.(*contact).state) } cr.Shutdown() -- 2.25.1 From 6034b8f167fc19b4d11b24bfd03b24730abdee2a Mon Sep 17 00:00:00 2001 From: Sarah Jamie Lewis Date: Tue, 2 Jan 2024 12:51:03 -0800 Subject: [PATCH 04/17] Ensure contactRetry Test is Requing (rebase fix) --- app/plugins/contactRetry_test.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/plugins/contactRetry_test.go b/app/plugins/contactRetry_test.go index 0ebbd72..407f08a 100644 --- a/app/plugins/contactRetry_test.go +++ b/app/plugins/contactRetry_test.go @@ -63,6 +63,8 @@ func TestContactRetryQueue(t *testing.T) { // Publish an unrelated event to trigger the Plugin to go through a queuing cycle // If we didn't do this we would have to wait 30 seconds for a check-in bus.Publish(event.NewEvent(event.PeerStateChange, map[event.Field]string{event.RemotePeer: "test2", event.ConnectionState: "Disconnected"})) + bus.Publish(event.NewEvent(event.QueuePeerRequest, map[event.Field]string{event.RemotePeer: testOnion, event.LastSeen: time.Now().Format(time.RFC3339Nano)})) + time.Sleep(time.Second) pinf, _ = cr.connections.Load(testOnion) if pinf.(*contact).state != 1 { -- 2.25.1 From dacb67a563679b1e9d112afc60c7aeba3d4e77c9 Mon Sep 17 00:00:00 2001 From: Sarah Jamie Lewis Date: Tue, 2 Jan 2024 12:54:44 -0800 Subject: [PATCH 05/17] Fixup the initial startup of contactRetry_test.go --- app/plugins/contactRetry_test.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/app/plugins/contactRetry_test.go b/app/plugins/contactRetry_test.go index 407f08a..ab79c13 100644 --- a/app/plugins/contactRetry_test.go +++ b/app/plugins/contactRetry_test.go @@ -46,9 +46,11 @@ func TestContactRetryQueue(t *testing.T) { } } + // We should very quickly become connecting... + time.Sleep(time.Second) pinf, _ := cr.connections.Load(testOnion) - if pinf.(*contact).queued == false { - t.Fatalf("test connection should be queued, actually: %v", pinf.(*contact).queued) + if pinf.(*contact).state != 1 { + t.Fatalf("test connection should be in connecting after update, actually: %v", pinf.(*contact).state) } // Asset that "test" is authenticated -- 2.25.1 From 392d709020a8751767f3a9c1cd01839c557f2f09 Mon Sep 17 00:00:00 2001 From: Sarah Jamie Lewis Date: Tue, 2 Jan 2024 13:08:59 -0800 Subject: [PATCH 06/17] Drone Update --- .drone.yml | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/.drone.yml b/.drone.yml index 75f1322..2cbf468 100644 --- a/.drone.yml +++ b/.drone.yml @@ -5,7 +5,7 @@ name: linux-test steps: - name: fetch - image: golang:1.19.1 + image: golang:1.21.5 volumes: - name: deps path: /go @@ -14,47 +14,45 @@ steps: - wget https://git.openprivacy.ca/openprivacy/buildfiles/raw/master/tor/tor - wget https://git.openprivacy.ca/openprivacy/buildfiles/raw/master/tor/torrc - chmod a+x tor - - go get -u golang.org/x/lint/golint - export GO111MODULE=on - - go mod vendor - name: quality - image: golang:1.19.1 + image: golang:1.21.5 volumes: - name: deps path: /go commands: - staticcheck ./... - name: units-tests - image: golang:1.19.1 + image: golang:1.21.5 volumes: - name: deps path: /go commands: - - export PATH=`pwd`:$PATH + - export PATH=$PWD:$PATH - sh testing/tests.sh - name: integ-test - image: golang:1.19.1 + image: golang:1.21.5 volumes: - name: deps path: /go commands: - - export PATH=`pwd`:$PATH + - export PATH=$PWD:$PATH - go test -timeout=30m -race -v cwtch.im/cwtch/testing/ - name: filesharing-integ-test - image: golang:1.19.1 + image: golang:1.21.5 volumes: - name: deps path: /go commands: - - export PATH=`pwd`:$PATH + - export PATH=$PWD:$PATH - go test -timeout=20m -race -v cwtch.im/cwtch/testing/filesharing - name: filesharing-autodownload-integ-test - image: golang:1.19.1 + image: golang:1.21.5 volumes: - name: deps path: /go commands: - - export PATH=`pwd`:$PATH + - export PATH=$PWD:$PATH - go test -timeout=20m -race -v cwtch.im/cwtch/testing/autodownload - name: notify-gogs image: openpriv/drone-gogs -- 2.25.1 From 3d7ccf4be2adb12242b1a720553f3adfcd461817 Mon Sep 17 00:00:00 2001 From: Sarah Jamie Lewis Date: Tue, 2 Jan 2024 13:14:06 -0800 Subject: [PATCH 07/17] Improve quality.sh --- testing/quality.sh | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/testing/quality.sh b/testing/quality.sh index 0961079..e8f071a 100755 --- a/testing/quality.sh +++ b/testing/quality.sh @@ -4,16 +4,17 @@ echo "Checking code quality (you want to see no output here)" echo "" echo "" -echo "Linting:" +echo "Running staticcheck..." staticcheck ./... -# In the future we should enable this by default. However, there are a few false positives that make this +# In the future we should remove include-pkgs. However, there are a few false positives in the overall go stdlib that make this # too noisy right now, specifically assigning nil to initialize slices (safe), and using go internal context channels assigned # nil (also safe). # We also have one file infinite_channel.go written in a way that static analysis cannot reason about easily. So it is explictly # ignored. -# nilaway -exclude-file-docstrings="nolint:nilaway" ./... +echo "Running nilaway..." +nilaway -include-pkgs="cwtch.im/cwtch,cwtch.im/tapir,git.openprivacy.ca/openprivacy/connectivity" -exclude-file-docstrings="nolint:nilaway" ./... echo "Time to format" gofmt -l -s -w . -- 2.25.1 From e624e8880641afec24bfdf7285da024ece8af4b7 Mon Sep 17 00:00:00 2001 From: Sarah Jamie Lewis Date: Tue, 2 Jan 2024 13:15:33 -0800 Subject: [PATCH 08/17] .drone.yml install nilaway --- .drone.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.drone.yml b/.drone.yml index 2cbf468..f47f77f 100644 --- a/.drone.yml +++ b/.drone.yml @@ -11,6 +11,7 @@ steps: path: /go commands: - go install honnef.co/go/tools/cmd/staticcheck@latest + - go install go.uber.org/nilaway/cmd/nilaway@latest - wget https://git.openprivacy.ca/openprivacy/buildfiles/raw/master/tor/tor - wget https://git.openprivacy.ca/openprivacy/buildfiles/raw/master/tor/torrc - chmod a+x tor -- 2.25.1 From bd4ae8beeededa7ab5111ece9cfe88ecc3db283c Mon Sep 17 00:00:00 2001 From: Sarah Jamie Lewis Date: Tue, 2 Jan 2024 13:17:47 -0800 Subject: [PATCH 09/17] Run quality.sh in the quality step --- .drone.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.drone.yml b/.drone.yml index f47f77f..5bc8c41 100644 --- a/.drone.yml +++ b/.drone.yml @@ -22,7 +22,7 @@ steps: - name: deps path: /go commands: - - staticcheck ./... + - ./testing/quality.sh - name: units-tests image: golang:1.21.5 volumes: -- 2.25.1 From a4a8501d3d37a18839bf7e5fdcfeb7ebaf220f8c Mon Sep 17 00:00:00 2001 From: Sarah Jamie Lewis Date: Tue, 2 Jan 2024 13:38:24 -0800 Subject: [PATCH 10/17] Check Tor Version --- .drone.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.drone.yml b/.drone.yml index 5bc8c41..a4e2845 100644 --- a/.drone.yml +++ b/.drone.yml @@ -15,6 +15,7 @@ steps: - wget https://git.openprivacy.ca/openprivacy/buildfiles/raw/master/tor/tor - wget https://git.openprivacy.ca/openprivacy/buildfiles/raw/master/tor/torrc - chmod a+x tor + - ./tor --version - export GO111MODULE=on - name: quality image: golang:1.21.5 -- 2.25.1 From 29c739d2cc46ff1fd2aa9ee326202ba2a2e967ca Mon Sep 17 00:00:00 2001 From: Sarah Jamie Lewis Date: Tue, 2 Jan 2024 13:40:26 -0800 Subject: [PATCH 11/17] Install libEvent in drone script --- .drone.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.drone.yml b/.drone.yml index a4e2845..4fb4a39 100644 --- a/.drone.yml +++ b/.drone.yml @@ -12,6 +12,7 @@ steps: commands: - go install honnef.co/go/tools/cmd/staticcheck@latest - go install go.uber.org/nilaway/cmd/nilaway@latest + - apt install libevent-2.1-7 - wget https://git.openprivacy.ca/openprivacy/buildfiles/raw/master/tor/tor - wget https://git.openprivacy.ca/openprivacy/buildfiles/raw/master/tor/torrc - chmod a+x tor -- 2.25.1 From fc8414a8a9a1c764547ea38548d0f97740c8174c Mon Sep 17 00:00:00 2001 From: Sarah Jamie Lewis Date: Tue, 2 Jan 2024 13:45:06 -0800 Subject: [PATCH 12/17] libEvent ubuntu package --- .drone.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.drone.yml b/.drone.yml index 4fb4a39..a431348 100644 --- a/.drone.yml +++ b/.drone.yml @@ -12,7 +12,8 @@ steps: commands: - go install honnef.co/go/tools/cmd/staticcheck@latest - go install go.uber.org/nilaway/cmd/nilaway@latest - - apt install libevent-2.1-7 + - apt search libevent + - apt install libevent-2 - wget https://git.openprivacy.ca/openprivacy/buildfiles/raw/master/tor/tor - wget https://git.openprivacy.ca/openprivacy/buildfiles/raw/master/tor/torrc - chmod a+x tor -- 2.25.1 From 2baf52a81cead45b0add26232299f77a6278994a Mon Sep 17 00:00:00 2001 From: Sarah Jamie Lewis Date: Tue, 2 Jan 2024 13:51:53 -0800 Subject: [PATCH 13/17] Use a decent operating system --- .drone.yml | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/.drone.yml b/.drone.yml index a431348..4fce97c 100644 --- a/.drone.yml +++ b/.drone.yml @@ -5,29 +5,29 @@ name: linux-test steps: - name: fetch - image: golang:1.21.5 + image: golang:1.21.5-bookworm volumes: - name: deps path: /go commands: - go install honnef.co/go/tools/cmd/staticcheck@latest - go install go.uber.org/nilaway/cmd/nilaway@latest - - apt search libevent - - apt install libevent-2 + - apt update + - apt install libevent-2.1-7 - wget https://git.openprivacy.ca/openprivacy/buildfiles/raw/master/tor/tor - wget https://git.openprivacy.ca/openprivacy/buildfiles/raw/master/tor/torrc - chmod a+x tor - ./tor --version - export GO111MODULE=on - name: quality - image: golang:1.21.5 + image: golang:1.21.5-bookworm volumes: - name: deps path: /go commands: - ./testing/quality.sh - name: units-tests - image: golang:1.21.5 + image: golang:1.21.5-bookworm volumes: - name: deps path: /go @@ -35,7 +35,7 @@ steps: - export PATH=$PWD:$PATH - sh testing/tests.sh - name: integ-test - image: golang:1.21.5 + image: golang:1.21.5-bookworm volumes: - name: deps path: /go @@ -43,7 +43,7 @@ steps: - export PATH=$PWD:$PATH - go test -timeout=30m -race -v cwtch.im/cwtch/testing/ - name: filesharing-integ-test - image: golang:1.21.5 + image: golang:1.21.5-bookworm volumes: - name: deps path: /go @@ -51,7 +51,7 @@ steps: - export PATH=$PWD:$PATH - go test -timeout=20m -race -v cwtch.im/cwtch/testing/filesharing - name: filesharing-autodownload-integ-test - image: golang:1.21.5 + image: golang:1.21.5-bookworm volumes: - name: deps path: /go -- 2.25.1 From 4d81bf9d1b959f67247ed9cf1c23fc4a45375c02 Mon Sep 17 00:00:00 2001 From: Sarah Jamie Lewis Date: Tue, 2 Jan 2024 13:59:20 -0800 Subject: [PATCH 14/17] Tor Path --- .drone.yml | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/.drone.yml b/.drone.yml index 4fce97c..8084937 100644 --- a/.drone.yml +++ b/.drone.yml @@ -17,7 +17,8 @@ steps: - wget https://git.openprivacy.ca/openprivacy/buildfiles/raw/master/tor/tor - wget https://git.openprivacy.ca/openprivacy/buildfiles/raw/master/tor/torrc - chmod a+x tor - - ./tor --version + - export PATH=`pwd`:$PATH + - tor --version - export GO111MODULE=on - name: quality image: golang:1.21.5-bookworm @@ -32,7 +33,7 @@ steps: - name: deps path: /go commands: - - export PATH=$PWD:$PATH + - export PATH=`pwd`:$PATH - sh testing/tests.sh - name: integ-test image: golang:1.21.5-bookworm @@ -40,7 +41,8 @@ steps: - name: deps path: /go commands: - - export PATH=$PWD:$PATH + - export PATH=`pwd`:$PATH + - tor --version - go test -timeout=30m -race -v cwtch.im/cwtch/testing/ - name: filesharing-integ-test image: golang:1.21.5-bookworm @@ -48,7 +50,7 @@ steps: - name: deps path: /go commands: - - export PATH=$PWD:$PATH + - export PATH=`pwd`:$PATH - go test -timeout=20m -race -v cwtch.im/cwtch/testing/filesharing - name: filesharing-autodownload-integ-test image: golang:1.21.5-bookworm @@ -56,7 +58,7 @@ steps: - name: deps path: /go commands: - - export PATH=$PWD:$PATH + - export PATH=`pwd`:$PATH - go test -timeout=20m -race -v cwtch.im/cwtch/testing/autodownload - name: notify-gogs image: openpriv/drone-gogs -- 2.25.1 From 5714d6f1d908d6918d422d6fc907fe0a4d072d7c Mon Sep 17 00:00:00 2001 From: Sarah Jamie Lewis Date: Tue, 2 Jan 2024 14:05:17 -0800 Subject: [PATCH 15/17] More libevent Deps. --- .drone.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.drone.yml b/.drone.yml index 8084937..33f0d2c 100644 --- a/.drone.yml +++ b/.drone.yml @@ -41,6 +41,8 @@ steps: - name: deps path: /go commands: + - apt update + - apt install libevent-2.1-7 - export PATH=`pwd`:$PATH - tor --version - go test -timeout=30m -race -v cwtch.im/cwtch/testing/ @@ -50,6 +52,8 @@ steps: - name: deps path: /go commands: + - apt update + - apt install libevent-2.1-7 - export PATH=`pwd`:$PATH - go test -timeout=20m -race -v cwtch.im/cwtch/testing/filesharing - name: filesharing-autodownload-integ-test @@ -58,6 +62,8 @@ steps: - name: deps path: /go commands: + - apt update + - apt install libevent-2.1-7 - export PATH=`pwd`:$PATH - go test -timeout=20m -race -v cwtch.im/cwtch/testing/autodownload - name: notify-gogs -- 2.25.1 From f9b3ff1837688827d7e62f4edb31b1b751eb8775 Mon Sep 17 00:00:00 2001 From: Sarah Jamie Lewis Date: Tue, 2 Jan 2024 14:42:34 -0800 Subject: [PATCH 16/17] Use properly packaged Tor for .drone scripts --- .drone.yml | 26 +++++++++++--------------- 1 file changed, 11 insertions(+), 15 deletions(-) diff --git a/.drone.yml b/.drone.yml index 33f0d2c..d14c0de 100644 --- a/.drone.yml +++ b/.drone.yml @@ -12,12 +12,11 @@ steps: commands: - go install honnef.co/go/tools/cmd/staticcheck@latest - go install go.uber.org/nilaway/cmd/nilaway@latest - - apt update - - apt install libevent-2.1-7 - - wget https://git.openprivacy.ca/openprivacy/buildfiles/raw/master/tor/tor - - wget https://git.openprivacy.ca/openprivacy/buildfiles/raw/master/tor/torrc - - chmod a+x tor - - export PATH=`pwd`:$PATH + - wget https://git.openprivacy.ca/openprivacy/buildfiles/raw/branch/master/tor/tor-0.4.8.9-linux-x86_64.tar.gz -O tor.tar.gz + - tar -xzf tor.tar.gz + - chmod a+x Tor/tor + - export PATH=$PWD/Tor/:$PATH + - export LD_LIBRARY_PATH=$PWD/Tor/ - tor --version - export GO111MODULE=on - name: quality @@ -41,9 +40,8 @@ steps: - name: deps path: /go commands: - - apt update - - apt install libevent-2.1-7 - - export PATH=`pwd`:$PATH + - export PATH=$PWD/Tor/:$PATH + - export LD_LIBRARY_PATH=$PWD/Tor/ - tor --version - go test -timeout=30m -race -v cwtch.im/cwtch/testing/ - name: filesharing-integ-test @@ -52,9 +50,8 @@ steps: - name: deps path: /go commands: - - apt update - - apt install libevent-2.1-7 - - export PATH=`pwd`:$PATH + - export PATH=$PWD/Tor/:$PATH + - export LD_LIBRARY_PATH=$PWD/Tor/ - go test -timeout=20m -race -v cwtch.im/cwtch/testing/filesharing - name: filesharing-autodownload-integ-test image: golang:1.21.5-bookworm @@ -62,9 +59,8 @@ steps: - name: deps path: /go commands: - - apt update - - apt install libevent-2.1-7 - - export PATH=`pwd`:$PATH + - export PATH=$PWD/Tor/:$PATH + - export LD_LIBRARY_PATH=$PWD/Tor/ - go test -timeout=20m -race -v cwtch.im/cwtch/testing/autodownload - name: notify-gogs image: openpriv/drone-gogs -- 2.25.1 From 6928c90a6169a4b9e1abdefe44da2bfd99f23f13 Mon Sep 17 00:00:00 2001 From: Sarah Jamie Lewis Date: Tue, 2 Jan 2024 15:15:48 -0800 Subject: [PATCH 17/17] Default to standard golang container --- .drone.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.drone.yml b/.drone.yml index d14c0de..5bfea52 100644 --- a/.drone.yml +++ b/.drone.yml @@ -5,7 +5,7 @@ name: linux-test steps: - name: fetch - image: golang:1.21.5-bookworm + image: golang:1.21.5 volumes: - name: deps path: /go @@ -20,14 +20,14 @@ steps: - tor --version - export GO111MODULE=on - name: quality - image: golang:1.21.5-bookworm + image: golang:1.21.5 volumes: - name: deps path: /go commands: - ./testing/quality.sh - name: units-tests - image: golang:1.21.5-bookworm + image: golang:1.21.5 volumes: - name: deps path: /go @@ -35,7 +35,7 @@ steps: - export PATH=`pwd`:$PATH - sh testing/tests.sh - name: integ-test - image: golang:1.21.5-bookworm + image: golang:1.21.5 volumes: - name: deps path: /go @@ -45,7 +45,7 @@ steps: - tor --version - go test -timeout=30m -race -v cwtch.im/cwtch/testing/ - name: filesharing-integ-test - image: golang:1.21.5-bookworm + image: golang:1.21.5 volumes: - name: deps path: /go @@ -54,7 +54,7 @@ steps: - export LD_LIBRARY_PATH=$PWD/Tor/ - go test -timeout=20m -race -v cwtch.im/cwtch/testing/filesharing - name: filesharing-autodownload-integ-test - image: golang:1.21.5-bookworm + image: golang:1.21.5 volumes: - name: deps path: /go -- 2.25.1