diff --git a/docs/custom-registries.md b/docs/custom-registries.md index 2df0b97ec..b612d0903 100644 --- a/docs/custom-registries.md +++ b/docs/custom-registries.md @@ -561,3 +561,17 @@ 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.2/wally-v0.3.2-linux.zip +https://github.com/UpliftGames/wally/releases/download/v0.3.1/wally-0.3.1-linux.zip +https://github.com/UpliftGames/wally/releases/download/v0.3.0/wally-0.3.0-linux.zip +``` diff --git a/renovate.json b/renovate.json index 750c50540..e85130496 100644 --- a/renovate.json +++ b/renovate.json @@ -71,7 +71,8 @@ "renovate", "rust", "swift", - "vendir" + "vendir", + "wally" ], "separateMinorPatch": false }, @@ -98,7 +99,8 @@ "renovate", "rust", "swift", - "vendir" + "vendir", + "wally" ], "matchUpdateTypes": ["minor", "patch"], "automerge": true diff --git a/src/cli/install-tool/index.ts b/src/cli/install-tool/index.ts index dc5937b51..5cae0bbe2 100644 --- a/src/cli/install-tool/index.ts +++ b/src/cli/install-tool/index.ts @@ -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'; @@ -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'); diff --git a/src/cli/tools/index.ts b/src/cli/tools/index.ts index 67284afde..6bd94e869 100644 --- a/src/cli/tools/index.ts +++ b/src/cli/tools/index.ts @@ -15,6 +15,7 @@ export const NoPrepareTools = [ 'npm', 'pnpm', 'renovate', + 'wally', 'yarn', 'yarn-slim', ]; diff --git a/src/cli/tools/wally.ts b/src/cli/tools/wally.ts new file mode 100644 index 000000000..f4491c0a4 --- /dev/null +++ b/src/cli/tools/wally.ts @@ -0,0 +1,81 @@ +import fs from 'node:fs/promises'; +import { join } from 'node:path'; +import { execa } from 'execa'; +import { inject, injectable } from 'inversify'; +import semver from 'semver'; +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 { + 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}/`; + let filename = `wally-v${version}-linux.zip`; + + const ver = semver.parse(version); + if (!ver) { + throw new Error(`Invalid version: ${version}`); + } + // asset names of v0.3.1 and lower are not prefixed with v + if ( + ver.major === 0 && + ver.minor <= 3 && + (ver.minor < 3 || ver.patch <= 1) + ) { + filename = `wally-${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 { + const src = join(this.pathSvc.versionedToolPath(this.name, version), 'bin'); + + await this.shellwrapper({ srcDir: src }); + } + + override async test(_version: string): Promise { + await execa(this.name, ['--version'], { stdio: ['inherit', 'inherit', 1] }); + } +} diff --git a/test/Dockerfile.jammy b/test/Dockerfile.jammy index 1d39be941..037f72438 100644 --- a/test/Dockerfile.jammy +++ b/test/Dockerfile.jammy @@ -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 #-------------------------------------- diff --git a/test/latest/Dockerfile b/test/latest/Dockerfile index 7dc4939ab..4b6994702 100644 --- a/test/latest/Dockerfile +++ b/test/latest/Dockerfile @@ -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 @@ -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 #--------------------------------------