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

feat: adds github remote registry index #226

Merged
merged 6 commits into from
Jun 13, 2024

Conversation

kjuulh
Copy link
Contributor

@kjuulh kjuulh commented Jan 26, 2024

This pr adds everything required for pushing an extension to and upstream registry, currently only github is supported.

It contains quite a lot of code, and is a bit crufty, maybe a proper github sdk should be used instead of raw http calls. But it works using shuttle ext publish

Builds on: #225

@github-actions github-actions bot added the minor label Jan 26, 2024
@kjuulh kjuulh self-assigned this Jun 7, 2024
@kjuulh kjuulh marked this pull request as ready for review June 7, 2024 11:48
@kjuulh kjuulh requested a review from a team as a code owner June 7, 2024 11:48
cmd/ext.go Show resolved Hide resolved
internal/extensions/downloader.go Outdated Show resolved Hide resolved
internal/extensions/downloader.go Outdated Show resolved Hide resolved
internal/extensions/extensions.go Outdated Show resolved Hide resolved
internal/extensions/github_registry.go Outdated Show resolved Hide resolved
internal/extensions/github_registry.go Outdated Show resolved Hide resolved
internal/extensions/github_registry.go Outdated Show resolved Hide resolved
internal/extensions/github_registry.go Outdated Show resolved Hide resolved
internal/extensions/github_registry.go Show resolved Hide resolved
Signed-off-by: Kasper J. Hermansen <contact@kjuulh.io>
Signed-off-by: Kasper J. Hermansen <contact@kjuulh.io>
Signed-off-by: Kasper J. Hermansen <contact@kjuulh.io>
Signed-off-by: Kasper J. Hermansen <contact@kjuulh.io>
@kjuulh kjuulh force-pushed the feat/with-github-registry branch from 9eabf2b to dea7d01 Compare June 13, 2024 11:02
Signed-off-by: Kasper J. Hermansen <contact@kjuulh.io>
Signed-off-by: Kasper J. Hermansen <contact@kjuulh.io>
@kjuulh kjuulh merged commit 3e6ac37 into feat/add-execute-command Jun 13, 2024
2 checks passed
@kjuulh kjuulh deleted the feat/with-github-registry branch June 13, 2024 12:53
kjuulh added a commit that referenced this pull request Jun 13, 2024
* feat(extensions): add execute command

this adds Extensions to the global cmd.go resulting in another section showing up when doing a shuttle --help

To execute an extension simply shuttle myExtension where myExtension is the name of the downloaded extension. All args are passed to the child as well

Signed-off-by: Kasper J. Hermansen <contact@kjuulh.io>

* feat: remember to add error

Signed-off-by: Kasper J. Hermansen <contact@kjuulh.io>

* feat: without empty line

Signed-off-by: Kasper J. Hermansen <contact@kjuulh.io>

* feat: adds github remote registry index (#226)

* feat: with github registry

Signed-off-by: Kasper J. Hermansen <contact@kjuulh.io>

* fix: shuttle extensions

Signed-off-by: Kasper J. Hermansen <contact@kjuulh.io>

* feat: can download private files

Signed-off-by: Kasper J. Hermansen <contact@kjuulh.io>

* feat: remove fluff

Signed-off-by: Kasper J. Hermansen <contact@kjuulh.io>

* feat: fix review comments

Signed-off-by: Kasper J. Hermansen <contact@kjuulh.io>

* feat: it needs to implement the functions

Signed-off-by: Kasper J. Hermansen <contact@kjuulh.io>

---------

Signed-off-by: Kasper J. Hermansen <contact@kjuulh.io>

---------

Signed-off-by: Kasper J. Hermansen <contact@kjuulh.io>
kjuulh added a commit that referenced this pull request Jun 13, 2024
* feat(extensions): add github release downloader

This specifically adds a downloader for github releases it uses either the

SHUTTLE_EXTENSIONS_GITHUB_ACCESS_TOKEN or GITHUB_ACCESS_TOKEN for access to the releases

The downloader expects a full url from the registry as seen in a previous pr

Signed-off-by: Kasper J. Hermansen <contact@kjuulh.io>

* chore: reword bearer

Signed-off-by: Kasper J. Hermansen <contact@kjuulh.io>

* feat(extensions): add execute command (#225)

* feat(extensions): add execute command

this adds Extensions to the global cmd.go resulting in another section showing up when doing a shuttle --help

To execute an extension simply shuttle myExtension where myExtension is the name of the downloaded extension. All args are passed to the child as well

Signed-off-by: Kasper J. Hermansen <contact@kjuulh.io>

* feat: remember to add error

Signed-off-by: Kasper J. Hermansen <contact@kjuulh.io>

* feat: without empty line

Signed-off-by: Kasper J. Hermansen <contact@kjuulh.io>

* feat: adds github remote registry index (#226)

* feat: with github registry

Signed-off-by: Kasper J. Hermansen <contact@kjuulh.io>

* fix: shuttle extensions

Signed-off-by: Kasper J. Hermansen <contact@kjuulh.io>

* feat: can download private files

Signed-off-by: Kasper J. Hermansen <contact@kjuulh.io>

* feat: remove fluff

Signed-off-by: Kasper J. Hermansen <contact@kjuulh.io>

* feat: fix review comments

Signed-off-by: Kasper J. Hermansen <contact@kjuulh.io>

* feat: it needs to implement the functions

Signed-off-by: Kasper J. Hermansen <contact@kjuulh.io>

---------

Signed-off-by: Kasper J. Hermansen <contact@kjuulh.io>

---------

Signed-off-by: Kasper J. Hermansen <contact@kjuulh.io>

---------

Signed-off-by: Kasper J. Hermansen <contact@kjuulh.io>
kjuulh added a commit that referenced this pull request Jun 13, 2024
* "feat(extensions): add install extensions from registry

This pr includes everything up to actually downloading the extension from the upstream registry

Such as pulling an example registry entry

```json
{
  "name": "SuperExtender",
  "description": "Enhances your experience with superpowers.",
  "version": "1.0.3",
  "downloadUrls": [
    {
      "architecture": "amd64",
      "os": "linux",
      "url": "https://example.com/linux/amd64/superextender.tar.gz",
      "checksum": "efgh5678"
    },
    {
      "architecture": "x86",
      "os": "windows",
      "url": "https://example.com/windows/x86/superextender.zip",
      "checksum": "ijkl91011"
    },
    {
      "architecture": "arm64",
      "os": "darwin",
      "url": "https://example.com/windows/x86/superextender.zip",
      "checksum": "ijkl91011"
    }
  ]
}
```

Which will match on the current os using $GOOS and $GOARCH set by golang itself. We may however have to depend on some other variables if go is not installed by I believe it should work anyway"

* feat: print error

Signed-off-by: Kasper J. Hermansen <contact@kjuulh.io>

* fix: review comments, wording etc.

Signed-off-by: Kasper J. Hermansen <contact@kjuulh.io>

* feat(extensions): add github release downloader (#224)

* feat(extensions): add github release downloader

This specifically adds a downloader for github releases it uses either the

SHUTTLE_EXTENSIONS_GITHUB_ACCESS_TOKEN or GITHUB_ACCESS_TOKEN for access to the releases

The downloader expects a full url from the registry as seen in a previous pr

Signed-off-by: Kasper J. Hermansen <contact@kjuulh.io>

* chore: reword bearer

Signed-off-by: Kasper J. Hermansen <contact@kjuulh.io>

* feat(extensions): add execute command (#225)

* feat(extensions): add execute command

this adds Extensions to the global cmd.go resulting in another section showing up when doing a shuttle --help

To execute an extension simply shuttle myExtension where myExtension is the name of the downloaded extension. All args are passed to the child as well

Signed-off-by: Kasper J. Hermansen <contact@kjuulh.io>

* feat: remember to add error

Signed-off-by: Kasper J. Hermansen <contact@kjuulh.io>

* feat: without empty line

Signed-off-by: Kasper J. Hermansen <contact@kjuulh.io>

* feat: adds github remote registry index (#226)

* feat: with github registry

Signed-off-by: Kasper J. Hermansen <contact@kjuulh.io>

* fix: shuttle extensions

Signed-off-by: Kasper J. Hermansen <contact@kjuulh.io>

* feat: can download private files

Signed-off-by: Kasper J. Hermansen <contact@kjuulh.io>

* feat: remove fluff

Signed-off-by: Kasper J. Hermansen <contact@kjuulh.io>

* feat: fix review comments

Signed-off-by: Kasper J. Hermansen <contact@kjuulh.io>

* feat: it needs to implement the functions

Signed-off-by: Kasper J. Hermansen <contact@kjuulh.io>

---------

Signed-off-by: Kasper J. Hermansen <contact@kjuulh.io>

---------

Signed-off-by: Kasper J. Hermansen <contact@kjuulh.io>

---------

Signed-off-by: Kasper J. Hermansen <contact@kjuulh.io>

---------

Signed-off-by: Kasper J. Hermansen <contact@kjuulh.io>
kjuulh added a commit that referenced this pull request Jun 13, 2024
* feat(extensions): with git operations

Quite simply implements fetch and clone to make sure we can pull a registry

Signed-off-by: Kasper J. Hermansen <contact@kjuulh.io>

* feat: add git registry

Signed-off-by: Kasper J. Hermansen <contact@kjuulh.io>

* feat(extensions): add install extensions from registry (#223)

* "feat(extensions): add install extensions from registry

This pr includes everything up to actually downloading the extension from the upstream registry

Such as pulling an example registry entry

```json
{
  "name": "SuperExtender",
  "description": "Enhances your experience with superpowers.",
  "version": "1.0.3",
  "downloadUrls": [
    {
      "architecture": "amd64",
      "os": "linux",
      "url": "https://example.com/linux/amd64/superextender.tar.gz",
      "checksum": "efgh5678"
    },
    {
      "architecture": "x86",
      "os": "windows",
      "url": "https://example.com/windows/x86/superextender.zip",
      "checksum": "ijkl91011"
    },
    {
      "architecture": "arm64",
      "os": "darwin",
      "url": "https://example.com/windows/x86/superextender.zip",
      "checksum": "ijkl91011"
    }
  ]
}
```

Which will match on the current os using $GOOS and $GOARCH set by golang itself. We may however have to depend on some other variables if go is not installed by I believe it should work anyway"

* feat: print error

Signed-off-by: Kasper J. Hermansen <contact@kjuulh.io>

* fix: review comments, wording etc.

Signed-off-by: Kasper J. Hermansen <contact@kjuulh.io>

* feat(extensions): add github release downloader (#224)

* feat(extensions): add github release downloader

This specifically adds a downloader for github releases it uses either the

SHUTTLE_EXTENSIONS_GITHUB_ACCESS_TOKEN or GITHUB_ACCESS_TOKEN for access to the releases

The downloader expects a full url from the registry as seen in a previous pr

Signed-off-by: Kasper J. Hermansen <contact@kjuulh.io>

* chore: reword bearer

Signed-off-by: Kasper J. Hermansen <contact@kjuulh.io>

* feat(extensions): add execute command (#225)

* feat(extensions): add execute command

this adds Extensions to the global cmd.go resulting in another section showing up when doing a shuttle --help

To execute an extension simply shuttle myExtension where myExtension is the name of the downloaded extension. All args are passed to the child as well

Signed-off-by: Kasper J. Hermansen <contact@kjuulh.io>

* feat: remember to add error

Signed-off-by: Kasper J. Hermansen <contact@kjuulh.io>

* feat: without empty line

Signed-off-by: Kasper J. Hermansen <contact@kjuulh.io>

* feat: adds github remote registry index (#226)

* feat: with github registry

Signed-off-by: Kasper J. Hermansen <contact@kjuulh.io>

* fix: shuttle extensions

Signed-off-by: Kasper J. Hermansen <contact@kjuulh.io>

* feat: can download private files

Signed-off-by: Kasper J. Hermansen <contact@kjuulh.io>

* feat: remove fluff

Signed-off-by: Kasper J. Hermansen <contact@kjuulh.io>

* feat: fix review comments

Signed-off-by: Kasper J. Hermansen <contact@kjuulh.io>

* feat: it needs to implement the functions

Signed-off-by: Kasper J. Hermansen <contact@kjuulh.io>

---------

Signed-off-by: Kasper J. Hermansen <contact@kjuulh.io>

---------

Signed-off-by: Kasper J. Hermansen <contact@kjuulh.io>

---------

Signed-off-by: Kasper J. Hermansen <contact@kjuulh.io>

---------

Signed-off-by: Kasper J. Hermansen <contact@kjuulh.io>

---------

Signed-off-by: Kasper J. Hermansen <contact@kjuulh.io>
kjuulh added a commit that referenced this pull request Jun 13, 2024
* feat: add registry and global storage

Signed-off-by: Kasper J. Hermansen <contact@kjuulh.io>

* feat: remove bullet

Signed-off-by: Kasper J. Hermansen <contact@kjuulh.io>

* feat: remember to initiate install

Signed-off-by: Kasper J. Hermansen <contact@kjuulh.io>

* feat: make sure to check permissions

Signed-off-by: Kasper J. Hermansen <contact@kjuulh.io>

* chore: make registry private

Signed-off-by: Kasper J. Hermansen <contact@kjuulh.io>

* feat(extensions): with git operations (#222)

* feat(extensions): with git operations

Quite simply implements fetch and clone to make sure we can pull a registry

Signed-off-by: Kasper J. Hermansen <contact@kjuulh.io>

* feat: add git registry

Signed-off-by: Kasper J. Hermansen <contact@kjuulh.io>

* feat(extensions): add install extensions from registry (#223)

* "feat(extensions): add install extensions from registry

This pr includes everything up to actually downloading the extension from the upstream registry

Such as pulling an example registry entry

```json
{
  "name": "SuperExtender",
  "description": "Enhances your experience with superpowers.",
  "version": "1.0.3",
  "downloadUrls": [
    {
      "architecture": "amd64",
      "os": "linux",
      "url": "https://example.com/linux/amd64/superextender.tar.gz",
      "checksum": "efgh5678"
    },
    {
      "architecture": "x86",
      "os": "windows",
      "url": "https://example.com/windows/x86/superextender.zip",
      "checksum": "ijkl91011"
    },
    {
      "architecture": "arm64",
      "os": "darwin",
      "url": "https://example.com/windows/x86/superextender.zip",
      "checksum": "ijkl91011"
    }
  ]
}
```

Which will match on the current os using $GOOS and $GOARCH set by golang itself. We may however have to depend on some other variables if go is not installed by I believe it should work anyway"

* feat: print error

Signed-off-by: Kasper J. Hermansen <contact@kjuulh.io>

* fix: review comments, wording etc.

Signed-off-by: Kasper J. Hermansen <contact@kjuulh.io>

* feat(extensions): add github release downloader (#224)

* feat(extensions): add github release downloader

This specifically adds a downloader for github releases it uses either the

SHUTTLE_EXTENSIONS_GITHUB_ACCESS_TOKEN or GITHUB_ACCESS_TOKEN for access to the releases

The downloader expects a full url from the registry as seen in a previous pr

Signed-off-by: Kasper J. Hermansen <contact@kjuulh.io>

* chore: reword bearer

Signed-off-by: Kasper J. Hermansen <contact@kjuulh.io>

* feat(extensions): add execute command (#225)

* feat(extensions): add execute command

this adds Extensions to the global cmd.go resulting in another section showing up when doing a shuttle --help

To execute an extension simply shuttle myExtension where myExtension is the name of the downloaded extension. All args are passed to the child as well

Signed-off-by: Kasper J. Hermansen <contact@kjuulh.io>

* feat: remember to add error

Signed-off-by: Kasper J. Hermansen <contact@kjuulh.io>

* feat: without empty line

Signed-off-by: Kasper J. Hermansen <contact@kjuulh.io>

* feat: adds github remote registry index (#226)

* feat: with github registry

Signed-off-by: Kasper J. Hermansen <contact@kjuulh.io>

* fix: shuttle extensions

Signed-off-by: Kasper J. Hermansen <contact@kjuulh.io>

* feat: can download private files

Signed-off-by: Kasper J. Hermansen <contact@kjuulh.io>

* feat: remove fluff

Signed-off-by: Kasper J. Hermansen <contact@kjuulh.io>

* feat: fix review comments

Signed-off-by: Kasper J. Hermansen <contact@kjuulh.io>

* feat: it needs to implement the functions

Signed-off-by: Kasper J. Hermansen <contact@kjuulh.io>

---------

Signed-off-by: Kasper J. Hermansen <contact@kjuulh.io>

---------

Signed-off-by: Kasper J. Hermansen <contact@kjuulh.io>

---------

Signed-off-by: Kasper J. Hermansen <contact@kjuulh.io>

---------

Signed-off-by: Kasper J. Hermansen <contact@kjuulh.io>

---------

Signed-off-by: Kasper J. Hermansen <contact@kjuulh.io>

---------

Signed-off-by: Kasper J. Hermansen <contact@kjuulh.io>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants