mirror of
https://github.com/docker/build-push-action.git
synced 2025-05-06 21:49:33 +02:00
*: blkid returns non-zero code if no fs found
This commit is contained in:
parent
c32c79337e
commit
3cdd1d81fc
3 changed files with 11 additions and 7 deletions
14
src/main.ts
14
src/main.ts
|
@ -303,14 +303,18 @@ async function getNumCPUs(): Promise<number> {
|
|||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
async function maybeFormatBlockDevice(device: string): Promise<string> {
|
||||
try {
|
||||
// Check if device is formatted with ext4
|
||||
const {stdout} = await execAsync(`sudo blkid -o value -s TYPE ${device}`);
|
||||
if (stdout.trim() === 'ext4') {
|
||||
core.debug(`Device ${device} is already formatted with ext4`);
|
||||
return device;
|
||||
try {
|
||||
const {stdout} = await execAsync(`sudo blkid -o value -s TYPE ${device}`);
|
||||
if (stdout.trim() === 'ext4') {
|
||||
core.debug(`Device ${device} is already formatted with ext4`);
|
||||
return device;
|
||||
}
|
||||
} catch (error) {
|
||||
// blkid returns non-zero if no filesystem found, which is fine
|
||||
core.debug(`No filesystem found on ${device}, will format it`);
|
||||
}
|
||||
|
||||
// Format device with ext4
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue