Skip to content

Conversation

suzuki-shunsuke
Copy link
Member

@suzuki-shunsuke suzuki-shunsuke commented Feb 16, 2025

Close #3561

This pull request enables you to filter versions and assets when running aqua gr command.

Scaffold configuration file aqua-generate-registry.yaml:

aqua gr -init <package name>

aqua-generate-registry.yaml:

# yaml-language-server: $schema=https://raw.githubusercontent.com/aquaproj/aqua/main/json-schema/aqua-generate-registry.json
# aqua - Declarative CLI Version Manager
# https://aquaproj.github.io/
package: <package name>
version: not (Version matches "-rc$")
asset: not (Asset matches "-cli")

The fields version and asset are expr's expressions.

https://expr-lang.org/docs/language-definition

These expressions must return boolean.
If they return true, the version and asset are used.
Otherwise, they are ignored.

- version:
  - inputs:
    - Version: A package version
  - Available functions:
    - semver
    - semverWithVersion
- asset
  - inputs:
    - Asset: An asset name

For instance, version: not (Version matches "-rc$") excludes versions with the suffix -rc.

aqua gr -c aqua-generate-registry.yaml

Example

In this example, we create the registry for fission/fission.

  1. Generate aqua-generate-registry.yaml.
aqua gr -init fission/fission

aqua-generate-registry.yaml is generated:

---
# yaml-language-server: $schema=https://raw.githubusercontent.com/aquaproj/aqua/main/json-schema/aqua-generate-registry.json
# aqua - Declarative CLI Version Manager
# https://aquaproj.github.io/
package: fission/fission
version: not (Version matches "-rc$")
asset: not (Asset matches "-cli")
  1. Update version and asset:
---
# yaml-language-server: $schema=https://raw.githubusercontent.com/aquaproj/aqua/main/json-schema/aqua-generate-registry.json
# aqua - Declarative CLI Version Manager
# https://aquaproj.github.io/
package: fission/fission
version: Version matches "^v?\\d"
asset: not ((Asset matches "\\.json$") or (Asset matches "\\.yaml$")) # Ignore JSON and YAML
  1. Generate registry:
aqua gr -c aqua-generate-registry.yaml

Practice

I think asset should be an expression to negate.

asset: not (Asset matches "bar")

asset: Asset matches "foo"

Because Asset matches "foo" excludes assets like SHA256SUM and multiple.intoto.jsonl.
And it's hard to find the mistake.
So you should specify excluded assets explicitly.

@suzuki-shunsuke
Copy link
Member Author

@suzuki-shunsuke suzuki-shunsuke merged commit e6efa38 into main Feb 16, 2025
15 checks passed
@suzuki-shunsuke suzuki-shunsuke deleted the feat-gr-config branch February 16, 2025 12:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support generate-registry configuration file
1 participant