mirror of
https://github.com/docker/build-push-action.git
synced 2025-04-20 18:26:46 +00:00
Use csv-parse lib to parse outputs
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
This commit is contained in:
parent
695ef9e5a5
commit
bf051e6237
7 changed files with 1350 additions and 17 deletions
|
@ -1,5 +1,6 @@
|
|||
import fs from 'fs';
|
||||
import path from 'path';
|
||||
import csvparse from 'csv-parse/lib/sync';
|
||||
import * as semver from 'semver';
|
||||
import * as context from './context';
|
||||
import * as exec from './exec';
|
||||
|
@ -26,8 +27,13 @@ export async function getSecret(kvp: string): Promise<string> {
|
|||
}
|
||||
|
||||
export function isLocalOrTarExporter(outputs: string[]): Boolean {
|
||||
for (let output of outputs) {
|
||||
for (let [key, value] of output.split(/\s*,\s*/).map(chunk => chunk.split('='))) {
|
||||
for (let output of csvparse(outputs.join(`\n`), {
|
||||
delimiter: ',',
|
||||
trim: true,
|
||||
columns: false,
|
||||
relax_column_count: true
|
||||
})) {
|
||||
for (let [key, value] of output.map(chunk => chunk.split('=').map(item => item.trim()))) {
|
||||
if (key == 'type' && (value == 'local' || value == 'tar')) {
|
||||
return true;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue