Skip to content

[Feature] Query Sourcecraft for existing packages #30

Description

@atandrewlee

Potential Solution

Example bin_find: https://api.staging.snapcraft.io/v2/bins/find?q=yaml

{
  "results": [
    {
      "name": "go-github-go-yaml-yaml-v3",
      "package-id": "7zMriCxPLPEK02xfQSLvSTWHZhORfZXg"
    },
    {
      "name": "0xnishit-go-gopkg-yaml-v3",
      "package-id": "2nJEdAfseayaapeGGKi5iANSgogA5UNz"
...
  ]
}

Example bin_info: https://api.staging.snapcraft.io/v2/bins/info/0xnishit-go-gopkg-yaml-v3?fields=channel-map

{
  "channel-map": [
    {
      "channel": {
        "name": "latest/edge",
        "platform": {
          "architecture": "amd64",
          "channel": "24.04",
          "name": "ubuntu"
        },
        "released-at": "2025-04-29T10:40:05.658127+00:00",
        "risk": "edge",
        "track": "latest"
      }
    }
  ],
  "default-track": null,
  "name": "0xnishit-go-gopkg-yaml-v3",
  "package-id": "2nJEdAfseayaapeGGKi5iANSgogA5UNz"
}

Algorithm

  1. Search for the package using bin_find (or go straight to step 2)
  2. Use bin_info
    • 400 Error >> Resource Not Found
    • 200 >> We get the channel information >> get the name (check that it matches)

If matches, we have the package name & name of the channel + platform
If not, we know we have to onboard this

This step should be done during init

What Protocol We Need

  • Standard Naming Convention >> elts-<NAME-OF-PACKAGE>
  • We want to make sure name of package & repo is the same

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions