-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(pep621): set Git insteadOf directives when updating pdm/uv locks (…
- Loading branch information
Showing
5 changed files
with
91 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,6 +4,7 @@ import { fs, mockedFunction } from '../../../../../test/util'; | |
import { GlobalConfig } from '../../../../config/global'; | ||
import type { RepoGlobalConfig } from '../../../../config/types'; | ||
import { logger } from '../../../../logger'; | ||
import * as hostRules from '../../../../util/host-rules'; | ||
import { getPkgReleases as _getPkgReleases } from '../../../datasource'; | ||
import type { UpdateArtifactsConfig } from '../../types'; | ||
import { depTypes } from '../utils'; | ||
|
@@ -290,5 +291,64 @@ describe('modules/manager/pep621/processors/pdm', () => { | |
}, | ||
]); | ||
}); | ||
|
||
it('sets Git environment variables', async () => { | ||
hostRules.add({ | ||
matchHost: 'https://example.com', | ||
username: 'user', | ||
password: 'pass', | ||
}); | ||
const execSnapshots = mockExecAll(); | ||
GlobalConfig.set(adminConfig); | ||
fs.getSiblingFileName.mockReturnValueOnce('pdm.lock'); | ||
fs.readLocalFile.mockResolvedValueOnce('test content'); | ||
fs.readLocalFile.mockResolvedValueOnce('changed test content'); | ||
// python | ||
getPkgReleases.mockResolvedValueOnce({ | ||
releases: [{ version: '3.11.1' }, { version: '3.11.2' }], | ||
}); | ||
// pdm | ||
getPkgReleases.mockResolvedValueOnce({ | ||
releases: [{ version: 'v2.6.1' }, { version: 'v2.5.0' }], | ||
}); | ||
|
||
const result = await processor.updateArtifacts( | ||
{ | ||
packageFileName: 'folder/pyproject.toml', | ||
newPackageFileContent: '', | ||
config: { | ||
updateType: 'lockFileMaintenance', | ||
}, | ||
updatedDeps: [], | ||
}, | ||
{}, | ||
); | ||
expect(result).toEqual([ | ||
{ | ||
file: { | ||
contents: 'changed test content', | ||
path: 'pdm.lock', | ||
type: 'addition', | ||
}, | ||
}, | ||
]); | ||
expect(execSnapshots).toMatchObject([ | ||
{ | ||
cmd: 'pdm update --no-sync --update-eager', | ||
options: { | ||
cwd: '/tmp/github/some/repo/folder', | ||
env: { | ||
GIT_CONFIG_COUNT: '3', | ||
GIT_CONFIG_KEY_0: 'url.https://user:[email protected]/.insteadOf', | ||
GIT_CONFIG_KEY_1: 'url.https://user:[email protected]/.insteadOf', | ||
GIT_CONFIG_KEY_2: 'url.https://user:[email protected]/.insteadOf', | ||
GIT_CONFIG_VALUE_0: 'ssh://[email protected]/', | ||
GIT_CONFIG_VALUE_1: '[email protected]:', | ||
GIT_CONFIG_VALUE_2: 'https://example.com/', | ||
}, | ||
}, | ||
}, | ||
]); | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -356,6 +356,13 @@ describe('modules/manager/pep621/processors/uv', () => { | |
cmd: 'uv lock --upgrade-package dep1 --upgrade-package dep2 --upgrade-package dep3 --upgrade-package dep4', | ||
options: { | ||
env: { | ||
GIT_CONFIG_COUNT: '3', | ||
GIT_CONFIG_KEY_0: 'url.https://user:[email protected]/.insteadOf', | ||
GIT_CONFIG_KEY_1: 'url.https://user:[email protected]/.insteadOf', | ||
GIT_CONFIG_KEY_2: 'url.https://user:[email protected]/.insteadOf', | ||
GIT_CONFIG_VALUE_0: 'ssh://[email protected]/', | ||
GIT_CONFIG_VALUE_1: '[email protected]:', | ||
GIT_CONFIG_VALUE_2: 'https://example.com/', | ||
UV_EXTRA_INDEX_URL: | ||
'https://foobar.com/ https://user:[email protected]/', | ||
}, | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters