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: add Wally #2249

Merged
merged 16 commits into from
Dec 21, 2024
Merged
Show file tree
Hide file tree
Changes from 9 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
13 changes: 13 additions & 0 deletions docs/custom-registries.md
Original file line number Diff line number Diff line change
Expand Up @@ -583,3 +583,16 @@ Samples:
```txt
https://github.com/vmware-tanzu/carvel-vendir/releases/download/v0.22.0/vendir-linux-amd64
```

## `wally`

Wally releases are downloaded from:

- `https://github.com/containerbase/wally-prebuild/releases`

Samples:

```txt
https://github.com/containerbase/wally-prebuild/releases/0.3.2/wally-0.3.2-jammy-x86_x64.tar.xz.sha512
https://github.com/containerbase/wally-prebuild/releases/0.3.2/wally-0.3.2-jammy-x86_x64.tar.xz
viceice marked this conversation as resolved.
Show resolved Hide resolved
```
6 changes: 4 additions & 2 deletions renovate.json
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,8 @@
"sops",
"swift",
"uv",
"vendir"
"vendir",
"wally"
],
"separateMinorPatch": false
},
Expand Down Expand Up @@ -129,7 +130,8 @@
"sops",
"swift",
"uv",
"vendir"
"vendir",
"wally"
],
"matchUpdateTypes": ["minor", "patch"],
"automerge": true
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 @@ -62,6 +62,7 @@ import {
} from '../tools/ruby/utils';
import { SkopeoInstallService } from '../tools/skopeo';
import { SopsInstallService } from '../tools/sops';
import { WallyInstallService } from '../tools/wally';
import { logger } from '../utils';
import { LegacyToolInstallService } from './install-legacy-tool.service';
import { INSTALL_TOOL_TOKEN, InstallToolService } from './install-tool.service';
Expand Down Expand Up @@ -106,6 +107,7 @@ function prepareInstallContainer(): Container {
container.bind(INSTALL_TOOL_TOKEN).to(RenovateInstallService);
container.bind(INSTALL_TOOL_TOKEN).to(SkopeoInstallService);
container.bind(INSTALL_TOOL_TOKEN).to(SopsInstallService);
container.bind(INSTALL_TOOL_TOKEN).to(WallyInstallService);
container.bind(INSTALL_TOOL_TOKEN).to(YarnInstallService);
container.bind(INSTALL_TOOL_TOKEN).to(YarnSlimInstallService);

Expand Down
1 change: 1 addition & 0 deletions src/cli/tools/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ export const NoPrepareTools = [
'skopeo',
'sops',
'uv',
'wally',
'yarn',
'yarn-slim',
];
Expand Down
70 changes: 70 additions & 0 deletions src/cli/tools/wally.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
import fs from 'node:fs/promises';
import path from 'node:path';
import { execa } from 'execa';
import { inject, injectable } from 'inversify';
import { BaseInstallService } from '../install-tool/base-install.service';
import {
CompressionService,
EnvService,
HttpService,
PathService,
} from '../services';
import { getDistro } from '../utils';

@injectable()
export class WallyInstallService extends BaseInstallService {
readonly name = 'wally';

private get ghArch(): string {
switch (this.envSvc.arch) {
case 'arm64':
return 'aarch64';
case 'amd64':
return 'x86_64';
}
}

constructor(
@inject(EnvService) envSvc: EnvService,
@inject(PathService) pathSvc: PathService,
@inject(HttpService) private http: HttpService,
@inject(CompressionService) private compress: CompressionService,
) {
super(pathSvc, envSvc);
}

override async install(version: string): Promise<void> {
const name = this.name;
const distro = await getDistro();
const filename = `${name}-${version}-${distro.versionCode}-${this.ghArch}.tar.xz`;
const url = `https://github.com/containerbase/${name}-prebuild/releases/download/${version}/${filename}`;
const checksumFileUrl = `${url}.sha512`;

const checksumFile = await this.http.download({ url: checksumFileUrl });
const expectedChecksum = (await fs.readFile(checksumFile, 'utf-8')).trim();

const file = await this.http.download({
url,
checksumType: 'sha512',
expectedChecksum,
});

const cwd = await this.pathSvc.ensureToolPath(name);

await this.compress.extract({ file, cwd });
}

override async link(version: string): Promise<void> {
const src = path.join(
this.pathSvc.versionedToolPath(this.name, version),
'bin',
);
await this.shellwrapper({ srcDir: src });
}

override async test(_version: string): Promise<void> {
await execa(this.name, ['--version'], {
stdio: ['inherit', 'inherit', 1],
});
}
}
3 changes: 3 additions & 0 deletions test/Dockerfile.distro
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,9 @@ RUN install-tool jb v0.6.0
# renovate: datasource=github-releases packageName=vmware-tanzu/carvel-vendir
RUN install-tool vendir v0.43.0

# renovate: datasource=github-releases packageName=containerbase/wally-prebuild
RUN install-tool wally 0.3.2

#--------------------------------------
# Image: test-erlang
#--------------------------------------
Expand Down
13 changes: 12 additions & 1 deletion test/latest/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ RUN prepare-tool all
RUN set -ex; [ -d /usr/local/erlang ] && echo "works" || exit 1;

#--------------------------------------
# test: bazelisk, bun, devbox, vendir, helmfile, kustomize, skopeo
# test: bazelisk, bun, devbox, vendir, helmfile, kustomize, skopeo, wally
viceice marked this conversation as resolved.
Show resolved Hide resolved
#--------------------------------------
FROM base AS teste

Expand Down Expand Up @@ -239,18 +239,25 @@ ARG HELMFILE_VERSION=0.169.2
# renovate: datasource=github-releases depName=kustomize packageName=kubernetes-sigs/kustomize
ARG KUSTOMIZE_VERSION=5.5.0

# renovate: datasource=github-releases packageName=containerbase/wally-prebuild
ARG WALLY_VERSION=0.3.2

RUN install-tool vendir "v${VENDIR_VERSION}"

RUN install-tool helmfile "v${HELMFILE_VERSION}"

RUN install-tool kustomize "${KUSTOMIZE_VERSION}"

RUN install-tool wally "v${WALLY_VERSION}"
guidojw marked this conversation as resolved.
Show resolved Hide resolved

RUN set -ex; vendir --version

RUN set -ex; helmfile version

RUN set -ex; kustomize version

RUN set -ex; wally --version

SHELL [ "/bin/sh", "-c" ]

RUN vendir --version | grep "${VENDIR_VERSION}"
Expand All @@ -259,6 +266,8 @@ RUN helmfile version | grep "${HELMFILE_VERSION}"

RUN kustomize version | grep "${KUSTOMIZE_VERSION}"

RUN wally --version | grep "${WALLY_VERSION}"

USER 12021

RUN bazel --version
Expand All @@ -269,6 +278,8 @@ RUN helmfile version | grep "${HELMFILE_VERSION}"

RUN kustomize version | grep "${KUSTOMIZE_VERSION}"

RUN wally --version | grep "${WALLY_VERSION}"

#--------------------------------------
# final
#--------------------------------------
Expand Down