Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
renovate
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
GitHub Mirror
Renovate Bot
renovate
Commits
fdb6104b
Unverified
Commit
fdb6104b
authored
3 years ago
by
Kevin James
Committed by
GitHub
3 years ago
Browse files
Options
Downloads
Patches
Plain Diff
fix(manager/mix): support lockfiles in subdirs (#10689)
Co-authored-by:
Michael Kriese
<
michael.kriese@visualon.de
>
parent
daff0f2e
No related branches found
Branches containing commit
Tags
v0.29.2
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
lib/manager/mix/artifacts.spec.ts
+18
-0
18 additions, 0 deletions
lib/manager/mix/artifacts.spec.ts
lib/manager/mix/artifacts.ts
+6
-2
6 additions, 2 deletions
lib/manager/mix/artifacts.ts
with
24 additions
and
2 deletions
lib/manager/mix/artifacts.spec.ts
+
18
−
0
View file @
fdb6104b
...
@@ -83,6 +83,7 @@ describe(getName(), () => {
...
@@ -83,6 +83,7 @@ describe(getName(), () => {
jest
.
spyOn
(
docker
,
'
removeDanglingContainers
'
).
mockResolvedValueOnce
();
jest
.
spyOn
(
docker
,
'
removeDanglingContainers
'
).
mockResolvedValueOnce
();
setAdminConfig
({
...
adminConfig
,
binarySource
:
'
docker
'
});
setAdminConfig
({
...
adminConfig
,
binarySource
:
'
docker
'
});
fs
.
readLocalFile
.
mockResolvedValueOnce
(
'
Old mix.lock
'
);
fs
.
readLocalFile
.
mockResolvedValueOnce
(
'
Old mix.lock
'
);
fs
.
getSiblingFileName
.
mockReturnValueOnce
(
'
mix.lock
'
);
const
execSnapshots
=
mockExecAll
(
exec
);
const
execSnapshots
=
mockExecAll
(
exec
);
fs
.
readLocalFile
.
mockResolvedValueOnce
(
'
New mix.lock
'
);
fs
.
readLocalFile
.
mockResolvedValueOnce
(
'
New mix.lock
'
);
expect
(
expect
(
...
@@ -96,8 +97,24 @@ describe(getName(), () => {
...
@@ -96,8 +97,24 @@ describe(getName(), () => {
expect
(
execSnapshots
).
toMatchSnapshot
();
expect
(
execSnapshots
).
toMatchSnapshot
();
});
});
it
(
'
returns updated mix.lock in subdir
'
,
async
()
=>
{
setAdminConfig
({
...
adminConfig
,
binarySource
:
'
docker
'
});
fs
.
getSiblingFileName
.
mockReturnValueOnce
(
'
subdir/mix.lock
'
);
mockExecAll
(
exec
);
expect
(
await
updateArtifacts
({
packageFileName
:
'
subdir/mix.exs
'
,
updatedDeps
:
[{
depName
:
'
plug
'
}],
newPackageFileContent
:
'
{}
'
,
config
,
})
).
toBeNull
();
expect
(
fs
.
readLocalFile
).
toHaveBeenCalledWith
(
'
subdir/mix.lock
'
,
'
utf8
'
);
});
it
(
'
catches write errors
'
,
async
()
=>
{
it
(
'
catches write errors
'
,
async
()
=>
{
fs
.
readLocalFile
.
mockResolvedValueOnce
(
'
Current mix.lock
'
);
fs
.
readLocalFile
.
mockResolvedValueOnce
(
'
Current mix.lock
'
);
fs
.
getSiblingFileName
.
mockReturnValueOnce
(
'
mix.lock
'
);
fs
.
writeLocalFile
.
mockImplementationOnce
(()
=>
{
fs
.
writeLocalFile
.
mockImplementationOnce
(()
=>
{
throw
new
Error
(
'
not found
'
);
throw
new
Error
(
'
not found
'
);
});
});
...
@@ -113,6 +130,7 @@ describe(getName(), () => {
...
@@ -113,6 +130,7 @@ describe(getName(), () => {
it
(
'
catches exec errors
'
,
async
()
=>
{
it
(
'
catches exec errors
'
,
async
()
=>
{
fs
.
readLocalFile
.
mockResolvedValueOnce
(
'
Current mix.lock
'
);
fs
.
readLocalFile
.
mockResolvedValueOnce
(
'
Current mix.lock
'
);
fs
.
getSiblingFileName
.
mockReturnValueOnce
(
'
mix.lock
'
);
exec
.
mockImplementationOnce
(()
=>
{
exec
.
mockImplementationOnce
(()
=>
{
throw
new
Error
(
'
exec-error
'
);
throw
new
Error
(
'
exec-error
'
);
});
});
...
...
This diff is collapsed.
Click to expand it.
lib/manager/mix/artifacts.ts
+
6
−
2
View file @
fdb6104b
...
@@ -2,7 +2,11 @@ import { quote } from 'shlex';
...
@@ -2,7 +2,11 @@ import { quote } from 'shlex';
import
{
TEMPORARY_ERROR
}
from
'
../../constants/error-messages
'
;
import
{
TEMPORARY_ERROR
}
from
'
../../constants/error-messages
'
;
import
{
logger
}
from
'
../../logger
'
;
import
{
logger
}
from
'
../../logger
'
;
import
{
ExecOptions
,
exec
}
from
'
../../util/exec
'
;
import
{
ExecOptions
,
exec
}
from
'
../../util/exec
'
;
import
{
readLocalFile
,
writeLocalFile
}
from
'
../../util/fs
'
;
import
{
getSiblingFileName
,
readLocalFile
,
writeLocalFile
,
}
from
'
../../util/fs
'
;
import
type
{
UpdateArtifact
,
UpdateArtifactsResult
}
from
'
../types
'
;
import
type
{
UpdateArtifact
,
UpdateArtifactsResult
}
from
'
../types
'
;
export
async
function
updateArtifacts
({
export
async
function
updateArtifacts
({
...
@@ -16,7 +20,7 @@ export async function updateArtifacts({
...
@@ -16,7 +20,7 @@ export async function updateArtifacts({
return
null
;
return
null
;
}
}
const
lockFileName
=
'
mix.lock
'
;
const
lockFileName
=
getSiblingFileName
(
packageFileName
,
'
mix.lock
'
)
;
try
{
try
{
await
writeLocalFile
(
packageFileName
,
newPackageFileContent
);
await
writeLocalFile
(
packageFileName
,
newPackageFileContent
);
}
catch
(
err
)
{
}
catch
(
err
)
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment