Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 18 additions & 11 deletions .github/workflows/bake.yml
Original file line number Diff line number Diff line change
Expand Up @@ -577,18 +577,21 @@ jobs:
});

const verifyResults = await sigstore.verifySignedManifests(
{ certificateIdentityRegexp: `^https://github.com/docker/github-builder-experimental/.github/workflows/bake.yml.*$` },
{ certificateIdentityRegexp: `^https://github\.com/docker/github-builder-experimental/\.github/workflows/bake\.yml@.*$` },
signResults
);

await core.group(`Verify commands`, async () => {
const verifyCommands = [];
for (const [attestationRef, verifyResult] of Object.entries(verifyResults)) {
const cmd = `cosign ${verifyResult.cosignArgs.join(' ')} ${attestationRef}`;
core.info(cmd);
const cmd = {
executable: 'cosign',
args: [...verifyResult.cosignArgs, attestationRef]
};
core.info(`${cmd.executable} ${cmd.args.join(' ')}`);
verifyCommands.push(cmd);
}
core.setOutput('verify-commands', verifyCommands.join('\n'));
core.setOutput('verify-commands', JSON.stringify(verifyCommands));
});
-
name: Signing local artifacts
Expand All @@ -609,18 +612,21 @@ jobs:
});

const verifyResults = await sigstore.verifySignedArtifacts(
{ certificateIdentityRegexp: `^https://github.com/docker/github-builder-experimental/.github/workflows/bake.yml.*$` },
{ certificateIdentityRegexp: `^https://github\.com/docker/github-builder-experimental/\.github/workflows/bake\.yml@.*$` },
signResults
);

await core.group(`Verify commands`, async () => {
const verifyCommands = [];
for (const [artifactPath, verifyResult] of Object.entries(verifyResults)) {
const cmd = `cosign ${verifyResult.cosignArgs.join(' ')} --bundle ${path.relative(inplocalExportDir, verifyResult.bundlePath)} ${path.relative(inplocalExportDir, artifactPath)}`;
core.info(cmd);
const cmd = {
executable: 'cosign',
args: [...verifyResult.cosignArgs, '--bundle', path.relative(inplocalExportDir, verifyResult.bundlePath), path.relative(inplocalExportDir, artifactPath)]
};
core.info(`${cmd.executable} ${cmd.args.join(' ')}`);
verifyCommands.push(cmd);
}
core.setOutput('verify-commands', verifyCommands.join('\n'));
core.setOutput('verify-commands', JSON.stringify(verifyCommands));
});
-
name: List local output
Expand Down Expand Up @@ -652,7 +658,7 @@ jobs:
const inpArtifactName = core.getInput('artifact-name');

const result = {
verifyCommands: inpVerifyCommands,
verifyCommands: inpVerifyCommands || '[]',
imageDigest: inpImageDigest,
artifactName: inpArtifactName
}
Expand Down Expand Up @@ -759,7 +765,8 @@ jobs:
for (const key of Object.keys(inpBuildOutputs)) {
const output = JSON.parse(inpBuildOutputs[key]);
if (output.verifyCommands) {
verifyCommands.push(output.verifyCommands);
const commands = JSON.parse(output.verifyCommands);
verifyCommands.push(...commands);
}
}
core.setOutput('cosign-verify-commands', verifyCommands.join('\n'));
core.setOutput('cosign-verify-commands', JSON.stringify(verifyCommands));
29 changes: 18 additions & 11 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -471,18 +471,21 @@ jobs:
});

const verifyResults = await sigstore.verifySignedManifests(
{ certificateIdentityRegexp: `^https://github.com/docker/github-builder-experimental/.github/workflows/build.yml.*$` },
{ certificateIdentityRegexp: `^https://github\.com/docker/github-builder-experimental/\.github/workflows/build\.yml@.*$` },
signResults
);

await core.group(`Verify commands`, async () => {
const verifyCommands = [];
for (const [attestationRef, verifyResult] of Object.entries(verifyResults)) {
const cmd = `cosign ${verifyResult.cosignArgs.join(' ')} ${attestationRef}`;
core.info(cmd);
const cmd = {
executable: 'cosign',
args: [...verifyResult.cosignArgs, attestationRef]
};
core.info(`${cmd.executable} ${cmd.args.join(' ')}`);
verifyCommands.push(cmd);
}
core.setOutput('verify-commands', verifyCommands.join('\n'));
core.setOutput('verify-commands', JSON.stringify(verifyCommands));
});
-
name: Signing local artifacts
Expand All @@ -503,18 +506,21 @@ jobs:
});

const verifyResults = await sigstore.verifySignedArtifacts(
{ certificateIdentityRegexp: `^https://github.com/docker/github-builder-experimental/.github/workflows/build.yml.*$` },
{ certificateIdentityRegexp: `^https://github\.com/docker/github-builder-experimental/\.github/workflows/build\.yml@.*$` },
signResults
);

await core.group(`Verify commands`, async () => {
const verifyCommands = [];
for (const [artifactPath, verifyResult] of Object.entries(verifyResults)) {
const cmd = `cosign ${verifyResult.cosignArgs.join(' ')} --bundle ${path.relative(inplocalExportDir, verifyResult.bundlePath)} ${path.relative(inplocalExportDir, artifactPath)}`;
core.info(cmd);
const cmd = {
executable: 'cosign',
args: [...verifyResult.cosignArgs, '--bundle', path.relative(inplocalExportDir, verifyResult.bundlePath), path.relative(inplocalExportDir, artifactPath)]
};
core.info(`${cmd.executable} ${cmd.args.join(' ')}`);
verifyCommands.push(cmd);
}
core.setOutput('verify-commands', verifyCommands.join('\n'));
core.setOutput('verify-commands', JSON.stringify(verifyCommands));
});
-
name: List local output
Expand Down Expand Up @@ -546,7 +552,7 @@ jobs:
const inpArtifactName = core.getInput('artifact-name');

const result = {
verifyCommands: inpVerifyCommands,
verifyCommands: inpVerifyCommands || '[]',
imageDigest: inpImageDigest,
artifactName: inpArtifactName
}
Expand Down Expand Up @@ -652,7 +658,8 @@ jobs:
for (const key of Object.keys(inpBuildOutputs)) {
const output = JSON.parse(inpBuildOutputs[key]);
if (output.verifyCommands) {
verifyCommands.push(output.verifyCommands);
const commands = JSON.parse(output.verifyCommands);
verifyCommands.push(...commands);
}
}
core.setOutput('cosign-verify-commands', verifyCommands.join('\n'));
core.setOutput('cosign-verify-commands', JSON.stringify(verifyCommands));
5 changes: 3 additions & 2 deletions .github/workflows/verify.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ jobs:
INPUT_COSIGN-VERIFY-COMMANDS: ${{ steps.vars.outputs.cosign-verify-commands }}
with:
script: |
for (const cmd of core.getMultilineInput('cosign-verify-commands')) {
await exec.exec(cmd);
const commands = JSON.parse(core.getInput('cosign-verify-commands'));
for (const cmd of commands) {
await exec.exec(cmd.executable, cmd.args);
}