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

feat: support using go_install or go_build if the asset for the platform isn't released in GitHub Releases #2317

Merged
merged 4 commits into from
Oct 8, 2023

Conversation

suzuki-shunsuke
Copy link
Member

@suzuki-shunsuke suzuki-shunsuke commented Oct 7, 2023

Close #2132

Features

This pull request adds a new field build to Registry settings.
This enables to install packages by go_install or go_build on platforms where prebuilt binaries aren't published.

Example

This is an example usage of the new field build.

packages:
  - type: github_release
    repo_owner: suzuki-shunsuke
    repo_name: tfcmt
    asset: tfcmt_{{.OS}}_{{.Arch}}.{{.Format}}
    format: tar.gz
    supported_envs:
      - linux
    build:
      type: go_build
      files:
        - name: tfcmt
          src: ./cmd/tfcmt
          dir: tfcmt-{{trimV .Version}}

supported_envs is linux because prebuilt binaries are published only for linux.
On platforms other than supported_envs, aqua installs tfcmt by go_build.

go_install is also available.

    build:
      type: go_install
      path: github.com/suzuki-shunsuke/tfcmt/v4/cmd/tfcmt

If go_build failed on windows/arm64 and we'd like to exclude windows/arm64, excluded_envs is available.

    build:
      type: go_build
      excluded_envs:
        - windows/arm64
      files:
        - name: tfcmt
          src: ./cmd/tfcmt
          dir: tfcmt-{{trimV .Version}}

If we'd like to disable build in version_overrides, enabled is available.

build:
  enabled: false

Why not overrides?

Of course, we can do the same thing with overrides.

packages:
  - type: go_build
    repo_owner: suzuki-shunsuke
    repo_name: tfcmt
    files:
      - name: tfcmt
        src: ./cmd/tfcmt
        dir: tfcmt-{{trimV .Version}}    
    overrides:
      - goos: linux
        type: github_release
        asset: tfcmt_{{.OS}}_{{.Arch}}.{{.Format}}
        format: tar.gz
        files:
          - name: tfcmt

This example has only one element in overrides, but if overrides has multiple elements, build makes the code simpler.
And build makes the intension clearer.

@suzuki-shunsuke suzuki-shunsuke added the enhancement New feature or request label Oct 7, 2023
@suzuki-shunsuke suzuki-shunsuke added this to the v2.13.0 milestone Oct 7, 2023
@suzuki-shunsuke suzuki-shunsuke enabled auto-merge (squash) October 8, 2023 01:33
@suzuki-shunsuke suzuki-shunsuke merged commit 6a1fa48 into main Oct 8, 2023
9 checks passed
@suzuki-shunsuke suzuki-shunsuke deleted the feat-support-build branch October 8, 2023 01:33
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
None yet
Development

Successfully merging this pull request may close these issues.

Install packages by cargo or go_install if the asset for the platform isn't released in GitHub Releases
1 participant