Skip to content

gh should only recognize GHES 3.16 or older as supporting v1 classic projects #10716

@williammartin

Description

@williammartin

Description

Currently, gh determines whether v1 classic projects are supported based on the type of host (GitHub.com, ghe.com, GHES). This logic needs to be enhanced as v1 classic projects were deprecated in GHES 3.17 (ETA June 3rd), so only GHES 3.16 or older can continue using it.

func (d *detector) ProjectsV1() gh.ProjectsV1Support {
// Currently, projects v1 support is entirely dependent on the host. As this is deprecated in GHES,
// we will do feature detection on whether the GHES version has support.
if ghauth.IsEnterprise(d.host) {
return gh.ProjectsV1Supported
}
return gh.ProjectsV1Unsupported
}

Normally, gh would use GraphQL introspection for feature detection, using the presence of projectCards field. Unfortunately, there are inconsistencies around projectCards in GraphQL schema that make this complicated:

  • GHES 3.17.0 will drop projectCards
  • GitHub.com and ghe.com will show projectCards but return empty results for backwards compatibility with older gh releases

Instead, the v1 classic project feature detection should be enhanced to use GHES version from /api/v3/meta REST endpoint to determine support:

{
  "verifiable_password_authentication": false,
  "installed_version": "3.17.0"
}

Note

There has been some spike efforts using the work in trunk...andyfeller/github-cli-867-ghes-meta-version-featuredetection to explore this issue that may be reused.

Expected outcomes

Acceptance Criteria

  1. Given I am targeting GHES 3.16.x repository with v1 and v2 projects
    When I interactively execute gh issue create command and add metadata
    Then v1 and v2 projects are listed for selection

    $ gh issue create --repo andyfeller-0ee0571e6658472ea.qaboot.net/ghe-admin/v1-repo-projects
     
    Creating issue in ghe-admin/v1-repo-projects
     
    ? Title (required) Just an issue title
    ? Body <Received>
    ? What's next? Add metadata
    ? What would you like to add? Projects
    Working...
    ? Projects  [Use arrows to move, space to select, <right> to all, <left> to none, type to filter]
    > [ ]  v1 UI created project
      [ ]  v1 project
      [ ]  v1 project
      [ ]  v2 team planning
  2. Given I am targeting GHES 3.16.x repository issue that is on a v1 and v2 project
    When I execute gh issue view NUMBER_OR_URL --json projectCards,projectItems command
    Then gh will export v1 and v2 projects as projectCards and projectItems respectively

    $ bin/gh issue view https://andyfeller-0ee0571e6658472ea.qaboot.net/ghe-admin/v1-repo-projects/issues/4 --json projectCards,projectItems
     
    Working...
    {
      "projectCards": [
        {
          "project": {
            "name": "v1 UI created project"
          },
          "column": {
            "name": ""
          }
        },
        {
          "project": {
            "name": "v1 project"
          },
          "column": {
            "name": ""
          }
        }
      ],
      "projectItems": [
        {
          "status": {
            "optionId": "",
            "name": ""
          },
          "title": "v2 team planning"
        }
      ]
    }
  3. Given I am targeting GHES 3.17.0 repository issue that is on a v2 project
    When I execute gh issue view NUMBER_OR_URL --json projectCards,projectItems command
    Then gh will export v2 projects as projectItems while projectCards is empty

    $ gh issue view https://ghe.io/andyfeller/v1-repo-projects/issues/1 --json projectCards,projectItems
    Working...
    {
      "projectCards": [],
      "projectItems": [
        {
          "status": {
            "optionId": "",
            "name": ""
          },
          "title": "v2 team planning"
        }
      ]
    }
  4. Given I am targeting GitHub.com repository issue that is on a v2 project
    When I interactively execute gh issue create command and add metadata
    Then v2 projects are listed for selection

    $ gh issue create --repo cli/cli   
    
    Creating issue in cli/cli
    
    ? Title (required) Just a title
    ? Choose a template Open a blank issue
    ? Body <Received>
    ? What's next? Add metadata
    ? What would you like to add? Projects
    Working...
    ? Projects  [Use arrows to move, space to select, <right> to all, <left> to none, type to filter]
    > [ ]  Enhancement Triage
      [ ]  Help Wanted Backlog
      [ ]  Roadmap
      [ ]  andyfeller.github.io
      [ ]  All Issues & PRs
  5. Given I am targeting GitHub.com repository issue that is on a v2 project
    When I execute gh issue view NUMBER_OR_URL --json projectCards,projectItems command
    Then gh will export v2 projects as projectItems while projectCards is empty

    $ gh issue view https://github.com/cli/cli/issues/10704 --json projectCards,projectItems 
    Working...
    {
      "projectCards": [],
      "projectItems": [
        {
          "status": {
            "optionId": "046342ef",
            "name": "Inbox"
          },
          "title": "All Issues & PRs"
        }
      ]
    }
  6. Given I am targeting ghe.com repository issue that is on a v2 project
    When I interactively execute gh issue view NUMBER_OR_URL command
    Then gh will export v2 projects as projectItems while projectCards is empty

    $ gh issue view https://github.ghe.com/andyfeller/gh-p/issues/1 --json projectCards,projectItems
    Working...
    {
      "projectCards": [],
      "projectItems": [
        {
          "status": {
            "optionId": "",
            "name": ""
          },
          "title": "v2 team planning"
        }
      ]
    }

Example of GHES 3.16.6 repository with v1 and v2 projects

Image Image

Metadata

Metadata

Assignees

Labels

enhancementa request to improve CLIgh-issuerelating to the gh issue commandgh-prrelating to the gh pr commandneeds-designAn engineering task needs design to proceed

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions