-
Notifications
You must be signed in to change notification settings - Fork 64
feat: add aube #7162
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
base: main
Are you sure you want to change the base?
feat: add aube #7162
Changes from all commits
d2c840d
5712629
7ec1146
7c2074f
7b09ac3
d78355e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,67 @@ | ||
| import fs from 'node:fs/promises'; | ||
| import { join } from 'node:path'; | ||
| import { injectFromHierarchy, injectable } from 'inversify'; | ||
| import { BaseInstallService } from '../install-tool/base-install.service.ts'; | ||
|
|
||
| interface GitHubRelease { | ||
| assets: { | ||
| digest: string | null; | ||
| name: string; | ||
| }[]; | ||
| } | ||
|
|
||
| @injectable() | ||
| @injectFromHierarchy() | ||
| export class AubeInstallService extends BaseInstallService { | ||
| readonly name = 'aube'; | ||
|
|
||
| private get ghArch(): string { | ||
| switch (this.envSvc.arch) { | ||
| case 'arm64': | ||
| return 'aarch64'; | ||
| case 'amd64': | ||
| return 'x86_64'; | ||
| } | ||
| } | ||
|
|
||
| override async install(version: string): Promise<void> { | ||
| const baseUrl = `https://github.com/jdx/aube/releases/download/v${version}/`; | ||
| const filename = `aube-v${version}-${this.ghArch}-unknown-linux-gnu.tar.gz`; | ||
| const url = `${baseUrl}${filename}`; | ||
|
|
||
| const release = await this.http.getJson<GitHubRelease>( | ||
| `https://api.github.com/repos/jdx/aube/releases/tags/v${version}`, | ||
| ); | ||
| const expectedChecksum = release.assets | ||
| .find((asset) => asset.name === filename) | ||
| ?.digest?.replace(/^sha256:/, ''); | ||
|
|
||
| if (!expectedChecksum) { | ||
| throw new Error(`Cannot find checksum for '${filename}'`); | ||
| } | ||
|
Comment on lines
+32
to
+41
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 💡 Quality: aube checksum relies on undocumented api.github.com endpointUnlike Was this helpful? React with 👍 / 👎
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. aube doesn't ship releases with checksums, so we have to use the GitHub APIs if we want to verify the binary There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Gitar can change code and merge on your behalf, so it only acts on requests from people who can push. This needs Write access to this repository.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thoughts on the code review bot's worries, @viceice ? I think it's probably OK, but we should wire in auth for the call |
||
|
|
||
| const file = await this.http.download({ | ||
| url, | ||
| checksumType: 'sha256', | ||
| expectedChecksum, | ||
| }); | ||
|
|
||
| await this.pathSvc.ensureToolPath(this.name); | ||
|
|
||
| const path = join( | ||
| await this.pathSvc.createVersionedToolPath(this.name, version), | ||
| 'bin', | ||
| ); | ||
| await fs.mkdir(path); | ||
| await this.compress.extract({ file, cwd: path }); | ||
| } | ||
|
|
||
| override async link(version: string): Promise<void> { | ||
| const src = join(this.pathSvc.versionedToolPath(this.name, version), 'bin'); | ||
| await this.shellwrapper({ srcDir: src }); | ||
| } | ||
|
|
||
| override async test(_version: string): Promise<void> { | ||
| await this._spawn(this.name, ['--version']); | ||
| } | ||
| } | ||
|
jonahsnider marked this conversation as resolved.
|
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| { | ||
| "name": "containerbase-aube-test", | ||
| "private": true, | ||
| "dependencies": { | ||
| "is-number": "7.0.0" | ||
| } | ||
| } |
Uh oh!
There was an error while loading. Please reload this page.