Skip to content

Commit

Permalink
feat: add Wally
Browse files Browse the repository at this point in the history
  • Loading branch information
guidojw committed Feb 24, 2024
1 parent 46e2e59 commit 8b7f90e
Show file tree
Hide file tree
Showing 7 changed files with 111 additions and 12 deletions.
13 changes: 13 additions & 0 deletions docs/custom-registries.md
Original file line number Diff line number Diff line change
Expand Up @@ -561,3 +561,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/UpliftGames/wally/releases`

Samples:

```txt
https://github.com/UpliftGames/wally/releases/download/v0.3.1/wally-v0.3.1-linux.zip
https://github.com/UpliftGames/wally/releases/download/v0.3.2/wally-v0.3.2-linux.zip
```
6 changes: 4 additions & 2 deletions renovate.json
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,8 @@
"renovate",
"rust",
"swift",
"vendir"
"vendir",
"wally"
],
"separateMinorPatch": false
},
Expand All @@ -98,7 +99,8 @@
"renovate",
"rust",
"swift",
"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 @@ -21,6 +21,7 @@ import {
import { InstallNpmBaseService } from '../tools/node/utils';
import { InstallCocoapodsService } from '../tools/ruby/gem';
import { InstallRubyBaseService } from '../tools/ruby/utils';
import { InstallWallyService } from '../tools/wally';
import { logger } from '../utils';
import { InstallLegacyToolService } from './install-legacy-tool.service';
import { INSTALL_TOOL_TOKEN, InstallToolService } from './install-tool.service';
Expand Down Expand Up @@ -51,6 +52,7 @@ function prepareInstallContainer(): Container {
container.bind(INSTALL_TOOL_TOKEN).to(InstallMavenService);
container.bind(INSTALL_TOOL_TOKEN).to(InstallNodeService);
container.bind(INSTALL_TOOL_TOKEN).to(InstallRenovateService);
container.bind(INSTALL_TOOL_TOKEN).to(InstallWallyService);
container.bind(INSTALL_TOOL_TOKEN).to(InstallYarnSlimService);

logger.trace('preparing install container done');
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 @@ -15,6 +15,7 @@ export const NoPrepareTools = [
'npm',
'pnpm',
'renovate',
'wally',
'yarn',
'yarn-slim',
];
Expand Down
67 changes: 67 additions & 0 deletions src/cli/tools/wally.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 { execa } from 'execa';
import { inject, injectable } from 'inversify';
import { InstallToolBaseService } from '../install-tool/install-tool-base.service';
import {
CompressionService,
EnvService,
HttpService,
PathService,
} from '../services';
import { getDistro } from '../utils';

@injectable()
export class InstallWallyService extends InstallToolBaseService {
readonly name = 'wally';

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 distro = await getDistro();

// wally requires libssl3 which is not easily installable on focal
if (distro.versionCode === 'focal') {
throw new Error(`Unsupported distro: ${distro.versionCode}`);
}

const baseUrl = `https://github.com/UpliftGames/wally/releases/download/v${version}/`;
const filename = `wally-v${version}-linux.zip`;

const file = await this.http.download({
url: `${baseUrl}${filename}`,
});

// TODO: create recursive
if (!(await this.pathSvc.findToolPath(this.name))) {
await this.pathSvc.createToolPath(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 execa(this.name, ['--version'], { stdio: ['inherit', 'inherit', 1] });
}
}
3 changes: 3 additions & 0 deletions test/Dockerfile.jammy
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,9 @@ RUN install-tool jb v0.5.1
# renovate: datasource=github-releases packageName=vmware-tanzu/carvel-vendir
RUN install-tool vendir v0.40.0

# renovate: datasource=github-releases packageName=UpliftGames/wally
RUN install-tool wally v0.3.2

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

#--------------------------------------
# test: bazelisk, bun, vendir, helmfile, kustomize
# test: bazelisk, bun, gleam, helmfile, kustomize, vendir, wally
#--------------------------------------
FROM base as teste

Expand All @@ -203,45 +203,56 @@ RUN install-tool bun 1.0.28
# renovate: datasource=github-releases packageName=gleam-lang/gleam
RUN install-tool gleam 0.34.1

# renovate: datasource=github-releases packageName=vmware-tanzu/carvel-vendir
ARG VENDIR_VERSION=0.32.2

# renovate: datasource=github-releases packageName=helmfile/helmfile
ARG HELMFILE_VERSION=0.150.0

# renovate: datasource=github-releases packageName=kubernetes-sigs/kustomize
ARG KUSTOMIZE_VERSION=5.0.0

RUN install-tool vendir "v${VENDIR_VERSION}"
# renovate: datasource=github-releases packageName=vmware-tanzu/carvel-vendir
ARG VENDIR_VERSION=0.32.2

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

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

RUN install-tool kustomize "${KUSTOMIZE_VERSION}"

RUN set -ex; vendir --version
RUN install-tool vendir "v${VENDIR_VERSION}"

RUN install-tool wally "v${WALLY_VERSION}"

RUN set -ex; helmfile version

RUN set -ex; kustomize version

SHELL [ "/bin/sh", "-c" ]
RUN set -ex; vendir --version

RUN vendir --version | grep "${VENDIR_VERSION}"
RUN set -ex; wally --version

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

RUN helmfile version | grep "${HELMFILE_VERSION}"

RUN kustomize version | grep "${KUSTOMIZE_VERSION}"

RUN vendir --version | grep "${VENDIR_VERSION}"

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

USER 1000

RUN bazel --version

RUN vendir --version | grep "${VENDIR_VERSION}"

RUN helmfile version | grep "${HELMFILE_VERSION}"

RUN kustomize version | grep "${KUSTOMIZE_VERSION}"

RUN vendir --version | grep "${VENDIR_VERSION}"

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

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

0 comments on commit 8b7f90e

Please sign in to comment.