Skip to content

Core GitHub CLI update checker disabled due to relocation of package build variable #10242

@andyfeller

Description

@andyfeller

Describe the bug

The core update checking logic has not reported updates to users since v2.59.0 release because the updaterEnabled package variable was relocated. This package variable is set in our Homebrew formula, however the main import path no longer applies, requiring setting the new, fully qualified Go package instead:

    with_env(
      "GH_VERSION" => gh_version,
      "GO_LDFLAGS" => "-s -w -X main.updaterEnabled=cli/cli",
    ) do
      system "make", "bin/gh", "manpages"
    end
    bin.install "bin/gh"

whereas now this would be:

    with_env(
      "GH_VERSION" => gh_version,
      "GO_LDFLAGS" => "-s -w -X github.com/cli/cli/v2/internal/ghcmd.updaterEnabled=cli/cli",
    ) do
      system "make", "bin/gh", "manpages"
    end
    bin.install "bin/gh"

The main package appears to be special from what I can gather in the depths of Go cmd/link source code, however this behavior isn't well documented.

Relates #9745

Steps to reproduce the behavior

  1. Clone Homebrew formula repository

    gh repo clone homebrew/homebrew-core
  2. Install 2.58.0 version via Homebrew

    brew remove gh
    git -C homebrew-core checkout 06ce7bd256e44f9382de1b02e2a12662be994d61
    brew install ./homebrew-core/Formula/g/gh.rb
    gh version

    confirming:

    gh version 2.58.0 (2024-10-01)
    https://github.com/cli/cli/releases/tag/v2.58.0
    
  3. Clean up older state file and run gh command to generate update notice

    rm ~/.local/state/gh/state.yml
    gh pr list --state all --limit 1000 --repo cli/cli

    confirming:

    A new release of gh is available: 2.58.0 → 2.65.0
    To upgrade, run: brew upgrade gh
    https://github.com/cli/cli/releases/tag/v2.65.0
    
  4. Install 2.59.0 version via Homebrew

    brew remove gh
    git -C homebrew-core checkout 628e97421ed16b9502409891c38175167c066b6a
    brew install ./homebrew-core/Formula/g/gh.rb
    gh version

    confirming:

    gh version 2.59.0 (2024-10-15)
    https://github.com/cli/cli/releases/tag/v2.59.0
    
  5. Clean up older state file and run gh command but no update notice

    rm ~/.local/state/gh/state.yml
    gh pr list --state all --limit 1000 --repo cli/cli

Expected vs actual behavior

brew based builds should notify the user on stderr if a new release is present.

Logs

Paste the activity from your command line. Redact if needed.

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingcoreThis issue is not accepting PRs from outside contributorsp2Affects more than a few users but doesn't prevent core functionspackaging

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions