git » chasquid » commit f296bc3

cirrus: Allow the testing user to write to $GOPATH

author Alberto Bertogli
2020-05-17 08:54:26 UTC
committer Alberto Bertogli
2020-05-17 09:02:49 UTC
parent 4c28efcb20a19c8bbd6c6f018dd589ae0ebd4edf

cirrus: Allow the testing user to write to $GOPATH

Cirrus CI caches the module directory inside $GOPATH so it can be shared
between test runs, to speed them up.

However, it is currently created as root, which causes new entries to
fail since they run under the "testing" user.

This patch fixes that problem by making the "testing" user own the
entire $GOPATH, which includes the module directory.

.cirrus.yml +2 -0

diff --git a/.cirrus.yml b/.cirrus.yml
index 12f6746..030bdd4 100644
--- a/.cirrus.yml
+++ b/.cirrus.yml
@@ -17,6 +17,8 @@ linux_task:
     folder: $GOPATH/pkg/mod
   get_script: |
     useradd --create-home --user-group testing
+    chown -R testing:testing $GOPATH/
+    su testing -c "go mod download"
     su testing -c "go get ./..."
   build_script: |
     su testing -c "go build ./..."