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

scaffold command adds an unneeded newline at the end of output #276

Closed
suzuki-shunsuke opened this issue Feb 2, 2023 · 4 comments · Fixed by #279
Closed

scaffold command adds an unneeded newline at the end of output #276

suzuki-shunsuke opened this issue Feb 2, 2023 · 4 comments · Fixed by #279
Labels
bug Something isn't working
Milestone

Comments

@suzuki-shunsuke
Copy link
Member

How to reproduce

$ aqua-registry -v
aqua-registry version 0.1.6 (291d904ed1c7b8954068c1dada00dfc7353dd7ae)

$ aqua -v
aqua version 1.32.2 (4f892abd43f2781d1252f794072d59a64a369857)
$ aqua-registry scaffold soh335/shukujitsu
packages:
  - type: github_release
    repo_owner: soh335
    repo_name: shukujitsu
    asset: shukujitsu_{{trimV .Version}}_{{.OS}}_{{.Arch}}.tar.gz
    supported_envs:
      - linux
      - darwin
    checksum:
      type: github_release
      asset: checksums.txt
      file_format: regexp
      algorithm: sha256
      pattern:
        checksum: "^(\\b[A-Fa-f0-9]{64}\\b)"
        file: "^\\b[A-Fa-f0-9]{64}\\b\\s+(\\S+)$"
# unnecessary newline
@suzuki-shunsuke
Copy link
Member Author

aqua gr doesn't add a newline.

aqua gr soh335/shukujitsu > test.yaml
packages:
  - type: github_release
    repo_owner: soh335
    repo_name: shukujitsu
    asset: shukujitsu_{{trimV .Version}}_{{.OS}}_{{.Arch}}.tar.gz
    supported_envs:
      - linux
      - darwin
    checksum:
      type: github_release
      asset: checksums.txt
      file_format: regexp
      algorithm: sha256
      pattern:
        checksum: "^(\\b[A-Fa-f0-9]{64}\\b)"
        file: "^\\b[A-Fa-f0-9]{64}\\b\\s+(\\S+)$"

@suzuki-shunsuke
Copy link
Member Author

I found the cause.

if err := patchchecksum.PatchChecksum(ctx, logE, rgFilePath); err != nil {
return fmt.Errorf("patch the checksum config: %w", err)
}

if err := os.WriteFile(configFilePath, []byte(file.String()+"\n"), 0o644); err != nil { //nolint:gosec,gomnd

@suzuki-shunsuke
Copy link
Member Author

I think PatchChecksum isn't needed anymore, because this is for old aqua.
When we released checksum verification, we expected users use old aqua which didn't support checksum verification, so we patched checksum settings in registry-tool.
registry-tool is managed by aqua, so we can force users to update registry-tool automatically.

The drawback of PatchChecksum is that we have to maintain this function.

@suzuki-shunsuke
Copy link
Member Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant