Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/renovate.json
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@
"matchDepNames": [
"apko",
"apm",
"aube",
"bazelisk",
"buf",
"buildx",
Expand Down Expand Up @@ -116,6 +117,7 @@
"matchDepNames": [
"apko",
"apm",
"aube",
"bazelisk",
"buf",
"buildx",
Expand Down
13 changes: 13 additions & 0 deletions docs/custom-registries.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,19 @@ https://github.com/microsoft/apm/releases/download/v0.24.0/apm-linux-arm64.tar.g
https://github.com/microsoft/apm/releases/download/v0.24.0/apm-linux-arm64.tar.gz.sha256
```

## `aube`

Aube releases are downloaded from:

- `https://github.com/jdx/aube/releases`

Samples:

```txt
https://github.com/jdx/aube/releases/download/v1.41.0/aube-v1.41.0-aarch64-unknown-linux-gnu.tar.gz
https://github.com/jdx/aube/releases/download/v1.41.0/aube-v1.41.0-x86_64-unknown-linux-gnu.tar.gz
```

## `bazelisk`

Bazelisk releases are downloaded from:
Expand Down
2 changes: 2 additions & 0 deletions src/cli/install-tool/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import {
} from '../services/index.ts';
import { ApkoInstallService } from '../tools/apko.ts';
import { ApmInstallService } from '../tools/apm.ts';
import { AubeInstallService } from '../tools/aube.ts';
import { BazeliskInstallService } from '../tools/bazelisk.ts';
import { BufInstallService } from '../tools/buf.ts';
import { BunInstallService } from '../tools/bun.ts';
Expand Down Expand Up @@ -137,6 +138,7 @@ async function prepareInstallContainer(): Promise<Container> {
container.bind(INSTALL_TOOL_TOKEN).to(AndroidSdkCmdlineToolsInstallService);
container.bind(INSTALL_TOOL_TOKEN).to(ApkoInstallService);
container.bind(INSTALL_TOOL_TOKEN).to(ApmInstallService);
container.bind(INSTALL_TOOL_TOKEN).to(AubeInstallService);
container.bind(INSTALL_TOOL_TOKEN).to(ComposerInstallService);
container.bind(INSTALL_TOOL_TOKEN).to(BazeliskInstallService);
container.bind(INSTALL_TOOL_TOKEN).to(BuildxInstallService);
Expand Down
67 changes: 67 additions & 0 deletions src/cli/tools/aube.ts
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> {
Comment thread
jonahsnider marked this conversation as resolved.
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

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Quality: aube checksum relies on undocumented api.github.com endpoint

Unlike apm.ts which fetches a .sha256 sidecar from the releases download URL, aube.ts fetches the full release metadata from https://api.github.com/repos/jdx/aube/releases/tags/v${version} to read the asset digest. This endpoint is unauthenticated (the HTTP service only sets a user-agent header, no token), so it is subject to GitHub's 60 req/hr per-IP anonymous rate limit, and it is not covered by the custom-registries.md docs, which only list github.com/jdx/aube/releases as the download source. Users mirroring aube via a custom registry would also need to proxy the API host (it does pass through envSvc.replaceUrl, but that is not documented). Consider documenting the API dependency in custom-registries.md and/or confirming rate limiting is acceptable for build environments.

Was this helpful? React with 👍 / 👎

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The 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

Copy link
Copy Markdown

Choose a reason for hiding this comment

The 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.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The 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']);
}
}
1 change: 1 addition & 0 deletions src/cli/tools/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ export const NoPrepareTools = [
'android-sdk-cmdline-tools',
'apko',
'apm',
'aube',
'bazelisk',
'bower',
'buf',
Expand Down
11 changes: 10 additions & 1 deletion test/latest/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ RUN prepare-tool all
RUN set -ex; [ -d /usr/local/erlang ] && echo "works" || exit 1;

#--------------------------------------
# test: apm, bazelisk, buf, bun, deno, devbox, gh, helmfile, kustomize, skopeo, tofu, vendir
# test: apm, aube, bazelisk, buf, bun, deno, devbox, gh, helmfile, kustomize, skopeo, tofu, vendir
#--------------------------------------
FROM base AS teste

Expand All @@ -234,6 +234,9 @@ RUN install-tool apko 1.2.41
# renovate: datasource=github-releases packageName=microsoft/apm
RUN install-tool apm 0.28.0

# renovate: datasource=github-releases packageName=jdx/aube
RUN install-tool aube 1.41.0

# renovate: datasource=github-releases packageName=jetify-com/devbox
RUN install-tool devbox 0.18.0

Expand Down Expand Up @@ -292,8 +295,14 @@ RUN helmfile version | grep "${HELMFILE_VERSION#v}"

RUN kustomize version | grep "${KUSTOMIZE_VERSION}"

COPY --chown=12021:0 test/latest/src/test/aube /tmp/aube

USER 12021

RUN set -ex; cd /tmp/aube; aube install; test -f node_modules/is-number/index.js

RUN set -ex; cd /tmp/aube; aube install --ignore-scripts

RUN bazel --version

RUN gh --version
Expand Down
17 changes: 17 additions & 0 deletions test/latest/Dockerfile.arm64
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,22 @@ FROM base AS test-apm
# renovate: datasource=github-releases packageName=microsoft/apm
RUN install-tool apm 0.28.0

#--------------------------------------
# Image: aube
#--------------------------------------
FROM base AS test-aube

# renovate: datasource=github-releases packageName=jdx/aube
RUN install-tool aube 1.41.0

COPY --chown=12021:0 test/latest/src/test/aube /tmp/aube

USER 12021

RUN set -ex; cd /tmp/aube; aube install; test -f node_modules/is-number/index.js

RUN set -ex; cd /tmp/aube; aube install --ignore-scripts

#--------------------------------------
# Image: devbox
#--------------------------------------
Expand Down Expand Up @@ -223,6 +239,7 @@ COPY --from=test-bun /.dummy /.dummy
COPY --from=test-deno /.dummy /.dummy
COPY --from=test-apko /.dummy /.dummy
COPY --from=test-apm /.dummy /.dummy
COPY --from=test-aube /.dummy /.dummy
COPY --from=test-devbox /.dummy /.dummy
COPY --from=test-docker /.dummy /.dummy
COPY --from=test-gh /.dummy /.dummy
Expand Down
7 changes: 7 additions & 0 deletions test/latest/src/test/aube/package.json
Comment thread
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"
}
}