Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support omitting {{.Format}} in Asset and provide the variable AssetWithoutExt #1774

Closed
suzuki-shunsuke opened this issue Mar 19, 2023 · 7 comments · Fixed by #1853
Closed
Labels
enhancement New feature or request
Milestone

Comments

@suzuki-shunsuke
Copy link
Member

Feature Overview

Support omitting {{.Format}} in Asset and provide the variable AssetWithoutExt

Why is the feature needed?

Please explain the problem you want to solve.

To make the configuration simple.
This is useful when the format is changed from raw to tar.gz or something.

Does the feature include Breaking Changes?

No.

Example Code

command and configuration

Example 1.

AS IS

    asset: aks-engine-{{.Version}}-{{.OS}}-{{.Arch}}.tar.gz
    files:
      - name: aks-engine
        src: aks-engine-{{.Version}}-{{.OS}}-{{.Arch}}/aks-engine

TO BE

    asset: aks-engine-{{.Version}}-{{.OS}}-{{.Arch}}
    format: tar.gz
    files:
      - name: aks-engine
        src: {{.AssetWithoutExt}}/aks-engine

Example 2.

AS IS

    asset: kalker-{{.OS}}.{{.Format}}
    format: zip
    overrides:
      - goos: linux
        format: raw
        asset: kalker-{{.OS}}

TO BE

    asset: kalker-{{.OS}}
    format: zip
    overrides:
      - goos: linux
        format: raw
@suzuki-shunsuke suzuki-shunsuke added the enhancement New feature or request label Mar 19, 2023
@suzuki-shunsuke
Copy link
Member Author

suzuki-shunsuke commented Apr 10, 2023

  • If format is set and the suffix of the rendered asset is different from format, add the suffix format
  • Add the template variable AssetWithoutExt
if format != "raw" && format != "" && ! strings.HasSuffix(asset, fmt.Sprintf(".%s", format)) {
  asset = fmt.Sprintf("%s.%s", asset, format)
}
if format == "raw" {
  AssetWithoutExt := asset
} else {
  AssetWithoutExt := strings.TrimSuffix(asset, fmt.Sprintf(".%s", format))
}

@suzuki-shunsuke
Copy link
Member Author

@suzuki-shunsuke
Copy link
Member Author

suzuki-shunsuke commented Apr 11, 2023

aristocratos/btop

ERRO[0096] install the package                           aqua_version= env=darwin/arm64 error="the asset isn't found: btop-arm64-macos-monterey.tbz.tar.bz2" package_name=aristocratos/btop package_version=v1.2.13 program=aqua registry=standard
ERRO[0097] install the package                           aqua_version= env=darwin/arm64 error="the asset isn't found: btop-arm64-macos-monterey.tbz.tar.bz2" package_name=aristocratos/btop package_version=v1.2.12 program=aqua registry=standard

@suzuki-shunsuke
Copy link
Member Author

Hmm. This is a breaking change.

ERRO[0145] install the package                           aqua_version= env=darwin/arm64 error="the asset isn't found: btop-arm64-macos-monterey.tbz.tar.bz2" package_name=aristocratos/btop package_version=v1.2.12 program=aqua registry=standard

https://github.com/aquaproj/aqua-registry/blob/ac164cfd68015be9ea44deb5215f9260fe9ccbcf/pkgs/aristocratos/btop/registry.yaml

packages:
  - type: github_release
    repo_owner: aristocratos
    repo_name: btop
    description: A monitor of resources
    asset: btop-{{.Arch}}-{{.OS}}.tbz
    format: tar.bz2
    supported_envs:
      - darwin
      - linux
    replacements:
      linux: linux-musl
      darwin: macos-monterey
      amd64: x86_64
    overrides:
      - goos: linux
        replacements:
          arm64: aarch64
    version_constraint: semver(">= 1.2.13")
    files:
      - name: btop
        src: btop/bin/btop
    version_overrides:
      - version_constraint: "true"
        files:
          - name: btop
            src: bin/btop

@suzuki-shunsuke
Copy link
Member Author

Hmm. This is a breaking change.

Resolved. aabaf21

@suzuki-shunsuke
Copy link
Member Author

suzuki-shunsuke commented Oct 7, 2023

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
No open projects
Status: Done
1 participant