Compare commits

..

19 Commits

Author SHA1 Message Date
CrazyMax
dbef88086f Merge pull request #374 from docker/dependabot/npm_and_yarn/moment-timezone-0.5.44
chore(deps): Bump moment-timezone from 0.5.43 to 0.5.44
2024-01-05 10:58:01 +01:00
CrazyMax
b73e7a71ac chore: update generated content
Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com>
2024-01-05 10:56:26 +01:00
dependabot[bot]
b9fba690eb chore(deps): Bump moment-timezone from 0.5.43 to 0.5.44
Bumps [moment-timezone](https://github.com/moment/moment-timezone) from 0.5.43 to 0.5.44.
- [Release notes](https://github.com/moment/moment-timezone/releases)
- [Changelog](https://github.com/moment/moment-timezone/blob/develop/changelog.md)
- [Commits](https://github.com/moment/moment-timezone/compare/0.5.43...0.5.44)

---
updated-dependencies:
- dependency-name: moment-timezone
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-01-05 09:54:17 +00:00
CrazyMax
ac82374ba6 Merge pull request #373 from docker/dependabot/npm_and_yarn/moment-2.30.1
chore(deps): Bump moment from 2.29.4 to 2.30.1
2024-01-05 10:51:59 +01:00
CrazyMax
c92519a44e chore: update generated content
Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com>
2024-01-05 10:50:35 +01:00
dependabot[bot]
3b4179d34d chore(deps): Bump moment from 2.29.4 to 2.30.1
Bumps [moment](https://github.com/moment/moment) from 2.29.4 to 2.30.1.
- [Changelog](https://github.com/moment/moment/blob/develop/CHANGELOG.md)
- [Commits](https://github.com/moment/moment/compare/2.29.4...2.30.1)

Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com>

---
updated-dependencies:
- dependency-name: moment
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-01-05 10:49:11 +01:00
CrazyMax
0784993ef8 Merge pull request #371 from docker/dependabot/npm_and_yarn/docker/actions-toolkit-0.16.1
chore(deps): Bump @docker/actions-toolkit from 0.16.0 to 0.16.1
2024-01-05 10:48:32 +01:00
CrazyMax
52c3e9e410 chore: update generated content
Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com>
2024-01-05 10:46:26 +01:00
dependabot[bot]
82a5e6726c chore(deps): Bump @docker/actions-toolkit from 0.16.0 to 0.16.1
Bumps [@docker/actions-toolkit](https://github.com/docker/actions-toolkit) from 0.16.0 to 0.16.1.
- [Release notes](https://github.com/docker/actions-toolkit/releases)
- [Commits](https://github.com/docker/actions-toolkit/compare/v0.16.0...v0.16.1)

---
updated-dependencies:
- dependency-name: "@docker/actions-toolkit"
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-01-05 09:44:28 +00:00
Tõnis Tiigi
41e1fe3437 Merge pull request #370 from crazy-max/bake-cwd
bake: set cwd:// prefix for bake files path
2024-01-04 09:32:49 -08:00
CrazyMax
48cce1cba0 chore: update generated content
Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com>
2024-01-04 10:09:14 +01:00
CrazyMax
61879b94bc bake: set cwd:// prefix for bake files path
Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com>
2024-01-04 10:09:06 +01:00
CrazyMax
36ea4ee555 bake: refactor generateBakeFile
Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com>
2023-12-20 14:48:27 +01:00
CrazyMax
74fa878183 ci: bump buildx to latest
Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com>
2023-12-20 14:38:48 +01:00
CrazyMax
9dc751fe24 Merge pull request #369 from docker/dependabot/npm_and_yarn/docker/actions-toolkit-0.16.0
chore(deps): Bump @docker/actions-toolkit from 0.15.0 to 0.16.0
2023-12-18 11:47:58 +01:00
CrazyMax
c94c54c4e6 chore: update generated content
Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com>
2023-12-15 20:46:50 +01:00
dependabot[bot]
187f09259d chore(deps): Bump @docker/actions-toolkit from 0.15.0 to 0.16.0
Bumps [@docker/actions-toolkit](https://github.com/docker/actions-toolkit) from 0.15.0 to 0.16.0.
- [Release notes](https://github.com/docker/actions-toolkit/releases)
- [Commits](https://github.com/docker/actions-toolkit/compare/v0.15.0...v0.16.0)

---
updated-dependencies:
- dependency-name: "@docker/actions-toolkit"
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-12-15 19:45:27 +00:00
CrazyMax
6d6eaf3451 Merge pull request #365 from docker/dependabot/npm_and_yarn/csv-parse-5.5.3
chore(deps): Bump csv-parse from 5.5.2 to 5.5.3
2023-12-15 20:44:33 +01:00
dependabot[bot]
1484a7ec95 chore(deps): Bump csv-parse from 5.5.2 to 5.5.3
Bumps [csv-parse](https://github.com/adaltas/node-csv/tree/HEAD/packages/csv-parse) from 5.5.2 to 5.5.3.
- [Changelog](https://github.com/adaltas/node-csv/blob/master/packages/csv-parse/CHANGELOG.md)
- [Commits](https://github.com/adaltas/node-csv/commits/csv-parse@5.5.3/packages/csv-parse)

---
updated-dependencies:
- dependency-name: csv-parse
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-12-08 19:40:22 +00:00
7 changed files with 109 additions and 82 deletions

View File

@@ -424,7 +424,7 @@ jobs:
name: Set up Docker Buildx name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3 uses: docker/setup-buildx-action@v3
with: with:
version: v0.12.0-rc1 version: latest
- -
name: Build name: Build
uses: docker/bake-action@v4 uses: docker/bake-action@v4
@@ -455,3 +455,29 @@ jobs:
- -
name: Print envs name: Print envs
run: env|sort run: env|sort
bake-cwd:
runs-on: ubuntu-latest
steps:
-
name: Checkout
uses: actions/checkout@v4
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
with:
version: latest
-
name: Docker meta
id: docker_meta
uses: ./
-
name: Build
uses: docker/bake-action@v4
with:
files: |
./test/docker-bake.hcl
${{ steps.docker_meta.outputs.bake-file-tags }}
${{ steps.docker_meta.outputs.bake-file-labels }}
targets: |
release

14
dist/index.js generated vendored

File diff suppressed because one or more lines are too long

2
dist/index.js.map generated vendored

File diff suppressed because one or more lines are too long

View File

@@ -29,12 +29,12 @@
"dependencies": { "dependencies": {
"@actions/core": "^1.10.1", "@actions/core": "^1.10.1",
"@actions/github": "^6.0.0", "@actions/github": "^6.0.0",
"@docker/actions-toolkit": "^0.15.0", "@docker/actions-toolkit": "^0.16.1",
"@renovate/pep440": "^1.0.0", "@renovate/pep440": "^1.0.0",
"csv-parse": "^5.5.2", "csv-parse": "^5.5.3",
"handlebars": "^4.7.8", "handlebars": "^4.7.8",
"moment": "^2.29.4", "moment": "^2.30.1",
"moment-timezone": "^0.5.43", "moment-timezone": "^0.5.44",
"semver": "^7.5.4" "semver": "^7.5.4"
}, },
"devDependencies": { "devDependencies": {

View File

@@ -94,17 +94,22 @@ actionsToolkit.run(
setOutput('json', JSON.stringify(jsonOutput)); setOutput('json', JSON.stringify(jsonOutput));
}); });
// Specifying local and remote bake files is supported since Buildx 0.12.0.
// Set cwd:// prefix for local bake files to avoid ambiguity with remote
// https://github.com/docker/buildx/pull/1838
const bakeFileCwdPrefix = (await toolkit.buildx.versionSatisfies('>=0.12.0').catch(() => false)) ? 'cwd://' : '';
// Bake files // Bake files
for (const kind of ['tags', 'labels', 'annotations:' + annotationsLevels]) { for (const kind of ['tags', 'labels', 'annotations:' + annotationsLevels]) {
const outputName = kind.split(':')[0]; const outputName = kind.split(':')[0];
const bakeFile: string = meta.getBakeFile(kind); const bakeFile: string = meta.getBakeFile(kind);
await core.group(`Bake file definition (${outputName})`, async () => { await core.group(`Bake file definition (${outputName})`, async () => {
core.info(fs.readFileSync(bakeFile, 'utf8')); core.info(fs.readFileSync(bakeFile, 'utf8'));
setOutput(`bake-file-${outputName}`, bakeFile); setOutput(`bake-file-${outputName}`, `${bakeFileCwdPrefix}${bakeFile}`);
}); });
} }
// Bake file with tags and labels // Bake file with tags and labels
setOutput(`bake-file`, meta.getBakeFileTagsLabels()); setOutput(`bake-file`, `${bakeFileCwdPrefix}${meta.getBakeFileTagsLabels()}`);
} }
); );

View File

@@ -522,15 +522,19 @@ export class Meta {
public getBakeFile(kind: string): string { public getBakeFile(kind: string): string {
if (kind == 'tags') { if (kind == 'tags') {
return this.generateBakeFile(kind, { return this.generateBakeFile(
{
tags: this.getTags(), tags: this.getTags(),
args: { args: {
DOCKER_META_IMAGES: this.getImageNames().join(','), DOCKER_META_IMAGES: this.getImageNames().join(','),
DOCKER_META_VERSION: this.version.main DOCKER_META_VERSION: this.version.main
} }
}); },
kind
);
} else if (kind == 'labels') { } else if (kind == 'labels') {
return this.generateBakeFile(kind, { return this.generateBakeFile(
{
labels: this.getLabels().reduce((res, label) => { labels: this.getLabels().reduce((res, label) => {
const matches = label.match(/([^=]*)=(.*)/); const matches = label.match(/([^=]*)=(.*)/);
if (!matches) { if (!matches) {
@@ -539,28 +543,27 @@ export class Meta {
res[matches[1]] = matches[2]; res[matches[1]] = matches[2];
return res; return res;
}, {}) }, {})
}); },
kind
);
} else if (kind.startsWith('annotations:')) { } else if (kind.startsWith('annotations:')) {
const name = kind.split(':')[0]; const name = kind.split(':')[0];
const annotations: Array<string> = []; const annotations: Array<string> = [];
for (const level of kind.split(':')[1].split(',')) { for (const level of kind.split(':')[1].split(',')) {
annotations.push(...this.getAnnotations().map(label => `${level}:${label}`)); annotations.push(...this.getAnnotations().map(label => `${level}:${label}`));
} }
return this.generateBakeFile(name, { return this.generateBakeFile(
{
annotations: annotations annotations: annotations
}); },
name
);
} }
throw new Error(`Unknown bake file type: ${kind}`); throw new Error(`Unknown bake file type: ${kind}`);
} }
public getBakeFileTagsLabels(): string { public getBakeFileTagsLabels(): string {
const bakeFile = path.join(ToolkitContext.tmpDir(), 'docker-metadata-action-bake.json'); return this.generateBakeFile({
fs.writeFileSync(
bakeFile,
JSON.stringify(
{
target: {
[this.inputs.bakeTarget]: {
tags: this.getTags(), tags: this.getTags(),
labels: this.getLabels().reduce((res, label) => { labels: this.getLabels().reduce((res, label) => {
const matches = label.match(/([^=]*)=(.*)/); const matches = label.match(/([^=]*)=(.*)/);
@@ -574,18 +577,11 @@ export class Meta {
DOCKER_META_IMAGES: this.getImageNames().join(','), DOCKER_META_IMAGES: this.getImageNames().join(','),
DOCKER_META_VERSION: this.version.main DOCKER_META_VERSION: this.version.main
} }
} });
}
},
null,
2
)
);
return bakeFile;
} }
private generateBakeFile(name: string, dt): string { private generateBakeFile(dt, suffix?: string): string {
const bakeFile = path.join(ToolkitContext.tmpDir(), `docker-metadata-action-bake-${name}.json`); const bakeFile = path.join(ToolkitContext.tmpDir(), `docker-metadata-action-bake${suffix ? `-${suffix}` : ''}.json`);
fs.writeFileSync(bakeFile, JSON.stringify({target: {[this.inputs.bakeTarget]: dt}}, null, 2)); fs.writeFileSync(bakeFile, JSON.stringify({target: {[this.inputs.bakeTarget]: dt}}, null, 2));
return bakeFile; return bakeFile;
} }

View File

@@ -773,10 +773,10 @@
dependencies: dependencies:
"@jridgewell/trace-mapping" "0.3.9" "@jridgewell/trace-mapping" "0.3.9"
"@docker/actions-toolkit@^0.15.0": "@docker/actions-toolkit@^0.16.1":
version "0.15.0" version "0.16.1"
resolved "https://registry.yarnpkg.com/@docker/actions-toolkit/-/actions-toolkit-0.15.0.tgz#f52d0a2a10c97e02dc7f82dea843cce1ea5917a5" resolved "https://registry.yarnpkg.com/@docker/actions-toolkit/-/actions-toolkit-0.16.1.tgz#797f843acee50dd3e01e976a6305ce57516b7347"
integrity sha512-9QM3iBEdW+ExxETTIPYhYARaSJU8k9Wrp5+WJvvGu8XgClyiKdOywIWK0Kp+ctUH+1rQzc3m/Z/h9ErZ52LIGg== integrity sha512-RVlNRBJLBdRh3SC+GejtT0z47j5GgTc2hA3sNlWXYw7syQJON++/fgqWn7OqjCmT7c9MtdeqxwT3MTx1WvgSsw==
dependencies: dependencies:
"@actions/cache" "^3.2.2" "@actions/cache" "^3.2.2"
"@actions/core" "^1.10.1" "@actions/core" "^1.10.1"
@@ -788,7 +788,7 @@
"@octokit/core" "^5.0.2" "@octokit/core" "^5.0.2"
"@octokit/plugin-rest-endpoint-methods" "^10.2.0" "@octokit/plugin-rest-endpoint-methods" "^10.2.0"
async-retry "^1.3.3" async-retry "^1.3.3"
csv-parse "^5.5.2" csv-parse "^5.5.3"
handlebars "^4.7.8" handlebars "^4.7.8"
jwt-decode "^4.0.0" jwt-decode "^4.0.0"
semver "^7.5.4" semver "^7.5.4"
@@ -1992,10 +1992,10 @@ cross-spawn@^7.0.2, cross-spawn@^7.0.3:
shebang-command "^2.0.0" shebang-command "^2.0.0"
which "^2.0.1" which "^2.0.1"
csv-parse@*, csv-parse@^5.5.2: csv-parse@*, csv-parse@^5.5.3:
version "5.5.2" version "5.5.3"
resolved "https://registry.yarnpkg.com/csv-parse/-/csv-parse-5.5.2.tgz#ab525e642093dccff7c5cca5c7b71fd3e99fe8f2" resolved "https://registry.yarnpkg.com/csv-parse/-/csv-parse-5.5.3.tgz#0261050761ee46cd0e46421854bf9bf4de1317bf"
integrity sha512-YRVtvdtUNXZCMyK5zd5Wty1W6dNTpGKdqQd4EQ8tl/c6KW1aMBB1Kg1ppky5FONKmEqGJ/8WjLlTNLPne4ioVA== integrity sha512-v0KW6C0qlZzoGjk6u5tLmVfyZxNgPGXZsWTXshpAgKVGmGXzaVWGdlCFxNx5iuzcXT/oJN1HHM9DZKwtAtYa+A==
debug@^4.1.0, debug@^4.1.1: debug@^4.1.0, debug@^4.1.1:
version "4.3.2" version "4.3.2"
@@ -3353,17 +3353,17 @@ minimist@^1.2.5:
resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.6.tgz#8637a5b759ea0d6e98702cfb3a9283323c93af44" resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.6.tgz#8637a5b759ea0d6e98702cfb3a9283323c93af44"
integrity sha512-Jsjnk4bw3YJqYzbdyBiNsPWHPfO++UGG749Cxs6peCu5Xg4nrena6OVxOYxrQTqww0Jmwt+Ref8rggumkTLz9Q== integrity sha512-Jsjnk4bw3YJqYzbdyBiNsPWHPfO++UGG749Cxs6peCu5Xg4nrena6OVxOYxrQTqww0Jmwt+Ref8rggumkTLz9Q==
moment-timezone@^0.5.43: moment-timezone@^0.5.44:
version "0.5.43" version "0.5.44"
resolved "https://registry.yarnpkg.com/moment-timezone/-/moment-timezone-0.5.43.tgz#3dd7f3d0c67f78c23cd1906b9b2137a09b3c4790" resolved "https://registry.yarnpkg.com/moment-timezone/-/moment-timezone-0.5.44.tgz#a64a4e47b68a43deeab5ae4eb4f82da77cdf595f"
integrity sha512-72j3aNyuIsDxdF1i7CEgV2FfxM1r6aaqJyLB2vwb33mXYyoyLly+F1zbWqhA3/bVIoJ4szlUoMbUnVdid32NUQ== integrity sha512-nv3YpzI/8lkQn0U6RkLd+f0W/zy/JnoR5/EyPz/dNkPTBjA2jNLCVxaiQ8QpeLymhSZvX0wCL5s27NQWdOPwAw==
dependencies: dependencies:
moment "^2.29.4" moment "^2.29.4"
moment@^2.29.4: moment@^2.29.4, moment@^2.30.1:
version "2.29.4" version "2.30.1"
resolved "https://registry.yarnpkg.com/moment/-/moment-2.29.4.tgz#3dbe052889fe7c1b2ed966fcb3a77328964ef108" resolved "https://registry.yarnpkg.com/moment/-/moment-2.30.1.tgz#f8c91c07b7a786e30c59926df530b4eac96974ae"
integrity sha512-5LC9SOxjSc2HF6vO2CyuTDNivEdoz2IvyJJGj6X8DJ0eFyfszE0QiEd+iXmBvUP3WHxSjFH/vIsA0EN00cgr8w== integrity sha512-uEmtNhbDOrWPFS+hdjFCBfy9f2YoyzRpwcl+DqpC6taX21FzsTLQVbMV/W7PzNSX6x/bhC1zA3c2UQ5NzH6how==
ms@2.1.2: ms@2.1.2:
version "2.1.2" version "2.1.2"