Skip to content

Commit

Permalink
support binary data when copying secret files
Browse files Browse the repository at this point in the history
Signed-off-by: Matthias Fehr <matthias@monostream.com>
  • Loading branch information
matthiasfehr committed Feb 19, 2025
1 parent b279e57 commit 9692462
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/buildx/build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -139,16 +139,16 @@ export class Build {
}

public static resolveSecret(kvp: string, file: boolean): [string, string] {
const [key, _value] = Build.parseSecretKvp(kvp);
let value = _value;
const [key, value] = Build.parseSecretKvp(kvp);
const secretFile = Context.tmpName({tmpdir: Context.tmpDir()});
if (file) {
if (!fs.existsSync(value)) {
throw new Error(`secret file ${value} not found`);
}
value = fs.readFileSync(value, {encoding: 'utf-8'});
fs.copyFileSync(value, secretFile);
} else {
fs.writeFileSync(secretFile, value);
}
const secretFile = Context.tmpName({tmpdir: Context.tmpDir()});
fs.writeFileSync(secretFile, value);
return [key, secretFile];
}

Expand Down

0 comments on commit 9692462

Please sign in to comment.