diff --git a/aqua.yaml b/aqua.yaml index 4589b1bc8..e8a387808 100644 --- a/aqua.yaml +++ b/aqua.yaml @@ -1,12 +1,33 @@ packages: +- name: aqua + repository: inline + version: v0.1.0-3 - name: akoi repository: inline version: v2.2.1 +- name: golangci + repository: inline + version: v1.42.0 inline_repository: - name: akoi type: github_release - repo: suzuki-shunsuke/akoi + repo_owner: suzuki-shunsuke + repo_name: akoi artifact: 'akoi_{{trimPrefix "v" .Package.Version}}_{{.OS}}_{{.Arch}}.tar.gz' files: - name: akoi - src: akoi +- name: aqua + type: github_release + repo_owner: suzuki-shunsuke + repo_name: aqua + artifact: 'aqua_{{.OS}}_{{.Arch}}.tar.gz' + files: + - name: aqua +- name: golangci + type: github_release + repo_owner: golangci + repo_name: golangci-lint + artifact: 'golangci-lint-{{trimPrefix "v" .Package.Version}}-{{.OS}}-{{.Arch}}.tar.gz' + files: + - name: golangci-lint + src: 'golangci-lint-{{trimPrefix "v" .Package.Version}}-{{.OS}}-{{.Arch}}/golangci-lint' diff --git a/pkg/controller/config.go b/pkg/controller/config.go index afe51a04e..42353ba6b 100644 --- a/pkg/controller/config.go +++ b/pkg/controller/config.go @@ -26,7 +26,8 @@ type Package struct { type PackageInfo struct { Name string `validate:"required"` Type string `validate:"required"` - Repo string `validate:"required"` + RepoOwner string `yaml:"repo_owner" validate:"required"` + RepoName string `yaml:"repo_name" validate:"required"` Artifact *text.Template `validate:"required"` ArchiveType string `yaml:"archive_type"` Files []*File `validate:"required,dive"` diff --git a/pkg/controller/download.go b/pkg/controller/download.go index ad2dea770..9c4e9f65c 100644 --- a/pkg/controller/download.go +++ b/pkg/controller/download.go @@ -3,7 +3,6 @@ package controller import ( "context" "errors" - "strings" "github.com/sirupsen/logrus" ) @@ -15,15 +14,12 @@ func (ctrl *Controller) download(ctx context.Context, pkg *Package, pkgInfo *Pac "repository": pkg.Repository, }) logE.Info("download and unarchive the package") - s := strings.Split(pkgInfo.Repo, "/") - owner := s[0] - repoName := s[1] if pkgInfo.Type == "github_release" && ctrl.GitHub == nil { return errors.New("GITHUB_TOKEN is required for the type `github_release`") } - body, err := ctrl.downloadFromGitHub(ctx, owner, repoName, pkg.Version, assetName) + body, err := ctrl.downloadFromGitHub(ctx, pkgInfo.RepoOwner, pkgInfo.RepoName, pkg.Version, assetName) if err != nil { return err } diff --git a/pkg/controller/install.go b/pkg/controller/install.go index 2ce86ad16..9fabd600a 100644 --- a/pkg/controller/install.go +++ b/pkg/controller/install.go @@ -152,7 +152,7 @@ func (ctrl *Controller) installPackage(ctx context.Context, inlineRepo map[strin } func getPkgPath(aquaRootDir string, pkg *Package, pkgInfo *PackageInfo, assetName string) string { - return filepath.Join(aquaRootDir, "pkgs", pkgInfo.Type, "github.com", pkgInfo.Repo, pkg.Version, assetName) + return filepath.Join(aquaRootDir, "pkgs", pkgInfo.Type, "github.com", pkgInfo.RepoOwner, pkgInfo.RepoName, pkg.Version, assetName) } func (ctrl *Controller) createLink(cfg *Config, file *File) error { diff --git a/pkg/controller/install_proxy.go b/pkg/controller/install_proxy.go index 5f159e140..864f14367 100644 --- a/pkg/controller/install_proxy.go +++ b/pkg/controller/install_proxy.go @@ -24,10 +24,11 @@ func (ctrl *Controller) installProxy(ctx context.Context) error { logE.Debug("install the proxy") pkgInfo := &PackageInfo{ - Name: "inline", - Type: "github_release", - Repo: "suzuki-shunsuke/aqua-proxy", - Artifact: nil, + Name: "inline", + Type: "github_release", + RepoOwner: "suzuki-shunsuke", + RepoName: "aqua-proxy", + Artifact: nil, Files: []*File{ { Name: "aqua-proxy",