Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
af1e73f918 | ||
|
|
da722bde43 | ||
|
|
2916ad60bd | ||
|
|
ca0a662f78 | ||
|
|
c455755a57 | ||
|
|
48351901f8 | ||
|
|
992421c6e6 | ||
|
|
b249b43765 | ||
|
|
1b67977736 | ||
|
|
9d49d6a323 |
@@ -23,7 +23,7 @@ jobs:
|
||||
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
|
||||
-
|
||||
name: Test
|
||||
uses: docker/bake-action@6614cfa25eff9a0b2b2697efb0b6159e7680d584 # v7.2.0
|
||||
uses: docker/bake-action@d3418bd7d0e9324001bca92fa8ba175ea7e6dc9b # v7.3.0
|
||||
with:
|
||||
source: .
|
||||
targets: test
|
||||
|
||||
@@ -37,7 +37,7 @@ jobs:
|
||||
token: ${{ steps.docker-read-app.outputs.token }}
|
||||
-
|
||||
name: Build
|
||||
uses: docker/bake-action@6614cfa25eff9a0b2b2697efb0b6159e7680d584 # v7.2.0
|
||||
uses: docker/bake-action@d3418bd7d0e9324001bca92fa8ba175ea7e6dc9b # v7.3.0
|
||||
with:
|
||||
source: .
|
||||
targets: build
|
||||
|
||||
@@ -26,7 +26,7 @@ jobs:
|
||||
-
|
||||
name: Generate matrix
|
||||
id: generate
|
||||
uses: docker/bake-action/subaction/matrix@6614cfa25eff9a0b2b2697efb0b6159e7680d584 # v7.2.0
|
||||
uses: docker/bake-action/subaction/matrix@d3418bd7d0e9324001bca92fa8ba175ea7e6dc9b # v7.3.0
|
||||
with:
|
||||
target: validate
|
||||
|
||||
@@ -41,6 +41,6 @@ jobs:
|
||||
steps:
|
||||
-
|
||||
name: Validate
|
||||
uses: docker/bake-action@6614cfa25eff9a0b2b2697efb0b6159e7680d584 # v7.2.0
|
||||
uses: docker/bake-action@d3418bd7d0e9324001bca92fa8ba175ea7e6dc9b # v7.3.0
|
||||
with:
|
||||
targets: ${{ matrix.target }}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import {afterEach, expect, test} from 'vitest';
|
||||
import {afterEach, expect, test, vi} from 'vitest';
|
||||
import * as path from 'path';
|
||||
|
||||
import {Buildx} from '@docker/actions-toolkit/lib/buildx/buildx.js';
|
||||
@@ -6,6 +6,7 @@ import {Buildx} from '@docker/actions-toolkit/lib/buildx/buildx.js';
|
||||
import {getAuthList, getInputs} from '../src/context.js';
|
||||
|
||||
afterEach(() => {
|
||||
vi.restoreAllMocks();
|
||||
for (const key of Object.keys(process.env)) {
|
||||
if (key.startsWith('INPUT_')) {
|
||||
delete process.env[key];
|
||||
@@ -33,3 +34,37 @@ test('getAuthList uses the default Docker Hub registry when computing scoped con
|
||||
configDir: path.join(Buildx.configDir, 'config', 'registry-1.docker.io', 'myscope')
|
||||
});
|
||||
});
|
||||
|
||||
test('getAuthList skips secret masking when registry-auth password is absent', async () => {
|
||||
const stdoutWriteSpy = vi.spyOn(process.stdout, 'write').mockImplementation(() => true);
|
||||
const [auth] = getAuthList({
|
||||
registry: '',
|
||||
username: '',
|
||||
password: '',
|
||||
scope: '',
|
||||
ecr: '',
|
||||
logout: true,
|
||||
registryAuth: '- registry: public.ecr.aws\n'
|
||||
});
|
||||
|
||||
expect(stdoutWriteSpy.mock.calls.map(call => call[0]).join('')).not.toContain('::add-mask::');
|
||||
expect(auth).toMatchObject({
|
||||
registry: 'public.ecr.aws',
|
||||
ecr: 'auto'
|
||||
});
|
||||
});
|
||||
|
||||
test('getAuthList masks registry-auth password when present', async () => {
|
||||
const stdoutWriteSpy = vi.spyOn(process.stdout, 'write').mockImplementation(() => true);
|
||||
getAuthList({
|
||||
registry: '',
|
||||
username: '',
|
||||
password: '',
|
||||
scope: '',
|
||||
ecr: '',
|
||||
logout: true,
|
||||
registryAuth: '- registry: ghcr.io\n username: dbowie\n password: groundcontrol\n'
|
||||
});
|
||||
|
||||
expect(stdoutWriteSpy.mock.calls.map(call => call[0]).join('')).toContain('::add-mask::groundcontrol');
|
||||
});
|
||||
|
||||
+138
-167
File diff suppressed because one or more lines are too long
+4
-4
File diff suppressed because one or more lines are too long
+14
-653
File diff suppressed because it is too large
Load Diff
+2
-2
@@ -24,8 +24,8 @@
|
||||
"packageManager": "[email protected]",
|
||||
"dependencies": {
|
||||
"@actions/core": "^3.0.1",
|
||||
"@aws-sdk/client-ecr": "^3.1076.0",
|
||||
"@aws-sdk/client-ecr-public": "^3.1076.0",
|
||||
"@aws-sdk/client-ecr": "^3.1077.0",
|
||||
"@aws-sdk/client-ecr-public": "^3.1077.0",
|
||||
"@docker/actions-toolkit": "^0.92.0",
|
||||
"http-proxy-agent": "^9.1.0",
|
||||
"https-proxy-agent": "^9.1.0",
|
||||
|
||||
+3
-1
@@ -53,7 +53,9 @@ export function getAuthList(inputs: Inputs): Array<Auth> {
|
||||
});
|
||||
} else {
|
||||
auths = (yaml.load(inputs.registryAuth) as Array<Auth>).map(auth => {
|
||||
core.setSecret(auth.password); // redacted in workflow logs
|
||||
if (auth.password) {
|
||||
core.setSecret(auth.password); // redacted in workflow logs
|
||||
}
|
||||
const registry = auth.registry || 'docker.io';
|
||||
return {
|
||||
registry,
|
||||
|
||||
Reference in New Issue
Block a user