diff --git a/go.mod b/go.mod index 3b057a7..477434b 100644 --- a/go.mod +++ b/go.mod @@ -1,15 +1,23 @@ module github.com/cidverse/cid -go 1.21 +go 1.22 + +toolchain go1.22.2 require ( github.com/ProtonMail/gopenpgp/v2 v2.7.5 github.com/bwmarrin/snowflake v0.3.0 - github.com/cidverse/cidverseutils v0.0.0-20240302003507-f592801a7e1a + github.com/cidverse/cidverseutils/ci v0.0.0-20240422222733-849aa689d44c + github.com/cidverse/cidverseutils/compress v0.0.0-20240422221402-488260328200 + github.com/cidverse/cidverseutils/containerruntime v0.0.0-20240422222733-849aa689d44c + github.com/cidverse/cidverseutils/filesystem v0.0.0-20240422222733-849aa689d44c + github.com/cidverse/cidverseutils/hash v0.0.0-20240421215032-ae9bd53b804a + github.com/cidverse/cidverseutils/network v0.0.0-20240422222733-849aa689d44c + github.com/cidverse/cidverseutils/version v0.0.0-20240422222733-849aa689d44c github.com/cidverse/go-rules v0.0.0-20231112122021-075e5e6f8abc - github.com/cidverse/go-vcs v0.0.0-20240114124206-55cd79bb1b6b + github.com/cidverse/go-vcs v0.0.0-20240402102656-5c7ce4c133c6 github.com/cidverse/normalizeci v1.1.1-0.20240323134319-1eade1c37ec8 - github.com/cidverse/repoanalyzer v0.0.0-20240321000658-40c90bfb500d + github.com/cidverse/repoanalyzer v0.0.0-20240421224756-d04af36a7d1e github.com/go-resty/resty/v2 v2.12.0 github.com/google/uuid v1.6.0 github.com/hashicorp/go-version v1.6.0 @@ -22,7 +30,7 @@ require ( github.com/oriser/regroup v0.0.0-20230527212431-1b00c9bdbc5b github.com/rs/zerolog v1.32.0 github.com/samber/lo v1.39.0 - github.com/sethvargo/go-password v0.2.0 + github.com/sethvargo/go-password v0.3.0 github.com/spf13/cobra v1.8.0 github.com/stretchr/testify v1.9.0 github.com/thoas/go-funk v0.9.3 @@ -34,10 +42,12 @@ require ( dario.cat/mergo v1.0.0 // indirect github.com/BurntSushi/toml v1.3.2 // indirect github.com/Masterminds/semver/v3 v3.2.1 // indirect - github.com/Microsoft/go-winio v0.6.1 // indirect + github.com/Microsoft/go-winio v0.6.2 // indirect github.com/ProtonMail/go-crypto v1.0.0 // indirect github.com/ProtonMail/go-mime v0.0.0-20230322103455-7d82a3887f2f // indirect github.com/antlr4-go/antlr/v4 v4.13.0 // indirect + github.com/charlievieth/fastwalk v1.0.3 // indirect + github.com/cidverse/cidverseutils/exec v0.0.0-20240422222733-849aa689d44c // indirect github.com/cloudflare/circl v1.3.7 // indirect github.com/cyphar/filepath-securejoin v0.2.4 // indirect github.com/davecgh/go-spew v1.1.1 // indirect @@ -45,13 +55,12 @@ require ( github.com/gabriel-vasile/mimetype v1.4.3 // indirect github.com/go-git/gcfg v1.5.1-0.20230307220236-3a3c6141e376 // indirect github.com/go-git/go-billy/v5 v5.5.0 // indirect - github.com/go-git/go-git/v5 v5.11.0 // indirect + github.com/go-git/go-git/v5 v5.12.0 // indirect github.com/go-playground/locales v0.14.1 // indirect github.com/go-playground/universal-translator v0.18.1 // indirect github.com/go-playground/validator/v10 v10.19.0 // indirect github.com/golang-jwt/jwt v3.2.2+incompatible // indirect github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect - github.com/golang/protobuf v1.5.4 // indirect github.com/google/cel-go v0.20.1 // indirect github.com/google/go-github/v60 v60.0.0 // indirect github.com/google/go-querystring v1.1.0 // indirect @@ -66,13 +75,13 @@ require ( github.com/leodido/go-urn v1.4.0 // indirect github.com/mattn/go-isatty v0.0.20 // indirect github.com/opencontainers/go-digest v1.0.0 // indirect - github.com/pelletier/go-toml/v2 v2.2.0 // indirect + github.com/pelletier/go-toml/v2 v2.2.1 // indirect github.com/pjbgf/sha1cd v0.3.0 // indirect github.com/pkg/errors v0.9.1 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect github.com/sabhiram/go-gitignore v0.0.0-20210923224102-525f6e181f06 // indirect github.com/secure-systems-lab/go-securesystemslib v0.8.0 // indirect - github.com/sergi/go-diff v1.1.0 // indirect + github.com/sergi/go-diff v1.3.2-0.20230802210424-5b0b94c5c0d3 // indirect github.com/shibumi/go-pathspec v1.3.0 // indirect github.com/skeema/knownhosts v1.2.2 // indirect github.com/spf13/pflag v1.0.5 // indirect @@ -80,21 +89,19 @@ require ( github.com/stretchr/objx v0.5.2 // indirect github.com/valyala/bytebufferpool v1.0.0 // indirect github.com/valyala/fasttemplate v1.2.2 // indirect - github.com/xanzy/go-gitlab v0.101.0 // indirect + github.com/xanzy/go-gitlab v0.103.0 // indirect github.com/xanzy/ssh-agent v0.3.3 // indirect golang.org/x/crypto v0.22.0 // indirect - golang.org/x/exp v0.0.0-20240318143956-a85f2c67cd81 // indirect - golang.org/x/mod v0.16.0 // indirect + golang.org/x/exp v0.0.0-20240416160154-fe59bbe5cc7f // indirect + golang.org/x/mod v0.17.0 // indirect golang.org/x/net v0.24.0 // indirect - golang.org/x/oauth2 v0.18.0 // indirect - golang.org/x/sync v0.6.0 // indirect + golang.org/x/oauth2 v0.19.0 // indirect + golang.org/x/sync v0.7.0 // indirect golang.org/x/sys v0.19.0 // indirect golang.org/x/text v0.14.0 // indirect golang.org/x/time v0.5.0 // indirect - golang.org/x/tools v0.19.0 // indirect - google.golang.org/appengine v1.6.8 // indirect - google.golang.org/genproto/googleapis/api v0.0.0-20240318140521-94a12d6c2237 // indirect - google.golang.org/genproto/googleapis/rpc v0.0.0-20240318140521-94a12d6c2237 // indirect + google.golang.org/genproto/googleapis/api v0.0.0-20240415180920-8c6c420018be // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20240415180920-8c6c420018be // indirect google.golang.org/protobuf v1.33.0 // indirect gopkg.in/warnings.v0 v0.1.2 // indirect ) diff --git a/go.sum b/go.sum index 852bc91..10be809 100644 --- a/go.sum +++ b/go.sum @@ -6,8 +6,8 @@ github.com/BurntSushi/toml v1.3.2/go.mod h1:CxXYINrC8qIiEnFrOxCa7Jy5BFHlXnUU2pbi github.com/Masterminds/semver/v3 v3.2.1 h1:RN9w6+7QoMeJVGyfmbcgs28Br8cvmnucEXnY0rYXWg0= github.com/Masterminds/semver/v3 v3.2.1/go.mod h1:qvl/7zhW3nngYb5+80sSMF+FG2BjYrf8m9wsX0PNOMQ= github.com/Microsoft/go-winio v0.5.2/go.mod h1:WpS1mjBmmwHBEWmogvA2mj8546UReBk4v8QkMxJ6pZY= -github.com/Microsoft/go-winio v0.6.1 h1:9/kr64B9VUZrLm5YYwbGtUJnMgqWVOdUAXu6Migciow= -github.com/Microsoft/go-winio v0.6.1/go.mod h1:LRdKpFKfdobln8UmuiYcKPot9D2v6svN5+sAH+4kjUM= +github.com/Microsoft/go-winio v0.6.2 h1:F2VQgta7ecxGYO8k3ZZz3RS8fVIXVxONVUPlNERoyfY= +github.com/Microsoft/go-winio v0.6.2/go.mod h1:yd8OoFMLzJbo9gZq8j5qaps8bJ9aShtEA8Ipt1oGCvU= github.com/ProtonMail/go-crypto v0.0.0-20230717121422-5aa5874ade95/go.mod h1:EjAoLdwvbIOoOQr3ihjnSoLZRtE8azugULFRteWMNc0= github.com/ProtonMail/go-crypto v1.0.0 h1:LRuvITjQWX+WIfr930YHG2HNfjR1uOfyf5vE0kC2U78= github.com/ProtonMail/go-crypto v1.0.0/go.mod h1:EjAoLdwvbIOoOQr3ihjnSoLZRtE8azugULFRteWMNc0= @@ -24,16 +24,32 @@ github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5/go.mod h1:wHh0iHkY github.com/bwesterb/go-ristretto v1.2.3/go.mod h1:fUIoIZaG73pV5biE2Blr2xEzDoMj7NFEuV9ekS419A0= github.com/bwmarrin/snowflake v0.3.0 h1:xm67bEhkKh6ij1790JB83OujPR5CzNe8QuQqAgISZN0= github.com/bwmarrin/snowflake v0.3.0/go.mod h1:NdZxfVWX+oR6y2K0o6qAYv6gIOP9rjG0/E9WsDpxqwE= -github.com/cidverse/cidverseutils v0.0.0-20240302003507-f592801a7e1a h1:bnLhBQh+pGkf5lMfkC5nVVvooMFeWhrn3nlYbZ2UZ+s= -github.com/cidverse/cidverseutils v0.0.0-20240302003507-f592801a7e1a/go.mod h1:m71LmY0gEvKZ2jxFboMdGCcN9DgFlOmwNGH2TjM2nS4= +github.com/charlievieth/fastwalk v1.0.3 h1:eNWFaNPe5srPqQ5yyDbhAf11paeZaHWcihRhpuYFfSg= +github.com/charlievieth/fastwalk v1.0.3/go.mod h1:JSfglY/gmL/rqsUS1NCsJTocB5n6sSl9ApAqif4CUbs= +github.com/cidverse/cidverseutils/ci v0.0.0-20240422222733-849aa689d44c h1:zA8rZ72Iz8MEv7MHS0rlR6lsucNQ/5o/3MqAcUVMQu8= +github.com/cidverse/cidverseutils/ci v0.0.0-20240422222733-849aa689d44c/go.mod h1:PgQ8EcwZKtaLlo3MjaV8+TVJtAT66bflrY0oJqLjwsU= +github.com/cidverse/cidverseutils/compress v0.0.0-20240422221402-488260328200 h1:ncu3G57FQ5Q+G5Tl5P9h+iTD0XNkPb4JqfH0250uAuM= +github.com/cidverse/cidverseutils/compress v0.0.0-20240422221402-488260328200/go.mod h1:TIdgiHDqGpPevfhJcvvlpAmIZkyOGyfm9zQPPBl66L4= +github.com/cidverse/cidverseutils/containerruntime v0.0.0-20240422222733-849aa689d44c h1:dUcBY0gnuRz6Bd81lvEDMGDY/iudTjr4IpA1Id+UIl8= +github.com/cidverse/cidverseutils/containerruntime v0.0.0-20240422222733-849aa689d44c/go.mod h1:vK4URScNchpAIM65uHG0ntjLfMVOuPg2DISApNRE5Mw= +github.com/cidverse/cidverseutils/exec v0.0.0-20240422222733-849aa689d44c h1:iSb8QPKNBu0+sla+ZyCd6dTO9NxE3tQgdQNSa4POiVI= +github.com/cidverse/cidverseutils/exec v0.0.0-20240422222733-849aa689d44c/go.mod h1:Ii4CYQfSRnhJWJSFmDZXhnfrKR/gLXK3Ijd8n7FntfY= +github.com/cidverse/cidverseutils/filesystem v0.0.0-20240422222733-849aa689d44c h1:pGdKNisNSuX/guUAjqK/Q8Zj8t1UDLWjhSy0hfyPJ1s= +github.com/cidverse/cidverseutils/filesystem v0.0.0-20240422222733-849aa689d44c/go.mod h1:Calb4dLY0ENaq/uzbwjUPVsztD413+KvBnqzBcF74fo= +github.com/cidverse/cidverseutils/hash v0.0.0-20240421215032-ae9bd53b804a h1:ymkpQT6GVSxIFu2bpQE3iD8dLye1mFkyzfcsk/gsXWU= +github.com/cidverse/cidverseutils/hash v0.0.0-20240421215032-ae9bd53b804a/go.mod h1:GKV8jeHHa433XGYHQysvnKP6AjSJMa+oSdgVjmGwj7w= +github.com/cidverse/cidverseutils/network v0.0.0-20240422222733-849aa689d44c h1:8+18uJI9kD2t6vOHg+hmAPKQw7XfcAOwvZeCCIDV9Uk= +github.com/cidverse/cidverseutils/network v0.0.0-20240422222733-849aa689d44c/go.mod h1:uGDgl5fvG8h42xJbIluMsDEL8mwXGj1//Mq1M6w1DCY= +github.com/cidverse/cidverseutils/version v0.0.0-20240422222733-849aa689d44c h1:ldoXxnHTr5vyd4jp1uZnaUYHXMzfp3HrwtuNUpLSWLo= +github.com/cidverse/cidverseutils/version v0.0.0-20240422222733-849aa689d44c/go.mod h1:R6mAi4rHv6kQD1dt1TDVuyOBwJb/6OkALg2zwxYXPFk= github.com/cidverse/go-rules v0.0.0-20231112122021-075e5e6f8abc h1:eVuHW4U9BoiqjIwWPATHRm6oiphVlm3Jn7QgHGgeVq8= github.com/cidverse/go-rules v0.0.0-20231112122021-075e5e6f8abc/go.mod h1:1E+4h0XkcYJVq3RHoYQradnCt7wk3JgnuRRnfeiwAzE= -github.com/cidverse/go-vcs v0.0.0-20240114124206-55cd79bb1b6b h1:CO+EbvTc1EDd+vUPdvn4ohxNeMLh3to7E85k1Mc2NJg= -github.com/cidverse/go-vcs v0.0.0-20240114124206-55cd79bb1b6b/go.mod h1:J/FgRD2OVYFvGNQf5nltYLdpc0xEih0n4NzD2EZEPEw= +github.com/cidverse/go-vcs v0.0.0-20240402102656-5c7ce4c133c6 h1:MFnUQVoQj3etU3DtUK4bwN8evLcKV+KuvnRb5AlACxE= +github.com/cidverse/go-vcs v0.0.0-20240402102656-5c7ce4c133c6/go.mod h1:QDjMQz4P6BH7AsBNRuLfgtSFUwmLRFozbe8h92tRhao= github.com/cidverse/normalizeci v1.1.1-0.20240323134319-1eade1c37ec8 h1:h+0gC0H7zYh+h1S3ypgzfIt00kZL00wMoaKZDdUCIC4= github.com/cidverse/normalizeci v1.1.1-0.20240323134319-1eade1c37ec8/go.mod h1:o4GdPz6442jndTz8RZE8NS3KCexyzkrj5O6aB0t+8iw= -github.com/cidverse/repoanalyzer v0.0.0-20240321000658-40c90bfb500d h1:WxO4y5OCOUTAvCgCYnBHzQAx77dQ4g1XaM8JzhBVflo= -github.com/cidverse/repoanalyzer v0.0.0-20240321000658-40c90bfb500d/go.mod h1:5idqrAJvWkoAwZFwcUlNht8T81ExoPu5G8rC+22xZ8U= +github.com/cidverse/repoanalyzer v0.0.0-20240421224756-d04af36a7d1e h1:5mwioSqNlf6h/fbKKJ4AgRGxXODFEcZ/Xgu+sy5iSQs= +github.com/cidverse/repoanalyzer v0.0.0-20240421224756-d04af36a7d1e/go.mod h1:cUNYitiwN1x5LH8wfugVKU9fF60+ILFsBBpJDlFyRRU= github.com/cloudflare/circl v1.3.3/go.mod h1:5XYMA4rFBvNIrhs50XuiBJ15vF2pZn4nnUKZrLbUZFA= github.com/cloudflare/circl v1.3.7 h1:qlCDlTPz2n9fu58M0Nh1J/JzcFpfgkFHHX3O35r5vcU= github.com/cloudflare/circl v1.3.7/go.mod h1:sRTcRWXGLrKw6yIGJ+l7amYJFfAXbZG0kBSc8r4zxgA= @@ -52,16 +68,16 @@ github.com/emirpasic/gods v1.18.1 h1:FXtiHYKDGKCW2KzwZKx0iC0PQmdlorYgdFG9jPXJ1Bc github.com/emirpasic/gods v1.18.1/go.mod h1:8tpGGwCnJ5H4r6BWwaV6OrWmMoPhUl5jm/FMNAnJvWQ= github.com/gabriel-vasile/mimetype v1.4.3 h1:in2uUcidCuFcDKtdcBxlR0rJ1+fsokWf+uqxgUFjbI0= github.com/gabriel-vasile/mimetype v1.4.3/go.mod h1:d8uq/6HKRL6CGdk+aubisF/M5GcPfT7nKyLpA0lbSSk= -github.com/gliderlabs/ssh v0.3.5 h1:OcaySEmAQJgyYcArR+gGGTHCyE7nvhEMTlYY+Dp8CpY= -github.com/gliderlabs/ssh v0.3.5/go.mod h1:8XB4KraRrX39qHhT6yxPsHedjA08I/uBVwj4xC+/+z4= +github.com/gliderlabs/ssh v0.3.7 h1:iV3Bqi942d9huXnzEF2Mt+CY9gLu8DNM4Obd+8bODRE= +github.com/gliderlabs/ssh v0.3.7/go.mod h1:zpHEXBstFnQYtGnB8k8kQLol82umzn/2/snG7alWVD8= github.com/go-git/gcfg v1.5.1-0.20230307220236-3a3c6141e376 h1:+zs/tPmkDkHx3U66DAb0lQFJrpS6731Oaa12ikc+DiI= github.com/go-git/gcfg v1.5.1-0.20230307220236-3a3c6141e376/go.mod h1:an3vInlBmSxCcxctByoQdvwPiA7DTK7jaaFDBTtu0ic= github.com/go-git/go-billy/v5 v5.5.0 h1:yEY4yhzCDuMGSv83oGxiBotRzhwhNr8VZyphhiu+mTU= github.com/go-git/go-billy/v5 v5.5.0/go.mod h1:hmexnoNsr2SJU1Ju67OaNz5ASJY3+sHgFRpCtpDCKow= github.com/go-git/go-git-fixtures/v4 v4.3.2-0.20231010084843-55a94097c399 h1:eMje31YglSBqCdIqdhKBW8lokaMrL3uTkpGYlE2OOT4= github.com/go-git/go-git-fixtures/v4 v4.3.2-0.20231010084843-55a94097c399/go.mod h1:1OCfN199q1Jm3HZlxleg+Dw/mwps2Wbk9frAWm+4FII= -github.com/go-git/go-git/v5 v5.11.0 h1:XIZc1p+8YzypNr34itUfSvYJcv+eYdTnTvOZ2vD3cA4= -github.com/go-git/go-git/v5 v5.11.0/go.mod h1:6GFcX2P3NM7FPBfpePbpLd21XxsgdAt+lKqXmCUiUCY= +github.com/go-git/go-git/v5 v5.12.0 h1:7Md+ndsjrzZxbddRDZjF14qK+NN56sy6wkqaVrjZtys= +github.com/go-git/go-git/v5 v5.12.0/go.mod h1:FTM9VKtnI2m65hNI/TenDDDnUf2Q9FHnXYjuz9i5OEY= github.com/go-playground/assert/v2 v2.2.0 h1:JvknZsQTYeFEAhQwI4qEt9cyV5ONwRHC+lYKSsYSR8s= github.com/go-playground/assert/v2 v2.2.0/go.mod h1:VDjEfimB/XKnb+ZQfWdccd7VUvScMdVu0Titje2rxJ4= github.com/go-playground/locales v0.14.1 h1:EWaQ/wswjilfKLTECiXz7Rh+3BjFhfDFKv/oXslEjJA= @@ -77,14 +93,9 @@ github.com/golang-jwt/jwt v3.2.2+incompatible h1:IfV12K8xAKAnZqdXVzCZ+TOjboZ2keL github.com/golang-jwt/jwt v3.2.2+incompatible/go.mod h1:8pz2t5EyA70fFQQSrl6XZXzqecmYZeUEB8OUGHkxJ+I= github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da h1:oI5xCqsCo564l8iNU+DwB5epxmsaqB+rhGL0m5jtYqE= github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= -github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= -github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= -github.com/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek= -github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6rSs7xps= github.com/google/cel-go v0.20.1 h1:nDx9r8S3L4pE61eDdt8igGj8rf5kjYR3ILxWIpWNi84= github.com/google/cel-go v0.20.1/go.mod h1:kWcIzTsPX0zmQ+H3TirHstLLf9ep5QTsZBN9u4dOYLg= github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/google/go-github/v60 v60.0.0 h1:oLG98PsLauFvvu4D/YPxq374jhSxFYdzQGNCyONLfn8= @@ -146,8 +157,8 @@ github.com/opencontainers/image-spec v1.1.0 h1:8SG7/vwALn54lVB/0yZ/MMwhFrPYtpEHQ github.com/opencontainers/image-spec v1.1.0/go.mod h1:W4s4sFTMaBeK1BQLXbG4AdM2szdn85PY75RI83NrTrM= github.com/oriser/regroup v0.0.0-20230527212431-1b00c9bdbc5b h1:9L56kn3D7E9jd2R9U9p7tfzaBaLTVPt4HgnrP+g2VGk= github.com/oriser/regroup v0.0.0-20230527212431-1b00c9bdbc5b/go.mod h1:6eb1+OYHjOvThrtgEVue70NTfmzkalZgohRtndAUUbI= -github.com/pelletier/go-toml/v2 v2.2.0 h1:QLgLl2yMN7N+ruc31VynXs1vhMZa7CeHHejIeBAsoHo= -github.com/pelletier/go-toml/v2 v2.2.0/go.mod h1:1t835xjRzz80PqgE6HHgN2JOsmgYu/h4qDAS4n929Rs= +github.com/pelletier/go-toml/v2 v2.2.1 h1:9TA9+T8+8CUCO2+WYnDLCgrYi9+omqKXyjDtosvtEhg= +github.com/pelletier/go-toml/v2 v2.2.1/go.mod h1:1t835xjRzz80PqgE6HHgN2JOsmgYu/h4qDAS4n929Rs= github.com/pjbgf/sha1cd v0.3.0 h1:4D5XXmUUBUl/xQ6IjCkEAbqXskkq/4O7LmGn0AqMDs4= github.com/pjbgf/sha1cd v0.3.0/go.mod h1:nZ1rrWOcGJ5uZgEEVL1VUM9iRQiZvWdbZjkKyFzPPsI= github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= @@ -166,10 +177,10 @@ github.com/samber/lo v1.39.0 h1:4gTz1wUhNYLhFSKl6O+8peW0v2F4BCY034GRpU9WnuA= github.com/samber/lo v1.39.0/go.mod h1:+m/ZKRl6ClXCE2Lgf3MsQlWfh4bn1bz6CXEOxnEXnEA= github.com/secure-systems-lab/go-securesystemslib v0.8.0 h1:mr5An6X45Kb2nddcFlbmfHkLguCE9laoZCUzEEpIZXA= github.com/secure-systems-lab/go-securesystemslib v0.8.0/go.mod h1:UH2VZVuJfCYR8WgMlCU1uFsOUU+KeyrTWcSS73NBOzU= -github.com/sergi/go-diff v1.1.0 h1:we8PVUC3FE2uYfodKH/nBHMSetSfHDR6scGdBi+erh0= -github.com/sergi/go-diff v1.1.0/go.mod h1:STckp+ISIX8hZLjrqAeVduY0gWCT9IjLuqbuNXdaHfM= -github.com/sethvargo/go-password v0.2.0 h1:BTDl4CC/gjf/axHMaDQtw507ogrXLci6XRiLc7i/UHI= -github.com/sethvargo/go-password v0.2.0/go.mod h1:Ym4Mr9JXLBycr02MFuVQ/0JHidNetSgbzutTr3zsYXE= +github.com/sergi/go-diff v1.3.2-0.20230802210424-5b0b94c5c0d3 h1:n661drycOFuPLCN3Uc8sB6B/s6Z4t2xvBgU1htSHuq8= +github.com/sergi/go-diff v1.3.2-0.20230802210424-5b0b94c5c0d3/go.mod h1:A0bzQcvG0E7Rwjx0REVgAGH58e96+X0MeOfepqsbeW4= +github.com/sethvargo/go-password v0.3.0 h1:OLFHZ91Z7NiNP3dnaPxLxCDXlb6TBuxFzMvv6bu+Ptw= +github.com/sethvargo/go-password v0.3.0/go.mod h1:p6we8DZ0eyYXof9pon7Cqrw98N4KTaYiadDml1dUEEw= github.com/shibumi/go-pathspec v1.3.0 h1:QUyMZhFo0Md5B8zV8x2tesohbb5kfbpTi9rBnKh5dkI= github.com/shibumi/go-pathspec v1.3.0/go.mod h1:Xutfslp817l2I1cZvgcfeMQJG5QnU2lh5tVaaMCl3jE= github.com/sirupsen/logrus v1.7.0/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0= @@ -202,8 +213,8 @@ github.com/valyala/bytebufferpool v1.0.0 h1:GqA5TC/0021Y/b9FG4Oi9Mr3q7XYx6Kllzaw github.com/valyala/bytebufferpool v1.0.0/go.mod h1:6bBcMArwyJ5K/AmCkWv1jt77kVWyCJ6HpOuEn7z0Csc= github.com/valyala/fasttemplate v1.2.2 h1:lxLXG0uE3Qnshl9QyaK6XJxMXlQZELvChBOCmQD0Loo= github.com/valyala/fasttemplate v1.2.2/go.mod h1:KHLXt3tVN2HBp8eijSv/kGJopbvo7S+qRAEEKiv+SiQ= -github.com/xanzy/go-gitlab v0.101.0 h1:qRgvX8DNE19zRugB6rnnZMZ5ubhITSKPLNWEyc6UIPg= -github.com/xanzy/go-gitlab v0.101.0/go.mod h1:ETg8tcj4OhrB84UEgeE8dSuV/0h4BBL1uOV/qK0vlyI= +github.com/xanzy/go-gitlab v0.103.0 h1:J9pTQoq0GsEFqzd6srCM1QfdfKAxSNz6mT6ntrpNF2w= +github.com/xanzy/go-gitlab v0.103.0/go.mod h1:ETg8tcj4OhrB84UEgeE8dSuV/0h4BBL1uOV/qK0vlyI= github.com/xanzy/ssh-agent v0.3.3 h1:+/15pJfg/RsTxqYcX6fHqOXZwwMP+2VyYWJeWM2qQFM= github.com/xanzy/ssh-agent v0.3.3/go.mod h1:6dzNDKs0J9rVPHPhaGCukekBHKqfl+L3KghI1Bc68Uw= github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= @@ -216,12 +227,12 @@ golang.org/x/crypto v0.19.0/go.mod h1:Iy9bg/ha4yyC70EfRS8jz+B6ybOBKMaSxLj6P6oBDf golang.org/x/crypto v0.21.0/go.mod h1:0BP7YvVV9gBbVKyeTG0Gyn+gZm94bibOW5BjDEYAOMs= golang.org/x/crypto v0.22.0 h1:g1v0xeRhjcugydODzvb3mEM9SQ0HGp9s/nh3COQ/C30= golang.org/x/crypto v0.22.0/go.mod h1:vr6Su+7cTlO45qkww3VDJlzDn0ctJvRgYbC2NvXHt+M= -golang.org/x/exp v0.0.0-20240318143956-a85f2c67cd81 h1:6R2FC06FonbXQ8pK11/PDFY6N6LWlf9KlzibaCapmqc= -golang.org/x/exp v0.0.0-20240318143956-a85f2c67cd81/go.mod h1:CQ1k9gNrJ50XIzaKCRR2hssIjF07kZFEiieALBM/ARQ= +golang.org/x/exp v0.0.0-20240416160154-fe59bbe5cc7f h1:99ci1mjWVBWwJiEKYY6jWa4d2nTQVIEhZIptnrVb1XY= +golang.org/x/exp v0.0.0-20240416160154-fe59bbe5cc7f/go.mod h1:/lliqkxwWAhPjf5oSOIJup2XcqJaw8RGS6k3TGEc7GI= golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= -golang.org/x/mod v0.16.0 h1:QX4fJ0Rr5cPQCF7O9lh9Se4pmwfwskqZfq5moyldzic= -golang.org/x/mod v0.16.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= +golang.org/x/mod v0.17.0 h1:zY54UmvipHiNd+pm+m0x9KhZ9hl1/7QNMyxXbc6ICqA= +golang.org/x/mod v0.17.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= @@ -234,13 +245,13 @@ golang.org/x/net v0.21.0/go.mod h1:bIjVDfnllIU7BJ2DNgfnXvpSvtn8VRwhlsaeUTyUS44= golang.org/x/net v0.22.0/go.mod h1:JKghWKKOSdJwpW2GEx0Ja7fmaKnMsbu+MWVZTokSYmg= golang.org/x/net v0.24.0 h1:1PcaxkF854Fu3+lvBIx5SYn9wRlBzzcnHZSiaFFAb0w= golang.org/x/net v0.24.0/go.mod h1:2Q7sJY5mzlzWjKtYUEXSlBWCdyaioyXzRB2RtU8KVE8= -golang.org/x/oauth2 v0.18.0 h1:09qnuIAgzdx1XplqJvW6CQqMCtGZykZWcXzPMPUusvI= -golang.org/x/oauth2 v0.18.0/go.mod h1:Wf7knwG0MPoWIMMBgFlEaSUDaKskp0dCfrlJRJXbBi8= +golang.org/x/oauth2 v0.19.0 h1:9+E/EZBCbTLNrbN35fHv/a/d/mOBatymz1zbtQrXpIg= +golang.org/x/oauth2 v0.19.0/go.mod h1:vYi7skDa1x015PmRRYZ7+s1cWyPgrPiSYRe4rnsexc8= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.6.0 h1:5BMeUDZ7vkXGfEr1x9B4bRcTH4lpkTkpdh0T/J+qjbQ= -golang.org/x/sync v0.6.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= +golang.org/x/sync v0.7.0 h1:YsImfSBoP9QPYL0xyKJPq0gcaJdG3rInoqxTWbfQu9M= +golang.org/x/sync v0.7.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -275,7 +286,6 @@ golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= -golang.org/x/text v0.3.8/go.mod h1:E6s5w1FMmriuDzIBO73fBruAKo1PCIq6d2Q6DHfQ8WQ= golang.org/x/text v0.4.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/text v0.8.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= @@ -288,18 +298,12 @@ golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGm golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU= -golang.org/x/tools v0.19.0 h1:tfGCXNR1OsFG+sVdLAitlpjAvD/I6dHDKnYrpEZUHkw= -golang.org/x/tools v0.19.0/go.mod h1:qoJWxmGSIBmAeriMx19ogtrEPrGtDbPK634QFIcLAhc= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -google.golang.org/appengine v1.6.8 h1:IhEN5q69dyKagZPYMSdIjS2HqprW324FRQZJcGqPAsM= -google.golang.org/appengine v1.6.8/go.mod h1:1jJ3jBArFh5pcgW8gCtRJnepW8FzD1V44FJffLiz/Ds= -google.golang.org/genproto/googleapis/api v0.0.0-20240318140521-94a12d6c2237 h1:RFiFrvy37/mpSpdySBDrUdipW/dHwsRwh3J3+A9VgT4= -google.golang.org/genproto/googleapis/api v0.0.0-20240318140521-94a12d6c2237/go.mod h1:Z5Iiy3jtmioajWHDGFk7CeugTyHtPvMHA4UTmUkyalE= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240318140521-94a12d6c2237 h1:NnYq6UN9ReLM9/Y01KWNOWyI5xQ9kbIms5GGJVwS/Yc= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240318140521-94a12d6c2237/go.mod h1:WtryC6hu0hhx87FDGxWCDptyssuo68sk10vYjF+T9fY= -google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= -google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= +google.golang.org/genproto/googleapis/api v0.0.0-20240415180920-8c6c420018be h1:Zz7rLWqp0ApfsR/l7+zSHhY3PMiH2xqgxlfYfAfNpoU= +google.golang.org/genproto/googleapis/api v0.0.0-20240415180920-8c6c420018be/go.mod h1:dvdCTIoAGbkWbcIKBniID56/7XHTt6WfxXNMxuziJ+w= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240415180920-8c6c420018be h1:LG9vZxsWGOmUKieR8wPAUR3u3MpnYFQZROPIMaXh7/A= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240415180920-8c6c420018be/go.mod h1:WtryC6hu0hhx87FDGxWCDptyssuo68sk10vYjF+T9fY= google.golang.org/protobuf v1.33.0 h1:uNO2rsAINq/JlFpSdYEKIZ0uKD/R9cpdv0T+yoGwGmI= google.golang.org/protobuf v1.33.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= @@ -309,7 +313,7 @@ gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EV gopkg.in/warnings.v0 v0.1.2 h1:wFXVbFY8DY5/xOe1ECiWdKCzZlxgshcYVNkBHstARME= gopkg.in/warnings.v0 v0.1.2/go.mod h1:jksf8JmL6Qr/oQM2OXTHunEvvTAsrWBLb6OOjuVWRNI= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/pkg/cmd/docs.go b/pkg/cmd/docs.go index bc8e900..1e31a72 100644 --- a/pkg/cmd/docs.go +++ b/pkg/cmd/docs.go @@ -7,7 +7,7 @@ import ( "github.com/cidverse/cid/pkg/core/catalog" "github.com/cidverse/cid/pkg/docs" - "github.com/cidverse/cidverseutils/pkg/filesystem" + "github.com/cidverse/cidverseutils/filesystem" "github.com/rs/zerolog/log" "github.com/spf13/cobra" ) diff --git a/pkg/cmd/version.go b/pkg/cmd/version.go index 9a7b8b7..3ee21f4 100644 --- a/pkg/cmd/version.go +++ b/pkg/cmd/version.go @@ -5,7 +5,7 @@ import ( "os" "runtime" - "github.com/cidverse/cidverseutils/pkg/version" + "github.com/cidverse/cidverseutils/version" "github.com/spf13/cobra" ) diff --git a/pkg/common/api/action.go b/pkg/common/api/action.go index 3ccd419..29f38ea 100644 --- a/pkg/common/api/action.go +++ b/pkg/common/api/action.go @@ -8,11 +8,11 @@ import ( "github.com/cidverse/cid/pkg/core/catalog" "github.com/cidverse/cid/pkg/core/state" + "github.com/cidverse/cidverseutils/filesystem" "github.com/cidverse/normalizeci/pkg/normalizer/api" "github.com/samber/lo" "github.com/cidverse/cid/pkg/core/config" - "github.com/cidverse/cidverseutils/pkg/filesystem" "github.com/cidverse/repoanalyzer/analyzerapi" ) @@ -115,7 +115,7 @@ func GetActionContext(modules []*analyzerapi.ProjectModule, projectDir string, e Cache: "", }, ProjectDir: projectDir, - WorkDir: filesystem.GetWorkingDirectory(), + WorkDir: filesystem.WorkingDirOrPanic(), Config: "", Args: nil, Env: finalEnv, diff --git a/pkg/common/api/api.go b/pkg/common/api/api.go index ab98af0..938bd52 100644 --- a/pkg/common/api/api.go +++ b/pkg/common/api/api.go @@ -7,7 +7,7 @@ import ( "github.com/cidverse/cid/pkg/common/protectoutput" "github.com/cidverse/cid/pkg/core/config" "github.com/cidverse/cid/pkg/core/secret" - "github.com/cidverse/cidverseutils/pkg/filesystem" + "github.com/cidverse/cidverseutils/filesystem" "github.com/cidverse/normalizeci/pkg/envstruct" "github.com/cidverse/normalizeci/pkg/normalizer" "github.com/cidverse/normalizeci/pkg/normalizer/api" diff --git a/pkg/common/command/command.go b/pkg/common/command/command.go index 828cec0..8d70c76 100644 --- a/pkg/common/command/command.go +++ b/pkg/common/command/command.go @@ -14,15 +14,15 @@ import ( "github.com/cidverse/cid/pkg/constants" "github.com/cidverse/cid/pkg/core/util" - "github.com/cidverse/cidverseutils/pkg/containerruntime" - "github.com/cidverse/cidverseutils/pkg/network" + "github.com/cidverse/cidverseutils/ci" + "github.com/cidverse/cidverseutils/containerruntime" + "github.com/cidverse/cidverseutils/filesystem" + "github.com/cidverse/cidverseutils/network" "github.com/cidverse/go-vcs/vcsutil" "github.com/samber/lo" "github.com/cidverse/cid/pkg/common/protectoutput" "github.com/cidverse/cid/pkg/core/config" - "github.com/cidverse/cidverseutils/pkg/cihelper" - "github.com/cidverse/cidverseutils/pkg/filesystem" "github.com/rs/zerolog/log" ) @@ -137,9 +137,9 @@ func RunAPICommand(cmd APICommandExecute) (stdout string, stderr string, executi containerExec := containerruntime.Container{ Image: candidate.Image, - WorkingDirectory: cihelper.ToUnixPath(cmd.WorkDir), + WorkingDirectory: ci.ToUnixPath(cmd.WorkDir), Entrypoint: candidate.Entrypoint, - Command: cihelper.ToUnixPathArgs(strings.Join(args, " ")), + Command: ci.ToUnixPathArgs(strings.Join(args, " ")), User: util.GetContainerUser(), } @@ -147,7 +147,7 @@ func RunAPICommand(cmd APICommandExecute) (stdout string, stderr string, executi containerExec.AddVolume(containerruntime.ContainerMount{ MountType: "directory", Source: cmd.ProjectDir, - Target: cihelper.ToUnixPath(cmd.ProjectDir), + Target: ci.ToUnixPath(cmd.ProjectDir), }) // mount temp dir @@ -195,7 +195,7 @@ func RunAPICommand(cmd APICommandExecute) (stdout string, stderr string, executi if network.IsFreePort(port) { containerExec.ContainerPorts = append(containerExec.ContainerPorts, containerruntime.ContainerPort{Source: port, Target: port}) } else { - freePort, _ := network.GetFreePort() + freePort, _ := network.FreePort() containerExec.ContainerPorts = append(containerExec.ContainerPorts, containerruntime.ContainerPort{Source: freePort, Target: port}) } } @@ -266,12 +266,12 @@ func runCommand(command string, env map[string]string, projectDir string, workDi containerExec := containerruntime.Container{ Image: candidate.Image, - WorkingDirectory: cihelper.ToUnixPath(workDir), + WorkingDirectory: ci.ToUnixPath(workDir), Entrypoint: candidate.Entrypoint, - Command: cihelper.ToUnixPathArgs(strings.Join(cmdArgs, " ")), + Command: ci.ToUnixPathArgs(strings.Join(cmdArgs, " ")), User: util.GetContainerUser(), } - containerExec.AddVolume(containerruntime.ContainerMount{MountType: "directory", Source: projectDir, Target: cihelper.ToUnixPath(projectDir)}) + containerExec.AddVolume(containerruntime.ContainerMount{MountType: "directory", Source: projectDir, Target: ci.ToUnixPath(projectDir)}) // security if candidate.Security.Privileged { @@ -333,7 +333,7 @@ func RunSystemCommand(file string, args string, env map[string]string, workDir s for k, v := range env { commandEnv[k] = v } - cmd.Env = cihelper.ConvertEnvMapToStringSlice(commandEnv) + cmd.Env = ci.EnvMapToStringSlice(commandEnv) cmd.Dir = workDir cmd.Stdin = stdin cmd.Stdout = stdout diff --git a/pkg/common/command/util.go b/pkg/common/command/util.go index 453aab6..452a878 100644 --- a/pkg/common/command/util.go +++ b/pkg/common/command/util.go @@ -9,8 +9,8 @@ import ( "github.com/cidverse/cid/pkg/constants" "github.com/cidverse/cid/pkg/core/util" - "github.com/cidverse/cidverseutils/pkg/containerruntime" - "github.com/cidverse/cidverseutils/pkg/filesystem" + "github.com/cidverse/cidverseutils/containerruntime" + "github.com/cidverse/cidverseutils/filesystem" "github.com/rs/zerolog/log" ) diff --git a/pkg/common/commitanalyser/common.go b/pkg/common/commitanalyser/common.go index c2e4111..af5988e 100644 --- a/pkg/common/commitanalyser/common.go +++ b/pkg/common/commitanalyser/common.go @@ -3,7 +3,7 @@ package commitanalyser import ( "regexp" - "github.com/cidverse/cidverseutils/pkg/version" + "github.com/cidverse/cidverseutils/version" "github.com/cidverse/go-vcs/vcsapi" "github.com/oriser/regroup" diff --git a/pkg/common/workflowrun/workflow.go b/pkg/common/workflowrun/workflow.go index c68e6f6..53e2f95 100644 --- a/pkg/common/workflowrun/workflow.go +++ b/pkg/common/workflowrun/workflow.go @@ -3,6 +3,7 @@ package workflowrun import ( "encoding/json" "fmt" + "os" "path/filepath" "strings" "time" @@ -10,12 +11,12 @@ import ( "github.com/cidverse/cid/pkg/core/actionexecutor" "github.com/cidverse/cid/pkg/core/catalog" "github.com/cidverse/cid/pkg/core/state" + "github.com/cidverse/cidverseutils/filesystem" "github.com/cidverse/repoanalyzer" "github.com/cidverse/cid/pkg/common/api" "github.com/cidverse/cid/pkg/core/config" "github.com/cidverse/cid/pkg/core/rules" - "github.com/cidverse/cidverseutils/pkg/filesystem" "github.com/rs/zerolog/log" "github.com/thoas/go-funk" "gopkg.in/yaml.v3" @@ -120,7 +121,7 @@ func RunWorkflowAction(cfg *config.CIDConfig, action *catalog.WorkflowAction, en if catalogAction == nil { log.Fatal().Str("action_id", action.ID).Msg("workflow configuration error, referencing actions that do not exist") } - modules := repoanalyzer.AnalyzeProject(projectDir, filesystem.GetWorkingDirectory()) + modules := repoanalyzer.AnalyzeProject(projectDir, filesystem.WorkingDirOrPanic()) ctx := api.GetActionContext(modules, projectDir, env, &catalogAction.Access) // serialize action config for pass-thru @@ -194,8 +195,8 @@ func runWorkflowAction(catalogAction *catalog.Action, action *catalog.WorkflowAc log.Trace().Str("action", action.ID).Str("type", string(catalogAction.Type)).Str("config", string(actConfig)).Msg("action configuration") // paths - filesystem.CreateDirectory(ctx.Paths.Temp) - filesystem.CreateDirectory(ctx.Paths.Artifact) + _ = os.MkdirAll(ctx.Paths.Temp, os.ModePerm) + _ = os.MkdirAll(ctx.Paths.Artifact, os.ModePerm) // execute actionExecutor := actionexecutor.FindExecutorByType(string(catalogAction.Type)) diff --git a/pkg/core/actionexecutor/containeraction/containerexecutor.go b/pkg/core/actionexecutor/containeraction/containerexecutor.go index 5e46036..0d00456 100644 --- a/pkg/core/actionexecutor/containeraction/containerexecutor.go +++ b/pkg/core/actionexecutor/containeraction/containerexecutor.go @@ -19,9 +19,9 @@ import ( "github.com/cidverse/cid/pkg/core/restapi" "github.com/cidverse/cid/pkg/core/state" "github.com/cidverse/cid/pkg/core/util" - "github.com/cidverse/cidverseutils/pkg/cihelper" - "github.com/cidverse/cidverseutils/pkg/containerruntime" - "github.com/cidverse/cidverseutils/pkg/network" + "github.com/cidverse/cidverseutils/ci" + "github.com/cidverse/cidverseutils/containerruntime" + "github.com/cidverse/cidverseutils/network" "github.com/labstack/echo/v4" "github.com/rs/zerolog/log" ) @@ -42,7 +42,7 @@ func (e Executor) GetType() string { func (e Executor) Execute(ctx *commonapi.ActionExecutionContext, localState *state.ActionStateContext, catalogAction *catalog.Action, action *catalog.WorkflowAction) error { // api (port or socket) - freePort, err := network.GetFreePort() + freePort, err := network.FreePort() if err != nil { log.Fatal().Err(err).Msg("no free ports available") } @@ -118,7 +118,7 @@ func (e Executor) Execute(ctx *commonapi.ActionExecutionContext, localState *sta // configure container containerExec := containerruntime.Container{ Image: catalogAction.Container.Image, - WorkingDirectory: cihelper.ToUnixPath(ctx.ProjectDir), + WorkingDirectory: ci.ToUnixPath(ctx.ProjectDir), Command: insertCommandVariables(catalogAction.Container.Command, *catalogAction), User: util.GetContainerUser(), } @@ -127,7 +127,7 @@ func (e Executor) Execute(ctx *commonapi.ActionExecutionContext, localState *sta containerExec.AddVolume(containerruntime.ContainerMount{ MountType: "directory", Source: ctx.ProjectDir, - Target: cihelper.ToUnixPath(ctx.ProjectDir), + Target: ci.ToUnixPath(ctx.ProjectDir), }) // mount temp dir diff --git a/pkg/core/catalog/manage.go b/pkg/core/catalog/manage.go index 0bdbad5..cc1e78e 100644 --- a/pkg/core/catalog/manage.go +++ b/pkg/core/catalog/manage.go @@ -7,7 +7,7 @@ import ( "time" "github.com/cidverse/cid/pkg/core/util" - "github.com/cidverse/cidverseutils/pkg/encoding" + "github.com/cidverse/cidverseutils/hash" "github.com/go-resty/resty/v2" "github.com/rs/zerolog/log" "gopkg.in/yaml.v3" @@ -136,7 +136,7 @@ func UpdateCatalog(name string, source *Source) { } // sha256 hash - fileHash, hashErr := encoding.SHA256Hash(bytes.NewReader(resp.Body())) + fileHash, hashErr := hash.SHA256Hash(bytes.NewReader(resp.Body())) if hashErr != nil { log.Fatal().Err(hashErr).Str("uri", source.URI).Msg("failed to calculate catalog hash") } diff --git a/pkg/core/config/config.go b/pkg/core/config/config.go index 67cad96..437be70 100644 --- a/pkg/core/config/config.go +++ b/pkg/core/config/config.go @@ -4,7 +4,7 @@ import ( "embed" "github.com/cidverse/cid/pkg/core/catalog" - "github.com/cidverse/cidverseutils/pkg/filesystem" + "github.com/cidverse/cidverseutils/filesystem" "github.com/jinzhu/configor" "github.com/rs/zerolog/log" "gopkg.in/yaml.v3" diff --git a/pkg/core/config/lookup.go b/pkg/core/config/lookup.go index 219a833..45a9d68 100644 --- a/pkg/core/config/lookup.go +++ b/pkg/core/config/lookup.go @@ -8,8 +8,8 @@ import ( "sort" "github.com/cidverse/cid/pkg/core/catalog" - "github.com/cidverse/cidverseutils/pkg/filesystem" - "github.com/cidverse/cidverseutils/pkg/version" + "github.com/cidverse/cidverseutils/filesystem" + "github.com/cidverse/cidverseutils/version" "github.com/cidverse/normalizeci/pkg/normalizer/api" "github.com/rs/zerolog/log" "github.com/thoas/go-funk" diff --git a/pkg/core/config/paths.go b/pkg/core/config/paths.go index 3fb1cb5..c525af4 100644 --- a/pkg/core/config/paths.go +++ b/pkg/core/config/paths.go @@ -4,7 +4,7 @@ import ( "os" "path/filepath" - "github.com/cidverse/cidverseutils/pkg/filesystem" + "github.com/cidverse/cidverseutils/filesystem" ) // PathConfig contains the path configuration for build/tmp directories @@ -18,7 +18,7 @@ type PathConfig struct { func (c PathConfig) ArtifactModule(dir ...string) string { path := filepath.Join(c.Artifact, filepath.Join(dir...)) - filesystem.CreateDirectory(path) + _ = os.MkdirAll(path, os.ModePerm) return path } @@ -26,7 +26,7 @@ func (c PathConfig) ArtifactModule(dir ...string) string { func (c PathConfig) TempModule(name string) string { dir := filepath.Join(c.Temp, name) - filesystem.CreateDirectory(dir) + _ = os.MkdirAll(dir, os.ModePerm) _ = os.Chmod(dir, 777) return dir } @@ -41,7 +41,7 @@ func (c PathConfig) NamedCache(name string) string { } if !filesystem.DirectoryExists(dir) { - filesystem.CreateDirectory(dir) + _ = os.MkdirAll(dir, os.ModePerm) } return dir } @@ -56,7 +56,7 @@ func (c PathConfig) ModuleCache(module string) string { } if !filesystem.DirectoryExists(dir) { - filesystem.CreateDirectory(dir) + _ = os.MkdirAll(dir, os.ModePerm) } return dir } diff --git a/pkg/core/restapi/artifact.go b/pkg/core/restapi/artifact.go index 9445e81..bc68a3b 100644 --- a/pkg/core/restapi/artifact.go +++ b/pkg/core/restapi/artifact.go @@ -15,9 +15,8 @@ import ( "github.com/cidverse/cid/pkg/core/provenance" "github.com/cidverse/cid/pkg/core/state" "github.com/cidverse/cid/pkg/core/util" - "github.com/cidverse/cidverseutils/pkg/archive/tar" - "github.com/cidverse/cidverseutils/pkg/archive/zip" - "github.com/cidverse/cidverseutils/pkg/encoding" + "github.com/cidverse/cidverseutils/compress" + "github.com/cidverse/cidverseutils/hash" "github.com/cidverse/go-rules/pkg/expr" "github.com/in-toto/in-toto-golang/in_toto/slsa_provenance/v1" "github.com/labstack/echo/v4" @@ -139,7 +138,7 @@ func (hc *APIConfig) storeArtifact(moduleSlug string, fileType string, format st } // sha256 hash - fileHash, err := encoding.SHA256Hash(&hashReader) + fileHash, err := hash.SHA256Hash(&hashReader) if err != nil { return "", err } @@ -164,12 +163,12 @@ func (hc *APIConfig) storeArtifact(moduleSlug string, fileType string, format st log.Debug().Str("target_dir", extractTargetDir).Str("format", format).Msg("extracting artifact archive") if format == "tar" { - err := tar.Extract(targetFile, extractTargetDir) + err := compress.TARExtract(targetFile, extractTargetDir) if err != nil { return "", err } } else if format == "zip" { - err := zip.Extract(targetFile, extractTargetDir) + err := compress.ZIPExtract(targetFile, extractTargetDir) if err != nil { return "", err } diff --git a/pkg/core/restapi/config.go b/pkg/core/restapi/config.go index d755434..b5f542d 100644 --- a/pkg/core/restapi/config.go +++ b/pkg/core/restapi/config.go @@ -7,7 +7,7 @@ import ( "path/filepath" "github.com/cidverse/cid/pkg/constants" - "github.com/cidverse/cidverseutils/pkg/cihelper" + "github.com/cidverse/cidverseutils/ci" "github.com/labstack/echo/v4" ) @@ -29,8 +29,8 @@ func (hc *APIConfig) configCurrent(c echo.Context) error { "host_user_name": currentUser.Username, "host_group_id": currentUser.Gid, // paths - "project_dir": cihelper.ToUnixPath(hc.ProjectDir), - "artifact_dir": cihelper.ToUnixPath(filepath.Join(hc.ProjectDir, ".dist")), + "project_dir": ci.ToUnixPath(hc.ProjectDir), + "artifact_dir": ci.ToUnixPath(filepath.Join(hc.ProjectDir, ".dist")), "temp_dir": constants.TempPathInContainer, // dynamic config "config": hc.ActionConfig, diff --git a/pkg/core/restapi/project-modules-current.go b/pkg/core/restapi/project-modules-current.go index 9abf516..e59396e 100644 --- a/pkg/core/restapi/project-modules-current.go +++ b/pkg/core/restapi/project-modules-current.go @@ -3,7 +3,7 @@ package restapi import ( "net/http" - "github.com/cidverse/cidverseutils/pkg/cihelper" + "github.com/cidverse/cidverseutils/ci" "github.com/cidverse/repoanalyzer/analyzerapi" "github.com/labstack/echo/v4" ) @@ -19,20 +19,20 @@ func (hc *APIConfig) moduleCurrent(c echo.Context) error { } var module = hc.CurrentModule - module.RootDirectory = cihelper.ToUnixPath(module.RootDirectory) - module.Directory = cihelper.ToUnixPath(module.Directory) + module.RootDirectory = ci.ToUnixPath(module.RootDirectory) + module.Directory = ci.ToUnixPath(module.Directory) var discovery []analyzerapi.ProjectModuleDiscovery for _, d := range module.Discovery { if d.File != "" { - discovery = append(discovery, analyzerapi.ProjectModuleDiscovery{File: cihelper.ToUnixPath(d.File)}) + discovery = append(discovery, analyzerapi.ProjectModuleDiscovery{File: ci.ToUnixPath(d.File)}) } } module.Discovery = discovery var files = make([]string, len(module.Files)) for _, file := range module.Files { - files = append(files, cihelper.ToUnixPath(file)) + files = append(files, ci.ToUnixPath(file)) } module.Files = files diff --git a/pkg/core/restapi/project-modules.go b/pkg/core/restapi/project-modules.go index 63d3a54..269a47e 100644 --- a/pkg/core/restapi/project-modules.go +++ b/pkg/core/restapi/project-modules.go @@ -3,7 +3,7 @@ package restapi import ( "net/http" - "github.com/cidverse/cidverseutils/pkg/cihelper" + "github.com/cidverse/cidverseutils/ci" "github.com/cidverse/repoanalyzer/analyzerapi" "github.com/labstack/echo/v4" ) @@ -12,13 +12,13 @@ import ( func (hc *APIConfig) moduleList(c echo.Context) error { var modules []analyzerapi.ProjectModule for _, module := range hc.Modules { - module.RootDirectory = cihelper.ToUnixPath(module.RootDirectory) - module.Directory = cihelper.ToUnixPath(module.Directory) + module.RootDirectory = ci.ToUnixPath(module.RootDirectory) + module.Directory = ci.ToUnixPath(module.Directory) var discovery []analyzerapi.ProjectModuleDiscovery for _, d := range module.Discovery { if d.File != "" { - discovery = append(discovery, analyzerapi.ProjectModuleDiscovery{File: cihelper.ToUnixPath(d.File)}) + discovery = append(discovery, analyzerapi.ProjectModuleDiscovery{File: ci.ToUnixPath(d.File)}) } } module.Discovery = discovery diff --git a/pkg/core/state/store.go b/pkg/core/state/store.go index a43b4bb..87a58db 100644 --- a/pkg/core/state/store.go +++ b/pkg/core/state/store.go @@ -4,7 +4,7 @@ import ( "encoding/json" "path/filepath" - "github.com/cidverse/cidverseutils/pkg/filesystem" + "github.com/cidverse/cidverseutils/filesystem" "github.com/rs/zerolog/log" )