diff --git a/dist/index.js b/dist/index.js index 99fd018..59cc085 100644 --- a/dist/index.js +++ b/dist/index.js @@ -931,6 +931,7 @@ const mapImListOutput = (output, options) => { container: serviceLine.ContainerName, repository: serviceLine.Repository, tag: serviceLine.Tag, + platform: serviceLine.Platform || '', id: idFragment }; }); @@ -943,6 +944,7 @@ const mapImListOutput = (output, options) => { .map((line) => { // the line has the columns in the following order: // CONTAINER REPOSITORY TAG IMAGE ID SIZE + // Note: newer docker compose versions may include PLATFORM column const lineColumns = line.split(/\s{3,}/); const containerFragment = lineColumns[0] || line; const repositoryFragment = lineColumns[1] || ''; @@ -952,6 +954,7 @@ const mapImListOutput = (output, options) => { container: containerFragment.trim(), repository: repositoryFragment.trim(), tag: tagFragment.trim(), + platform: '', id: idFragment.trim() }; }); @@ -1238,8 +1241,13 @@ const ps = async function (options) { exports.ps = ps; const images = async function (options) { try { - const result = await (0, exports.execCompose)('images', [], options); - const data = (0, exports.mapImListOutput)(result.out, options); + // Always use JSON format for robust parsing across docker compose versions + const jsonOptions = { + ...options, + commandOptions: [...(options?.commandOptions || []), ['--format', 'json']] + }; + const result = await (0, exports.execCompose)('images', [], jsonOptions); + const data = (0, exports.mapImListOutput)(result.out, jsonOptions); return { ...result, data diff --git a/dist/post.js b/dist/post.js index 1e013b8..3128a34 100644 --- a/dist/post.js +++ b/dist/post.js @@ -88,6 +88,7 @@ const mapImListOutput = (output, options) => { container: serviceLine.ContainerName, repository: serviceLine.Repository, tag: serviceLine.Tag, + platform: serviceLine.Platform || '', id: idFragment }; }); @@ -100,6 +101,7 @@ const mapImListOutput = (output, options) => { .map((line) => { // the line has the columns in the following order: // CONTAINER REPOSITORY TAG IMAGE ID SIZE + // Note: newer docker compose versions may include PLATFORM column const lineColumns = line.split(/\s{3,}/); const containerFragment = lineColumns[0] || line; const repositoryFragment = lineColumns[1] || ''; @@ -109,6 +111,7 @@ const mapImListOutput = (output, options) => { container: containerFragment.trim(), repository: repositoryFragment.trim(), tag: tagFragment.trim(), + platform: '', id: idFragment.trim() }; }); @@ -395,8 +398,13 @@ const ps = async function (options) { exports.ps = ps; const images = async function (options) { try { - const result = await (0, exports.execCompose)('images', [], options); - const data = (0, exports.mapImListOutput)(result.out, options); + // Always use JSON format for robust parsing across docker compose versions + const jsonOptions = { + ...options, + commandOptions: [...(options?.commandOptions || []), ['--format', 'json']] + }; + const result = await (0, exports.execCompose)('images', [], jsonOptions); + const data = (0, exports.mapImListOutput)(result.out, jsonOptions); return { ...result, data diff --git a/package-lock.json b/package-lock.json index b8846f0..aab72b8 100644 --- a/package-lock.json +++ b/package-lock.json @@ -13,7 +13,7 @@ "@actions/github": "^9.0.0", "@actions/tool-cache": "^4.0.0", "@octokit/action": "^8.0.4", - "docker-compose": "^1.3.0" + "docker-compose": "^1.3.1" }, "devDependencies": { "@ts-dev-tools/core": "^1.9.14", @@ -5731,9 +5731,9 @@ } }, "node_modules/docker-compose": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/docker-compose/-/docker-compose-1.3.0.tgz", - "integrity": "sha512-7Gevk/5eGD50+eMD+XDnFnOrruFkL0kSd7jEG4cjmqweDSUhB7i0g8is/nBdVpl+Bx338SqIB2GLKm32M+Vs6g==", + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/docker-compose/-/docker-compose-1.3.1.tgz", + "integrity": "sha512-rF0wH69G3CCcmkN9J1RVMQBaKe8o77LT/3XmqcLIltWWVxcWAzp2TnO7wS3n/umZHN3/EVrlT3exSBMal+Ou1w==", "license": "MIT", "dependencies": { "yaml": "^2.2.2" diff --git a/package.json b/package.json index be1f1bf..460c157 100644 --- a/package.json +++ b/package.json @@ -29,7 +29,7 @@ "@actions/github": "^9.0.0", "@actions/tool-cache": "^4.0.0", "@octokit/action": "^8.0.4", - "docker-compose": "^1.3.0" + "docker-compose": "^1.3.1" }, "devDependencies": { "@ts-dev-tools/core": "^1.9.14",