diff --git a/lib/modules/manager/mix/__snapshots__/artifacts.spec.ts.snap b/lib/modules/manager/mix/__snapshots__/artifacts.spec.ts.snap index ccf9ac3c98d6b1..6114236271fe39 100644 --- a/lib/modules/manager/mix/__snapshots__/artifacts.spec.ts.snap +++ b/lib/modules/manager/mix/__snapshots__/artifacts.spec.ts.snap @@ -15,13 +15,13 @@ Array [ exports[`modules/manager/mix/artifacts authenticates to private repositories 2`] = ` Array [ Object { - "cmd": "docker ps --filter name=renovate_elixir -aq", + "cmd": "docker ps --filter name=renovate_sidecar -aq", "options": Object { "encoding": "utf-8", }, }, Object { - "cmd": "docker run --rm --name=renovate_elixir --label=renovate_child -v \\"/tmp/github/some/repo\\":\\"/tmp/github/some/repo\\" -v \\"/tmp/cache\\":\\"/tmp/cache\\" -e BUILDPACK_CACHE_DIR -w \\"/tmp/github/some/repo\\" renovate/elixir bash -l -c \\"mix hex.organization auth renovate_test --key valid_test_token && mix deps.update private_package other_package\\"", + "cmd": "docker run --rm --name=renovate_sidecar --label=renovate_child -v \\"/tmp/github/some/repo\\":\\"/tmp/github/some/repo\\" -v \\"/tmp/cache\\":\\"/tmp/cache\\" -e BUILDPACK_CACHE_DIR -w \\"/tmp/github/some/repo\\" renovate/sidecar bash -l -c \\"install-tool erlang 24.3.4.2 && install-tool elixir v1.13.4 && mix hex.organization auth renovate_test --key valid_test_token && mix deps.update private_package other_package\\"", "options": Object { "cwd": "/tmp/github/some/repo", "encoding": "utf-8", @@ -68,19 +68,19 @@ Array [ exports[`modules/manager/mix/artifacts returns updated mix.lock 1`] = ` Array [ Object { - "cmd": "docker pull renovate/elixir", + "cmd": "docker pull renovate/sidecar", "options": Object { "encoding": "utf-8", }, }, Object { - "cmd": "docker ps --filter name=renovate_elixir -aq", + "cmd": "docker ps --filter name=renovate_sidecar -aq", "options": Object { "encoding": "utf-8", }, }, Object { - "cmd": "docker run --rm --name=renovate_elixir --label=renovate_child -v \\"/tmp/github/some/repo\\":\\"/tmp/github/some/repo\\" -v \\"/tmp/cache\\":\\"/tmp/cache\\" -e BUILDPACK_CACHE_DIR -w \\"/tmp/github/some/repo\\" renovate/elixir bash -l -c \\"mix deps.update plug\\"", + "cmd": "docker run --rm --name=renovate_sidecar --label=renovate_child -v \\"/tmp/github/some/repo\\":\\"/tmp/github/some/repo\\" -v \\"/tmp/cache\\":\\"/tmp/cache\\" -e BUILDPACK_CACHE_DIR -w \\"/tmp/github/some/repo\\" renovate/sidecar bash -l -c \\"install-tool erlang 24.3.4.2 && install-tool elixir 1.13.4 && mix deps.update plug\\"", "options": Object { "cwd": "/tmp/github/some/repo", "encoding": "utf-8", diff --git a/lib/modules/manager/mix/artifacts.spec.ts b/lib/modules/manager/mix/artifacts.spec.ts index 781eaed6094721..b79b7708387e41 100644 --- a/lib/modules/manager/mix/artifacts.spec.ts +++ b/lib/modules/manager/mix/artifacts.spec.ts @@ -1,15 +1,19 @@ import { join } from 'upath'; import { envMock, mockExecAll } from '../../../../test/exec-util'; -import { env, fs, hostRules } from '../../../../test/util'; +import { env, fs, hostRules, mockedFunction } from '../../../../test/util'; import { GlobalConfig } from '../../../config/global'; import type { RepoGlobalConfig } from '../../../config/types'; import * as docker from '../../../util/exec/docker'; +import { getPkgReleases as _getPkgReleases } from '../../datasource'; import type { UpdateArtifactsConfig } from '../types'; import { updateArtifacts } from '.'; jest.mock('../../../util/exec/env'); jest.mock('../../../util/fs'); jest.mock('../../../util/host-rules'); +jest.mock('../../datasource'); + +const getPkgReleases = mockedFunction(_getPkgReleases); const adminConfig: RepoGlobalConfig = { // `join` fixes Windows CI @@ -87,6 +91,26 @@ describe('modules/manager/mix/artifacts', () => { fs.findLocalSiblingOrParent.mockResolvedValueOnce('mix.lock'); const execSnapshots = mockExecAll(); fs.readLocalFile.mockResolvedValueOnce('New mix.lock'); + + // erlang + getPkgReleases.mockResolvedValueOnce({ + releases: [ + { version: '22.3.4.26' }, + { version: '23.1.1.0' }, + { version: '24.3.4.1' }, + { version: '24.3.4.2' }, + { version: '25.0.0.0' }, + ], + }); + // elixir + getPkgReleases.mockResolvedValueOnce({ + releases: [ + { version: '1.8.2' }, + { version: '1.13.3' }, + { version: '1.13.4' }, + ], + }); + expect( await updateArtifacts({ packageFileName: 'mix.exs', @@ -112,6 +136,25 @@ describe('modules/manager/mix/artifacts', () => { hostRules.find.mockReturnValueOnce({ token: 'valid_test_token' }); hostRules.find.mockReturnValueOnce({}); + // erlang + getPkgReleases.mockResolvedValueOnce({ + releases: [ + { version: '22.3.4.26' }, + { version: '23.1.1.0' }, + { version: '24.3.4.1' }, + { version: '24.3.4.2' }, + { version: '25.0.0.0' }, + ], + }); + // elixir + getPkgReleases.mockResolvedValueOnce({ + releases: [ + { version: 'v1.8.2' }, + { version: 'v1.13.3' }, + { version: 'v1.13.4' }, + ], + }); + const result = await updateArtifacts({ packageFileName: 'mix.exs', updatedDeps: [ diff --git a/lib/modules/manager/mix/artifacts.ts b/lib/modules/manager/mix/artifacts.ts index 0eb2e6d303ad41..58f8bfd99af479 100644 --- a/lib/modules/manager/mix/artifacts.ts +++ b/lib/modules/manager/mix/artifacts.ts @@ -76,8 +76,18 @@ export async function updateArtifacts({ const execOptions: ExecOptions = { cwdFile: packageFileName, docker: { - image: 'elixir', + image: 'sidecar', }, + toolConstraints: [ + { + toolName: 'erlang', + // https://hexdocs.pm/elixir/1.13.4/compatibility-and-deprecations.html#compatibility-between-elixir-and-erlang-otp + constraint: '^24', + }, + { + toolName: 'elixir', + }, + ], preCommands, }; const command = [ diff --git a/lib/util/exec/buildpack.ts b/lib/util/exec/buildpack.ts index ab9202a7fd777e..8a456a98ca28a2 100644 --- a/lib/util/exec/buildpack.ts +++ b/lib/util/exec/buildpack.ts @@ -9,6 +9,7 @@ import { id as npmVersioningId } from '../../modules/versioning/npm'; import { id as pep440VersioningId } from '../../modules/versioning/pep440'; import { id as rubyVersioningId } from '../../modules/versioning/ruby'; import { id as semverVersioningId } from '../../modules/versioning/semver'; +import { id as semverCoercedVersioningId } from '../../modules/versioning/semver-coerced'; import type { Opt, ToolConfig, ToolConstraint } from './types'; const allToolConfig: Record = { @@ -32,6 +33,16 @@ const allToolConfig: Record = { depName: 'corepack', versioning: npmVersioningId, }, + erlang: { + datasource: 'github-releases', + depName: 'containerbase/erlang-prebuild', + versioning: semverCoercedVersioningId, + }, + elixir: { + datasource: 'github-releases', + depName: 'elixir-lang/elixir', + versioning: semverVersioningId, + }, flux: { datasource: 'github-releases', depName: 'fluxcd/flux2',