diff --git a/.github/workflows/wc-integration-test.yaml b/.github/workflows/wc-integration-test.yaml index d1129f19b..09f015a1f 100644 --- a/.github/workflows/wc-integration-test.yaml +++ b/.github/workflows/wc-integration-test.yaml @@ -189,6 +189,20 @@ jobs: git checkout -- . working-directory: tests/update + - name: update (go_version_file) + run: | + aqua up + git diff . + git checkout -- . + working-directory: tests/update2 + + - name: update (version_expr) + run: | + aqua up + git diff . + git checkout -- . + working-directory: tests/update3 + - run: aqua update-checksum -a - run: terraform --help diff --git a/pkg/config-reader/update.go b/pkg/config-reader/update.go index 90b246b3a..48e3f340d 100644 --- a/pkg/config-reader/update.go +++ b/pkg/config-reader/update.go @@ -43,13 +43,16 @@ func (r *ConfigReader) ReadToUpdate(configFilePath string, cfg *aqua.Config) (ma return cfgs, nil } -func (r *ConfigReader) readImportsToUpdate(configFilePath string, cfg *aqua.Config) (map[string]*aqua.Config, error) { +func (r *ConfigReader) readImportsToUpdate(configFilePath string, cfg *aqua.Config) (map[string]*aqua.Config, error) { //nolint:cyclop cfgs := map[string]*aqua.Config{} pkgs := []*aqua.Package{} for _, pkg := range cfg.Packages { if pkg == nil { continue } + if pkg.VersionExpr != "" || pkg.GoVersionFile != "" || pkg.Pin { + continue + } if pkg.Import == "" { pkgs = append(pkgs, pkg) continue diff --git a/pkg/config/aqua/config.go b/pkg/config/aqua/config.go index df05357f5..7603b594f 100644 --- a/pkg/config/aqua/config.go +++ b/pkg/config/aqua/config.go @@ -21,6 +21,7 @@ type Package struct { VersionExprPrefix string `json:"version_expr_prefix,omitempty" yaml:"version_expr_prefix,omitempty"` Vars map[string]any `json:"vars,omitempty" yaml:",omitempty"` CommandAliases []*CommandAlias `json:"command_aliases,omitempty" yaml:"command_aliases,omitempty"` + Pin bool `json:"-" yaml:"-"` } type CommandAlias struct { @@ -55,6 +56,7 @@ func (p *Package) UnmarshalYAML(unmarshal func(interface{}) error) error { if err := unmarshal(&a); err != nil { return err } + pin := a.Version != "" name, version := parseNameWithVersion(a.Name) if name != "" { a.Name = name @@ -66,7 +68,7 @@ func (p *Package) UnmarshalYAML(unmarshal func(interface{}) error) error { if p.Registry == "" { p.Registry = RegistryTypeStandard } - + p.Pin = pin return nil } diff --git a/tests/update2/aqua.yaml b/tests/update2/aqua.yaml new file mode 100644 index 000000000..7546fac47 --- /dev/null +++ b/tests/update2/aqua.yaml @@ -0,0 +1,6 @@ +registries: + - type: standard + ref: v4.293.0 # renovate: depName=aquaproj/aqua-registry +packages: + - name: golang/go + go_version_file: go.mod diff --git a/tests/update2/go.mod b/tests/update2/go.mod new file mode 100644 index 000000000..19e5c7df2 --- /dev/null +++ b/tests/update2/go.mod @@ -0,0 +1,3 @@ +module foo + +go 1.23.4 diff --git a/tests/update3/.terraform-version b/tests/update3/.terraform-version new file mode 100644 index 000000000..5ad2491cf --- /dev/null +++ b/tests/update3/.terraform-version @@ -0,0 +1 @@ +1.10.2 diff --git a/tests/update3/aqua.yaml b/tests/update3/aqua.yaml new file mode 100644 index 000000000..6ec69c501 --- /dev/null +++ b/tests/update3/aqua.yaml @@ -0,0 +1,7 @@ +registries: + - type: standard + ref: v4.293.0 # renovate: depName=aquaproj/aqua-registry +packages: + - name: hashicorp/terraform + version_expr: readFile(".terraform-version") + version_expr_prefix: v