diff --git a/api/cmd/portainer/main.go b/api/cmd/portainer/main.go index 758bb0fd2..0bdd778da 100644 --- a/api/cmd/portainer/main.go +++ b/api/cmd/portainer/main.go @@ -40,9 +40,9 @@ import ( kubecli "github.com/portainer/portainer/api/kubernetes/cli" "github.com/portainer/portainer/api/ldap" "github.com/portainer/portainer/api/oauth" - "github.com/portainer/portainer/api/pkg/libhelm" "github.com/portainer/portainer/api/scheduler" "github.com/portainer/portainer/api/stacks/deployments" + "github.com/portainer/portainer/pkg/libhelm" "github.com/gofrs/uuid" "github.com/rs/zerolog/log" diff --git a/api/go.mod b/api/go.mod index b2d0b0525..3c6715f29 100644 --- a/api/go.mod +++ b/api/go.mod @@ -36,7 +36,6 @@ require ( github.com/pkg/errors v0.9.1 github.com/portainer/docker-compose-wrapper v0.0.0-20220708023447-a69a4ebaa021 github.com/portainer/libcrypto v0.0.0-20220506221303-1f4fb3b30f9a - github.com/portainer/libhelm v0.0.0-20221018213433-5ad83b50dbc9 github.com/portainer/libhttp v0.0.0-20220916153711-5d61e12f4b0a github.com/robfig/cron/v3 v3.0.1 github.com/rs/zerolog v1.28.0 @@ -105,6 +104,7 @@ require ( github.com/opencontainers/image-spec v1.0.2 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect github.com/portainer/portainer/third_party/digest v0.0.0-20221201002639-8fd0efa34f73 // indirect + github.com/portainer/portainer/pkg/libhelm v0.0.0-20221201012749-4fee35924724 // indirect github.com/sergi/go-diff v1.1.0 // indirect github.com/sirupsen/logrus v1.8.1 // indirect github.com/spf13/pflag v1.0.5 // indirect diff --git a/api/go.sum b/api/go.sum index 3183e1486..00e5adeb6 100644 --- a/api/go.sum +++ b/api/go.sum @@ -369,12 +369,12 @@ github.com/portainer/docker-compose-wrapper v0.0.0-20220708023447-a69a4ebaa021 h github.com/portainer/docker-compose-wrapper v0.0.0-20220708023447-a69a4ebaa021/go.mod h1:WxDlJWZxCnicdLCPnLNEv7/gRhjeIVuCGmsv+iOPH3c= github.com/portainer/libcrypto v0.0.0-20220506221303-1f4fb3b30f9a h1:B0z3skIMT+OwVNJPQhKp52X+9OWW6A9n5UWig3lHBJk= github.com/portainer/libcrypto v0.0.0-20220506221303-1f4fb3b30f9a/go.mod h1:n54EEIq+MM0NNtqLeCby8ljL+l275VpolXO0ibHegLE= -github.com/portainer/libhelm v0.0.0-20221018213433-5ad83b50dbc9 h1:PMw+45hocpYsMQ7WLIlzsf4854BhDM8C631kr0DVJtc= -github.com/portainer/libhelm v0.0.0-20221018213433-5ad83b50dbc9/go.mod h1:YvYAk7krKTzB+rFwDr0jQ3sQu2BtiXK1AR0sZH7nhJA= github.com/portainer/libhttp v0.0.0-20220916153711-5d61e12f4b0a h1:BJ5V4EDNhg3ImYbmXnGS8vrMhq6rzsEneIXyJh0g4dc= github.com/portainer/libhttp v0.0.0-20220916153711-5d61e12f4b0a/go.mod h1:ckuHnoLA5kLuE5WkvPBXmrw63LUMdSH4aX71QRi9y10= github.com/portainer/portainer/third_party/digest v0.0.0-20221201002639-8fd0efa34f73 h1:7bPOnwucE0nor0so1BQJxQKCL5t+vCWO4nAz/S0lci0= github.com/portainer/portainer/third_party/digest v0.0.0-20221201002639-8fd0efa34f73/go.mod h1:E2w/A6qsKuG2VyiUubPdXpDyPykWfQqxuCs0YNS0MhM= +github.com/portainer/portainer/pkg/libhelm v0.0.0-20221201012749-4fee35924724 h1:FZrRVMpxXdUV+p5VSCAy9Uz7RzAeEJr2ytlctvMrsHY= +github.com/portainer/portainer/pkg/libhelm v0.0.0-20221201012749-4fee35924724/go.mod h1:WUdwNVH9GMffP4qf4U2ea2qCYfti2V7S+IhGpO8Sxv0= github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/robfig/cron/v3 v3.0.1 h1:WdRxkvbJztn8LMz/QEvLN5sBU+xKpSqwwUO1Pjr4qDs= github.com/robfig/cron/v3 v3.0.1/go.mod h1:eQICP3HwyT7UooqI/z+Ov+PtYAWygg1TEWWzGIFLtro= diff --git a/api/http/handler/helm/handler.go b/api/http/handler/helm/handler.go index 25870366e..dcf598412 100644 --- a/api/http/handler/helm/handler.go +++ b/api/http/handler/helm/handler.go @@ -4,14 +4,14 @@ import ( "net/http" "github.com/gorilla/mux" - "github.com/portainer/libhelm/options" httperror "github.com/portainer/libhttp/error" portainer "github.com/portainer/portainer/api" "github.com/portainer/portainer/api/dataservices" "github.com/portainer/portainer/api/http/middlewares" "github.com/portainer/portainer/api/http/security" "github.com/portainer/portainer/api/kubernetes" - "github.com/portainer/portainer/api/pkg/libhelm" + "github.com/portainer/portainer/pkg/libhelm" + "github.com/portainer/portainer/pkg/libhelm/options" ) type requestBouncer interface { diff --git a/api/http/handler/helm/helm_delete.go b/api/http/handler/helm/helm_delete.go index f779e1cf5..5803ce26f 100644 --- a/api/http/handler/helm/helm_delete.go +++ b/api/http/handler/helm/helm_delete.go @@ -3,10 +3,10 @@ package helm import ( "net/http" - "github.com/portainer/libhelm/options" httperror "github.com/portainer/libhttp/error" "github.com/portainer/libhttp/request" "github.com/portainer/libhttp/response" + "github.com/portainer/portainer/pkg/libhelm/options" ) // @id HelmDelete diff --git a/api/http/handler/helm/helm_delete_test.go b/api/http/handler/helm/helm_delete_test.go index 530c2912e..d4aae9003 100644 --- a/api/http/handler/helm/helm_delete_test.go +++ b/api/http/handler/helm/helm_delete_test.go @@ -6,14 +6,14 @@ import ( "net/http/httptest" "testing" - "github.com/portainer/libhelm/binary/test" - "github.com/portainer/libhelm/options" portainer "github.com/portainer/portainer/api" "github.com/portainer/portainer/api/datastore" "github.com/portainer/portainer/api/exec/exectest" "github.com/portainer/portainer/api/http/security" "github.com/portainer/portainer/api/jwt" "github.com/portainer/portainer/api/kubernetes" + "github.com/portainer/portainer/pkg/libhelm/binary/test" + "github.com/portainer/portainer/pkg/libhelm/options" "github.com/stretchr/testify/assert" helper "github.com/portainer/portainer/api/internal/testhelpers" diff --git a/api/http/handler/helm/helm_install.go b/api/http/handler/helm/helm_install.go index 33f8f45da..2a9aec456 100644 --- a/api/http/handler/helm/helm_install.go +++ b/api/http/handler/helm/helm_install.go @@ -7,8 +7,6 @@ import ( "strings" "github.com/pkg/errors" - "github.com/portainer/libhelm/options" - "github.com/portainer/libhelm/release" httperror "github.com/portainer/libhttp/error" "github.com/portainer/libhttp/request" "github.com/portainer/libhttp/response" @@ -16,6 +14,8 @@ import ( "github.com/portainer/portainer/api/http/security" "github.com/portainer/portainer/api/kubernetes" "github.com/portainer/portainer/api/kubernetes/validation" + "github.com/portainer/portainer/pkg/libhelm/options" + "github.com/portainer/portainer/pkg/libhelm/release" "golang.org/x/sync/errgroup" ) diff --git a/api/http/handler/helm/helm_install_test.go b/api/http/handler/helm/helm_install_test.go index 6d3dbc3e3..0cc59eec5 100644 --- a/api/http/handler/helm/helm_install_test.go +++ b/api/http/handler/helm/helm_install_test.go @@ -10,15 +10,15 @@ import ( "github.com/portainer/portainer/api/datastore" - "github.com/portainer/libhelm/binary/test" - "github.com/portainer/libhelm/options" - "github.com/portainer/libhelm/release" portainer "github.com/portainer/portainer/api" "github.com/portainer/portainer/api/exec/exectest" "github.com/portainer/portainer/api/http/security" helper "github.com/portainer/portainer/api/internal/testhelpers" "github.com/portainer/portainer/api/jwt" "github.com/portainer/portainer/api/kubernetes" + "github.com/portainer/portainer/pkg/libhelm/binary/test" + "github.com/portainer/portainer/pkg/libhelm/options" + "github.com/portainer/portainer/pkg/libhelm/release" "github.com/stretchr/testify/assert" ) diff --git a/api/http/handler/helm/helm_list.go b/api/http/handler/helm/helm_list.go index 2105c7b15..51ca32262 100644 --- a/api/http/handler/helm/helm_list.go +++ b/api/http/handler/helm/helm_list.go @@ -3,10 +3,10 @@ package helm import ( "net/http" - "github.com/portainer/libhelm/options" httperror "github.com/portainer/libhttp/error" "github.com/portainer/libhttp/request" "github.com/portainer/libhttp/response" + "github.com/portainer/portainer/pkg/libhelm/options" ) // @id HelmList diff --git a/api/http/handler/helm/helm_list_test.go b/api/http/handler/helm/helm_list_test.go index 6ddea268c..00dac414e 100644 --- a/api/http/handler/helm/helm_list_test.go +++ b/api/http/handler/helm/helm_list_test.go @@ -7,15 +7,15 @@ import ( "net/http/httptest" "testing" - "github.com/portainer/libhelm/binary/test" - "github.com/portainer/libhelm/options" - "github.com/portainer/libhelm/release" portainer "github.com/portainer/portainer/api" "github.com/portainer/portainer/api/datastore" "github.com/portainer/portainer/api/exec/exectest" "github.com/portainer/portainer/api/http/security" "github.com/portainer/portainer/api/jwt" "github.com/portainer/portainer/api/kubernetes" + "github.com/portainer/portainer/pkg/libhelm/binary/test" + "github.com/portainer/portainer/pkg/libhelm/options" + "github.com/portainer/portainer/pkg/libhelm/release" "github.com/stretchr/testify/assert" helper "github.com/portainer/portainer/api/internal/testhelpers" diff --git a/api/http/handler/helm/helm_repo_search.go b/api/http/handler/helm/helm_repo_search.go index 24e992832..7b9697bbf 100644 --- a/api/http/handler/helm/helm_repo_search.go +++ b/api/http/handler/helm/helm_repo_search.go @@ -6,8 +6,8 @@ import ( "net/url" "github.com/pkg/errors" - "github.com/portainer/libhelm/options" httperror "github.com/portainer/libhttp/error" + "github.com/portainer/portainer/pkg/libhelm/options" ) // @id HelmRepoSearch diff --git a/api/http/handler/helm/helm_repo_search_test.go b/api/http/handler/helm/helm_repo_search_test.go index 974e527ee..5f9cec615 100644 --- a/api/http/handler/helm/helm_repo_search_test.go +++ b/api/http/handler/helm/helm_repo_search_test.go @@ -8,8 +8,8 @@ import ( "net/url" "testing" - "github.com/portainer/libhelm/binary/test" helper "github.com/portainer/portainer/api/internal/testhelpers" + "github.com/portainer/portainer/pkg/libhelm/binary/test" "github.com/stretchr/testify/assert" ) diff --git a/api/http/handler/helm/helm_show.go b/api/http/handler/helm/helm_show.go index 631b0aa90..5d33f95b8 100644 --- a/api/http/handler/helm/helm_show.go +++ b/api/http/handler/helm/helm_show.go @@ -5,9 +5,9 @@ import ( "net/http" "net/url" - "github.com/portainer/libhelm/options" httperror "github.com/portainer/libhttp/error" "github.com/portainer/libhttp/request" + "github.com/portainer/portainer/pkg/libhelm/options" "github.com/pkg/errors" "github.com/rs/zerolog/log" diff --git a/api/http/handler/helm/helm_show_test.go b/api/http/handler/helm/helm_show_test.go index c619dd01e..dd3957c99 100644 --- a/api/http/handler/helm/helm_show_test.go +++ b/api/http/handler/helm/helm_show_test.go @@ -8,8 +8,8 @@ import ( "net/url" "testing" - "github.com/portainer/libhelm/binary/test" helper "github.com/portainer/portainer/api/internal/testhelpers" + "github.com/portainer/portainer/pkg/libhelm/binary/test" "github.com/stretchr/testify/assert" ) diff --git a/api/http/handler/helm/user_helm_repos.go b/api/http/handler/helm/user_helm_repos.go index 0e92e354a..d183574fc 100644 --- a/api/http/handler/helm/user_helm_repos.go +++ b/api/http/handler/helm/user_helm_repos.go @@ -6,7 +6,7 @@ import ( "github.com/pkg/errors" - "github.com/portainer/portainer/api/pkg/libhelm" + "github.com/portainer/portainer/pkg/libhelm" httperror "github.com/portainer/libhttp/error" "github.com/portainer/libhttp/request" diff --git a/api/http/handler/settings/settings_update.go b/api/http/handler/settings/settings_update.go index e4ddf81b0..e328f9de0 100644 --- a/api/http/handler/settings/settings_update.go +++ b/api/http/handler/settings/settings_update.go @@ -13,7 +13,7 @@ import ( portainer "github.com/portainer/portainer/api" "github.com/portainer/portainer/api/filesystem" "github.com/portainer/portainer/api/internal/edge" - "github.com/portainer/portainer/api/pkg/libhelm" + "github.com/portainer/portainer/pkg/libhelm" ) type settingsUpdatePayload struct { diff --git a/api/http/server.go b/api/http/server.go index 6eb1dab0d..eb8b2b712 100644 --- a/api/http/server.go +++ b/api/http/server.go @@ -59,9 +59,9 @@ import ( "github.com/portainer/portainer/api/internal/ssl" k8s "github.com/portainer/portainer/api/kubernetes" "github.com/portainer/portainer/api/kubernetes/cli" - "github.com/portainer/portainer/api/pkg/libhelm" "github.com/portainer/portainer/api/scheduler" "github.com/portainer/portainer/api/stacks/deployments" + "github.com/portainer/portainer/pkg/libhelm" "github.com/rs/zerolog/log" ) diff --git a/api/pkg/libhelm/README.md b/api/pkg/libhelm/README.md index a6e315078..c2454caec 100644 --- a/api/pkg/libhelm/README.md +++ b/api/pkg/libhelm/README.md @@ -5,7 +5,7 @@ A helm abstraction for Portainer. ## Installation ```sh -go get github.com/portainer/portainer/api/pkg/libhelm +go get github.com/portainer/portainer/pkg/libhelm ``` ## Tests diff --git a/api/pkg/libhelm/binary/get.go b/api/pkg/libhelm/binary/get.go index 9f695c9f7..147dbed52 100644 --- a/api/pkg/libhelm/binary/get.go +++ b/api/pkg/libhelm/binary/get.go @@ -2,7 +2,8 @@ package binary import ( "github.com/pkg/errors" - "github.com/portainer/libhelm/options" + + "github.com/portainer/portainer/pkg/libhelm/options" ) // Get runs `helm get` with specified get options. diff --git a/api/pkg/libhelm/binary/helm_package.go b/api/pkg/libhelm/binary/helm_package.go index 559972ae9..73805a89e 100644 --- a/api/pkg/libhelm/binary/helm_package.go +++ b/api/pkg/libhelm/binary/helm_package.go @@ -7,7 +7,7 @@ import ( "runtime" "github.com/pkg/errors" - "github.com/portainer/libhelm/options" + "github.com/portainer/portainer/pkg/libhelm/options" ) // helmBinaryPackageManager is a wrapper for the helm binary which implements HelmPackageManager diff --git a/api/pkg/libhelm/binary/install.go b/api/pkg/libhelm/binary/install.go index 042f295af..24798517d 100644 --- a/api/pkg/libhelm/binary/install.go +++ b/api/pkg/libhelm/binary/install.go @@ -4,8 +4,8 @@ import ( "encoding/json" "github.com/pkg/errors" - "github.com/portainer/libhelm/options" - "github.com/portainer/libhelm/release" + "github.com/portainer/portainer/pkg/libhelm/options" + "github.com/portainer/portainer/pkg/libhelm/release" ) // Install runs `helm install` with specified install options. diff --git a/api/pkg/libhelm/binary/install_test.go b/api/pkg/libhelm/binary/install_test.go index 6db2d7d64..f22d5916a 100644 --- a/api/pkg/libhelm/binary/install_test.go +++ b/api/pkg/libhelm/binary/install_test.go @@ -6,7 +6,7 @@ import ( "path/filepath" "testing" - "github.com/portainer/libhelm/options" + "github.com/portainer/portainer/pkg/libhelm/options" "github.com/stretchr/testify/assert" ) diff --git a/api/pkg/libhelm/binary/list.go b/api/pkg/libhelm/binary/list.go index a3734ad0f..a81f511bf 100644 --- a/api/pkg/libhelm/binary/list.go +++ b/api/pkg/libhelm/binary/list.go @@ -4,8 +4,8 @@ import ( "encoding/json" "github.com/pkg/errors" - "github.com/portainer/libhelm/options" - "github.com/portainer/libhelm/release" + "github.com/portainer/portainer/pkg/libhelm/options" + "github.com/portainer/portainer/pkg/libhelm/release" ) // List runs `helm list --output json --filter --selector --namespace ` with specified list options. diff --git a/api/pkg/libhelm/binary/search_repo.go b/api/pkg/libhelm/binary/search_repo.go index 5dbe92823..fbdbfdf08 100644 --- a/api/pkg/libhelm/binary/search_repo.go +++ b/api/pkg/libhelm/binary/search_repo.go @@ -12,7 +12,7 @@ import ( "time" "github.com/pkg/errors" - "github.com/portainer/libhelm/options" + "github.com/portainer/portainer/pkg/libhelm/options" "gopkg.in/yaml.v3" ) diff --git a/api/pkg/libhelm/binary/search_repo_test.go b/api/pkg/libhelm/binary/search_repo_test.go index 60d0acefc..5b1562268 100644 --- a/api/pkg/libhelm/binary/search_repo_test.go +++ b/api/pkg/libhelm/binary/search_repo_test.go @@ -3,8 +3,8 @@ package binary import ( "testing" - "github.com/portainer/libhelm/libhelmtest" - "github.com/portainer/libhelm/options" + "github.com/portainer/portainer/pkg/libhelm/libhelmtest" + "github.com/portainer/portainer/pkg/libhelm/options" "github.com/stretchr/testify/assert" ) diff --git a/api/pkg/libhelm/binary/show.go b/api/pkg/libhelm/binary/show.go index d352e851e..7639e6dc2 100644 --- a/api/pkg/libhelm/binary/show.go +++ b/api/pkg/libhelm/binary/show.go @@ -2,7 +2,7 @@ package binary import ( "github.com/pkg/errors" - "github.com/portainer/libhelm/options" + "github.com/portainer/portainer/pkg/libhelm/options" ) var errRequiredShowOptions = errors.New("chart, repo and output format are required") diff --git a/api/pkg/libhelm/binary/test/mock.go b/api/pkg/libhelm/binary/test/mock.go index 074660ac4..06c9e9105 100644 --- a/api/pkg/libhelm/binary/test/mock.go +++ b/api/pkg/libhelm/binary/test/mock.go @@ -5,9 +5,9 @@ import ( "strings" "github.com/pkg/errors" - "github.com/portainer/libhelm/options" - "github.com/portainer/libhelm/release" - "github.com/portainer/portainer/api/pkg/libhelm" + "github.com/portainer/portainer/pkg/libhelm" + "github.com/portainer/portainer/pkg/libhelm/options" + "github.com/portainer/portainer/pkg/libhelm/release" "gopkg.in/yaml.v3" ) diff --git a/api/pkg/libhelm/binary/uninstall.go b/api/pkg/libhelm/binary/uninstall.go index 7c8c47490..d8a7fdfc6 100644 --- a/api/pkg/libhelm/binary/uninstall.go +++ b/api/pkg/libhelm/binary/uninstall.go @@ -2,7 +2,7 @@ package binary import ( "github.com/pkg/errors" - "github.com/portainer/libhelm/options" + "github.com/portainer/portainer/pkg/libhelm/options" ) var errRequiredUninstallOptions = errors.New("release name is required") diff --git a/api/pkg/libhelm/helm.go b/api/pkg/libhelm/helm.go index 8ceb55eeb..3f718e64f 100644 --- a/api/pkg/libhelm/helm.go +++ b/api/pkg/libhelm/helm.go @@ -1,8 +1,8 @@ package libhelm import ( - "github.com/portainer/libhelm/options" - "github.com/portainer/libhelm/release" + "github.com/portainer/portainer/pkg/libhelm/options" + "github.com/portainer/portainer/pkg/libhelm/release" ) // HelmPackageManager represents a service that interfaces with Helm diff --git a/api/pkg/libhelm/manager.go b/api/pkg/libhelm/manager.go index bd4a7ea8c..f378b2e55 100644 --- a/api/pkg/libhelm/manager.go +++ b/api/pkg/libhelm/manager.go @@ -3,7 +3,7 @@ package libhelm import ( "errors" - "github.com/portainer/libhelm/binary" + "github.com/portainer/portainer/pkg/libhelm/binary" ) // HelmConfig is a struct that holds the configuration for the Helm package manager diff --git a/api/pkg/libhelm/release/release.go b/api/pkg/libhelm/release/release.go index a8e14e33f..48ed23c88 100644 --- a/api/pkg/libhelm/release/release.go +++ b/api/pkg/libhelm/release/release.go @@ -1,6 +1,6 @@ package release -import "github.com/portainer/libhelm/time" +import "github.com/portainer/portainer/pkg/libhelm/time" // Release is the struct that holds the information for a helm release. // The struct definitions have been copied from the offical Helm Golang client/library. diff --git a/api/pkg/libhelm/validate_repo_test.go b/api/pkg/libhelm/validate_repo_test.go index 510be983e..7648044d4 100644 --- a/api/pkg/libhelm/validate_repo_test.go +++ b/api/pkg/libhelm/validate_repo_test.go @@ -3,7 +3,8 @@ package libhelm import ( "testing" - "github.com/portainer/libhelm/libhelmtest" + "github.com/portainer/portainer/pkg/libhelm/libhelmtest" + "github.com/stretchr/testify/assert" )