mirror of
https://github.com/docker/build-push-action.git
synced 2026-05-24 10:38:53 +00:00
preserve trailing whitespace in secrets input
Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com>
This commit is contained in:
parent
f9f3042f7e
commit
2d1196fa34
@ -95,6 +95,25 @@ describe('getInputs', () => {
|
|||||||
expect(gitContextSpy).toHaveBeenCalledTimes(1);
|
expect(gitContextSpy).toHaveBeenCalledTimes(1);
|
||||||
gitContextSpy.mockRestore();
|
gitContextSpy.mockRestore();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test('requests untrimmed secrets input explicitly', async () => {
|
||||||
|
const gitContext = 'https://github.com/docker/build-push-action.git#refs/heads/master';
|
||||||
|
const gitContextSpy = vi.spyOn(Build.prototype, 'gitContext').mockResolvedValue(gitContext);
|
||||||
|
const getInputList = vi.fn().mockReturnValue([]);
|
||||||
|
vi.resetModules();
|
||||||
|
vi.doMock('@docker/actions-toolkit/lib/util.js', () => ({
|
||||||
|
Util: {
|
||||||
|
getInputList
|
||||||
|
}
|
||||||
|
}));
|
||||||
|
setRequiredBooleanInputs();
|
||||||
|
setInput('secrets', `"PRIVATE_SSH_KEY=test\n\n"`);
|
||||||
|
const context = await import('../src/context.js');
|
||||||
|
await context.getInputs();
|
||||||
|
expect(getInputList).toHaveBeenCalledWith('secrets', {ignoreComma: true, trimWhitespace: false});
|
||||||
|
vi.doUnmock('@docker/actions-toolkit/lib/util.js');
|
||||||
|
gitContextSpy.mockRestore();
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('getArgs', () => {
|
describe('getArgs', () => {
|
||||||
|
|||||||
@ -76,7 +76,7 @@ export async function getInputs(): Promise<Inputs> {
|
|||||||
pull: core.getBooleanInput('pull'),
|
pull: core.getBooleanInput('pull'),
|
||||||
push: core.getBooleanInput('push'),
|
push: core.getBooleanInput('push'),
|
||||||
sbom: core.getInput('sbom'),
|
sbom: core.getInput('sbom'),
|
||||||
secrets: Util.getInputList('secrets', {ignoreComma: true}),
|
secrets: Util.getInputList('secrets', {ignoreComma: true, trimWhitespace: false}),
|
||||||
'secret-envs': Util.getInputList('secret-envs'),
|
'secret-envs': Util.getInputList('secret-envs'),
|
||||||
'secret-files': Util.getInputList('secret-files', {ignoreComma: true}),
|
'secret-files': Util.getInputList('secret-files', {ignoreComma: true}),
|
||||||
'shm-size': core.getInput('shm-size'),
|
'shm-size': core.getInput('shm-size'),
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user