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

Create a Homebrew formula for Notation CLI #571

Closed
FeynmanZhou opened this issue Feb 27, 2023 · 17 comments
Closed

Create a Homebrew formula for Notation CLI #571

FeynmanZhou opened this issue Feb 27, 2023 · 17 comments
Assignees
Labels
enhancement New feature or request good first issue Good for newcomers
Milestone

Comments

@FeynmanZhou
Copy link
Member

What is the areas you would like to add the new feature to?

Notation CLI

Is your feature request related to a problem?

This feature request is derived from the Notary v2 roadmap, notaryproject/roadmap#76.

To simplify the Notation CLI installation experience, we need to consider providing a native installation package on macOS or another Linux distro, that allows users to install Notation CLI via a simple command like brew install notation.

Uninstallation and upgrading are not confirmed in this program yet. We need to discuss if these two functionalities should be included in this .msi installer or not.

What solution do you propose?

Write this brew formula using Ruby and add it to Homebrew-core. Follow the guideline of https://docs.brew.sh/Adding-Software-to-Homebrew to complete this submission.

What alternatives have you considered?

None

Any additional context?

No response

@FeynmanZhou
Copy link
Member Author

FeynmanZhou commented Feb 27, 2023

Homebrew only allows accepting a stable release package and any alpha/RC release is not acceptable. So we still need to defer this implementation until a stable Notation CLI v1.0.0 release is available, which is mid of Apr. Just moved it from RC.3 to v1.0.0

@yizha1 yizha1 removed the triage Need to triage label Apr 26, 2023
@yizha1 yizha1 moved this from Todo to Hold-Blocked in Notary Project Planning Board May 19, 2023
@FeynmanZhou
Copy link
Member Author

Hi @mintbomb27, we plan to cut the Notation v1.0.0 release around 1 week. Are you still interested in creating a Homebrew formula for Notation?

@mintbomb27
Copy link
Contributor

mintbomb27 commented Jun 5, 2023

Yes! Where shall I add it to? Should I directly put a PR with homebrew-core? How should I get it reviewed by you?

@yizha1 yizha1 moved this from Hold-Blocked to Todo in Notary Project Planning Board Jun 5, 2023
@FeynmanZhou
Copy link
Member Author

FeynmanZhou commented Jun 8, 2023

@mintbomb27 Thanks! Assigned this issue to you. I think you will need to follow https://docs.brew.sh/Formula-Cookbook and submit a PR to add Notation v1.0.0 in https://github.com/Homebrew/homebrew-core. We will inform you when Notation v1.0.0 is available next week

@mintbomb27
Copy link
Contributor

@FeynmanZhou So I tried creating the formula for the rc7 release, and it will look like:

class Notation < Formula
  desc "CLI tool to sign and verify OCI artifacts and container images"
  homepage "https://notaryproject.dev/"
  url "https://github.com/notaryproject/notation/archive/refs/tags/v1.0.0-rc.7.tar.gz"
  sha256 "a7ea851b7bc85d65316ceda61ecb99b4cfb179d4feeb52f4ba1fcfd0784ccbcc"
  license "Apache-2.0"
  head "https://github.com/notaryproject/notation", branch: "main"

  depends_on "go" => :build

  def install
    ENV["CGO_ENABLED"] = "0"
    project = "github.com/notaryproject/notation"
    ldflags = %W[
      -s -w
      -X #{project}/internal/version.Version=v#{version} 
      -X #{project}/internal/version.BuildMetadata=
    ]
    system "go", "build", *std_go_args(output: bin/"notation", ldflags: ldflags), "./cmd/notation"
  end

  test do
    notation_version = shell_output("#{bin}/notation version | awk 'FNR==3{printf $2}'")
    assert_equal "v#{version}", notation_version
  end
end

In the ldflags, Is it necessary to add the /internal/version.GitCommit flag as well? I'll have to set the url to the git repo instead of the source tarball and get it from it then.

@iamsamirzon
Copy link
Contributor

@yizha1 - Can you move it to another milestone after 1.0.0? This cannot be done in 1.0.0 because Hombrew does not accept RC releases

@yizha1
Copy link
Contributor

yizha1 commented Jun 9, 2023

@iamsamirzon which milestone do you suggest? Since it needs to be done right after 1.0.0 release, if we remove it, it seems not easy to be tracked.

@mintbomb27
Copy link
Contributor

@FeynmanZhou @yizha1 Now that v1.0.0 is released, can you take a look at the above Homebrew formula? I'll go ahead and create the PR at Homebrew/homebrew-core soon.

@FeynmanZhou
Copy link
Member Author

@mintbomb27 Thanks for your support. Could you pls help raise a PR to add Notation at Homebrew/homebrew-core?

@mintbomb27
Copy link
Contributor

Done at Homebrew/homebrew-core#139873

@mintbomb27
Copy link
Contributor

@FeynmanZhou @shizhMSFT @yizha1 Would be great if anyone could approve the PR there so that it could be merged.

@shizhMSFT
Copy link
Contributor

@FeynmanZhou @shizhMSFT @yizha1 Would be great if anyone could approve the PR there so that it could be merged.

@mintbomb27 I've reviewed the PR again and left some comments there.

@yizha1 yizha1 moved this from Todo to PR Review in Notary Project Planning Board Aug 23, 2023
@shizhMSFT
Copy link
Contributor

@mintbomb27 The output of notation version is not desired as it prints

# notation version
notation version
Notation - a tool to sign and verify artifacts.

Version:     v1.0.0+Homebrew
Go version:  go1.21.0
Git commit:  Homebrew

Could you follow Homebrew/homebrew-core#139873 (comment) and send out a PR to fix it?

@mintbomb27
Copy link
Contributor

Yes, I didn't make that change. @chenrui333 did. But what was the problem with the Utils.git_short_head? It actually had the git commit right?

@yizha1
Copy link
Contributor

yizha1 commented Sep 5, 2023

@FeynmanZhou Can we close this issue and create a new issue to track the problem mentioned by Shiwei

@FeynmanZhou
Copy link
Member Author

FeynmanZhou commented Sep 12, 2023

Yes, I didn't make that change. @chenrui333 did. But what was the problem with the Utils.git_short_head? It actually had the git commit right?

@mintbomb27 Thank you. The commit info should be included in the Notation Homebrew output. Do you agree with closing this issue and continuing to work on adding the commit info to the Notation Homebrew output in another issue? Feel free to comment on this issue if you are interested in the follow-up issue #778

@mintbomb27
Copy link
Contributor

mintbomb27 commented Sep 12, 2023

Sure I can take it up. This may be closed.

@yizha1 yizha1 closed this as completed Sep 18, 2023
@github-project-automation github-project-automation bot moved this from PR Review to Done in Notary Project Planning Board Sep 18, 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 good first issue Good for newcomers
Projects
Status: Done
Development

No branches or pull requests

5 participants