Compare commits
No commits in common. "master" and "releases/v4" have entirely different histories.
master
...
releases/v
@ -1,12 +1,2 @@
|
|||||||
/coverage
|
/coverage
|
||||||
|
/node_modules
|
||||||
# Dependency directories
|
|
||||||
node_modules/
|
|
||||||
jspm_packages/
|
|
||||||
|
|
||||||
# yarn v2
|
|
||||||
.yarn/cache
|
|
||||||
.yarn/unplugged
|
|
||||||
.yarn/build-state.yml
|
|
||||||
.yarn/install-state.gz
|
|
||||||
.pnp.*
|
|
||||||
|
@ -1,3 +0,0 @@
|
|||||||
/dist/**
|
|
||||||
/coverage/**
|
|
||||||
/node_modules/**
|
|
@ -1,19 +1,18 @@
|
|||||||
{
|
{
|
||||||
"env": {
|
"env": {
|
||||||
"node": true,
|
"node": true,
|
||||||
"es6": true,
|
"es2021": true,
|
||||||
"jest": true
|
"jest/globals": true
|
||||||
},
|
},
|
||||||
"extends": [
|
"extends": [
|
||||||
"eslint:recommended",
|
"eslint:recommended",
|
||||||
"plugin:@typescript-eslint/eslint-recommended",
|
|
||||||
"plugin:@typescript-eslint/recommended",
|
"plugin:@typescript-eslint/recommended",
|
||||||
"plugin:jest/recommended",
|
"plugin:jest/recommended",
|
||||||
"plugin:prettier/recommended"
|
"plugin:prettier/recommended"
|
||||||
],
|
],
|
||||||
"parser": "@typescript-eslint/parser",
|
"parser": "@typescript-eslint/parser",
|
||||||
"parserOptions": {
|
"parserOptions": {
|
||||||
"ecmaVersion": 2023,
|
"ecmaVersion": "latest",
|
||||||
"sourceType": "module"
|
"sourceType": "module"
|
||||||
},
|
},
|
||||||
"plugins": [
|
"plugins": [
|
||||||
|
2
.gitattributes
vendored
2
.gitattributes
vendored
@ -1,5 +1,3 @@
|
|||||||
/.yarn/releases/** binary
|
|
||||||
/.yarn/plugins/** binary
|
|
||||||
/__tests__/fixtures/** -linguist-detectable
|
/__tests__/fixtures/** -linguist-detectable
|
||||||
/dist/** linguist-generated=true
|
/dist/** linguist-generated=true
|
||||||
/lib/** linguist-generated=true
|
/lib/** linguist-generated=true
|
||||||
|
1
.github/CODEOWNERS
vendored
Normal file
1
.github/CODEOWNERS
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
* @crazy-max
|
3
.github/CODE_OF_CONDUCT.md
vendored
3
.github/CODE_OF_CONDUCT.md
vendored
@ -1,3 +0,0 @@
|
|||||||
# Code of conduct
|
|
||||||
|
|
||||||
- [Moby community guidelines](https://github.com/moby/moby/blob/master/CONTRIBUTING.md#moby-community-guidelines)
|
|
101
.github/ISSUE_TEMPLATE/bug.yml
vendored
101
.github/ISSUE_TEMPLATE/bug.yml
vendored
@ -1,101 +0,0 @@
|
|||||||
# https://docs.github.com/en/communities/using-templates-to-encourage-useful-issues-and-pull-requests/syntax-for-githubs-form-schema
|
|
||||||
name: Bug Report
|
|
||||||
description: Report a bug
|
|
||||||
labels:
|
|
||||||
- status/triage
|
|
||||||
|
|
||||||
body:
|
|
||||||
- type: markdown
|
|
||||||
attributes:
|
|
||||||
value: |
|
|
||||||
Thank you for taking the time to report a bug!
|
|
||||||
If this is a security issue please report it to the [Docker Security team](mailto:security@docker.com).
|
|
||||||
|
|
||||||
- type: checkboxes
|
|
||||||
attributes:
|
|
||||||
label: Contributing guidelines
|
|
||||||
description: >
|
|
||||||
Make sure you've read the contributing guidelines before proceeding.
|
|
||||||
options:
|
|
||||||
- label: I've read the [contributing guidelines](https://github.com/docker/metadata-action/blob/master/.github/CONTRIBUTING.md) and wholeheartedly agree
|
|
||||||
required: true
|
|
||||||
|
|
||||||
- type: checkboxes
|
|
||||||
attributes:
|
|
||||||
label: "I've found a bug, and:"
|
|
||||||
description: |
|
|
||||||
Make sure that your request fulfills all of the following requirements.
|
|
||||||
If one requirement cannot be satisfied, explain in detail why.
|
|
||||||
options:
|
|
||||||
- label: The documentation does not mention anything about my problem
|
|
||||||
- label: There are no open or closed issues that are related to my problem
|
|
||||||
|
|
||||||
- type: textarea
|
|
||||||
attributes:
|
|
||||||
label: Description
|
|
||||||
description: >
|
|
||||||
Provide a brief description of the bug in 1-2 sentences.
|
|
||||||
validations:
|
|
||||||
required: true
|
|
||||||
|
|
||||||
- type: textarea
|
|
||||||
attributes:
|
|
||||||
label: Expected behaviour
|
|
||||||
description: >
|
|
||||||
Describe precisely what you'd expect to happen.
|
|
||||||
validations:
|
|
||||||
required: true
|
|
||||||
|
|
||||||
- type: textarea
|
|
||||||
attributes:
|
|
||||||
label: Actual behaviour
|
|
||||||
description: >
|
|
||||||
Describe precisely what is actually happening.
|
|
||||||
validations:
|
|
||||||
required: true
|
|
||||||
|
|
||||||
- type: input
|
|
||||||
attributes:
|
|
||||||
label: Repository URL
|
|
||||||
description: >
|
|
||||||
Enter the URL of the repository where you are experiencing the
|
|
||||||
issue. If your repository is private, provide a link to a minimal
|
|
||||||
repository that reproduces the issue.
|
|
||||||
|
|
||||||
- type: input
|
|
||||||
attributes:
|
|
||||||
label: Workflow run URL
|
|
||||||
description: >
|
|
||||||
Enter the URL of the GitHub Action workflow run if public (e.g.
|
|
||||||
`https://github.com/<user>/<repo>/actions/runs/<id>`)
|
|
||||||
|
|
||||||
- type: textarea
|
|
||||||
attributes:
|
|
||||||
label: YAML workflow
|
|
||||||
description: |
|
|
||||||
Provide the YAML of the workflow that's causing the issue.
|
|
||||||
Make sure to remove any sensitive information.
|
|
||||||
render: yaml
|
|
||||||
validations:
|
|
||||||
required: true
|
|
||||||
|
|
||||||
- type: textarea
|
|
||||||
attributes:
|
|
||||||
label: Workflow logs
|
|
||||||
description: >
|
|
||||||
[Attach](https://docs.github.com/en/get-started/writing-on-github/working-with-advanced-formatting/attaching-files)
|
|
||||||
the [log file of your workflow run](https://docs.github.com/en/actions/managing-workflow-runs/using-workflow-run-logs#downloading-logs)
|
|
||||||
and make sure to remove any sensitive information.
|
|
||||||
|
|
||||||
- type: textarea
|
|
||||||
attributes:
|
|
||||||
label: BuildKit logs
|
|
||||||
description: >
|
|
||||||
If applicable, provide the [BuildKit container logs](https://docs.docker.com/build/ci/github-actions/configure-builder/#buildkit-container-logs)
|
|
||||||
render: text
|
|
||||||
|
|
||||||
- type: textarea
|
|
||||||
attributes:
|
|
||||||
label: Additional info
|
|
||||||
description: |
|
|
||||||
Provide any additional information that could be useful.
|
|
34
.github/ISSUE_TEMPLATE/bug_report.md
vendored
Normal file
34
.github/ISSUE_TEMPLATE/bug_report.md
vendored
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
---
|
||||||
|
name: Bug report
|
||||||
|
about: Create a report to help us improve
|
||||||
|
---
|
||||||
|
|
||||||
|
### Behaviour
|
||||||
|
|
||||||
|
#### Steps to reproduce this issue
|
||||||
|
|
||||||
|
1.
|
||||||
|
2.
|
||||||
|
3.
|
||||||
|
|
||||||
|
#### Expected behaviour
|
||||||
|
|
||||||
|
> Tell us what should happen
|
||||||
|
|
||||||
|
#### Actual behaviour
|
||||||
|
|
||||||
|
> Tell us what happens instead
|
||||||
|
|
||||||
|
### Configuration
|
||||||
|
|
||||||
|
* Repository URL (if public):
|
||||||
|
* Build URL (if public):
|
||||||
|
|
||||||
|
```yml
|
||||||
|
# paste your YAML workflow file here and remove sensitive data
|
||||||
|
```
|
||||||
|
|
||||||
|
### Logs
|
||||||
|
|
||||||
|
> Download the [log file of your build](https://docs.github.com/en/actions/managing-workflow-runs/using-workflow-run-logs#downloading-logs)
|
||||||
|
> and [attach it](https://docs.github.com/en/github/managing-your-work-on-github/file-attachments-on-issues-and-pull-requests) to this issue.
|
9
.github/ISSUE_TEMPLATE/config.yml
vendored
9
.github/ISSUE_TEMPLATE/config.yml
vendored
@ -1,9 +0,0 @@
|
|||||||
# https://docs.github.com/en/communities/using-templates-to-encourage-useful-issues-and-pull-requests/configuring-issue-templates-for-your-repository#configuring-the-template-chooser
|
|
||||||
blank_issues_enabled: true
|
|
||||||
contact_links:
|
|
||||||
- name: Questions and Discussions
|
|
||||||
url: https://github.com/docker/metadata-action/discussions/new
|
|
||||||
about: Use Github Discussions to ask questions and/or open discussion topics.
|
|
||||||
- name: Documentation
|
|
||||||
url: https://docs.docker.com/build/ci/github-actions/
|
|
||||||
about: Read the documentation.
|
|
15
.github/ISSUE_TEMPLATE/feature.yml
vendored
15
.github/ISSUE_TEMPLATE/feature.yml
vendored
@ -1,15 +0,0 @@
|
|||||||
# https://docs.github.com/en/communities/using-templates-to-encourage-useful-issues-and-pull-requests/syntax-for-githubs-form-schema
|
|
||||||
name: Feature request
|
|
||||||
description: Missing functionality? Come tell us about it!
|
|
||||||
labels:
|
|
||||||
- kind/enhancement
|
|
||||||
- status/triage
|
|
||||||
|
|
||||||
body:
|
|
||||||
- type: textarea
|
|
||||||
id: description
|
|
||||||
attributes:
|
|
||||||
label: Description
|
|
||||||
description: What is the feature you want to see?
|
|
||||||
validations:
|
|
||||||
required: true
|
|
12
.github/SECURITY.md
vendored
12
.github/SECURITY.md
vendored
@ -1,12 +0,0 @@
|
|||||||
# Reporting security issues
|
|
||||||
|
|
||||||
The project maintainers take security seriously. If you discover a security
|
|
||||||
issue, please bring it to their attention right away!
|
|
||||||
|
|
||||||
**Please _DO NOT_ file a public issue**, instead send your report privately to
|
|
||||||
[security@docker.com](mailto:security@docker.com).
|
|
||||||
|
|
||||||
Security reports are greatly appreciated, and we will publicly thank you for it.
|
|
||||||
We also like to send gifts—if you'd like Docker swag, make sure to let
|
|
||||||
us know. We currently do not offer a paid security bounty program, but are not
|
|
||||||
ruling it out in the future.
|
|
32
.github/SUPPORT.md
vendored
Normal file
32
.github/SUPPORT.md
vendored
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
# Support [](https://isitmaintained.com/project/docker/metadata-action)
|
||||||
|
|
||||||
|
## Reporting an issue
|
||||||
|
|
||||||
|
Please do a search in [open issues](https://github.com/docker/metadata-action/issues?utf8=%E2%9C%93&q=) to see if the
|
||||||
|
issue or feature request has already been filed.
|
||||||
|
|
||||||
|
If you find your issue already exists, make relevant comments and add your
|
||||||
|
[reaction](https://github.com/blog/2119-add-reactions-to-pull-requests-issues-and-comments). Use a reaction in place
|
||||||
|
of a "+1" comment.
|
||||||
|
|
||||||
|
:+1: - upvote
|
||||||
|
|
||||||
|
:-1: - downvote
|
||||||
|
|
||||||
|
If you cannot find an existing issue that describes your bug or feature, submit an issue using the guidelines below.
|
||||||
|
|
||||||
|
## Writing good bug reports and feature requests
|
||||||
|
|
||||||
|
File a single issue per problem and feature request.
|
||||||
|
|
||||||
|
* Do not enumerate multiple bugs or feature requests in the same issue.
|
||||||
|
* Do not add your issue as a comment to an existing issue unless it's for the identical input. Many issues look similar, but have different causes.
|
||||||
|
|
||||||
|
The more information you can provide, the more likely someone will be successful reproducing the issue and finding a fix.
|
||||||
|
|
||||||
|
You are now ready to [create a new issue](https://github.com/docker/metadata-action/issues/new/choose)!
|
||||||
|
|
||||||
|
## Closure policy
|
||||||
|
|
||||||
|
* Issues that don't have the information requested above (when applicable) will be closed immediately and the poster directed to the support guidelines.
|
||||||
|
* Issues that go a week without a response from original poster are subject to closure at our discretion.
|
1
.github/dependabot.yml
vendored
1
.github/dependabot.yml
vendored
@ -11,7 +11,6 @@ updates:
|
|||||||
directory: "/"
|
directory: "/"
|
||||||
schedule:
|
schedule:
|
||||||
interval: "daily"
|
interval: "daily"
|
||||||
versioning-strategy: "increase"
|
|
||||||
allow:
|
allow:
|
||||||
- dependency-type: "production"
|
- dependency-type: "production"
|
||||||
labels:
|
labels:
|
||||||
|
237
.github/workflows/ci.yml
vendored
237
.github/workflows/ci.yml
vendored
@ -1,9 +1,5 @@
|
|||||||
name: ci
|
name: ci
|
||||||
|
|
||||||
concurrency:
|
|
||||||
group: ${{ github.workflow }}-${{ github.ref }}
|
|
||||||
cancel-in-progress: true
|
|
||||||
|
|
||||||
on:
|
on:
|
||||||
schedule:
|
schedule:
|
||||||
- cron: '0 10 * * *'
|
- cron: '0 10 * * *'
|
||||||
@ -17,7 +13,6 @@ on:
|
|||||||
|
|
||||||
env:
|
env:
|
||||||
DOCKER_IMAGE: localhost:5000/name/app
|
DOCKER_IMAGE: localhost:5000/name/app
|
||||||
BUILDX_VERSION: latest
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
multi-images:
|
multi-images:
|
||||||
@ -25,13 +20,7 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
-
|
-
|
||||||
name: Checkout
|
name: Checkout
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v3
|
||||||
-
|
|
||||||
name: Set up Docker Buildx
|
|
||||||
uses: docker/setup-buildx-action@v3
|
|
||||||
with:
|
|
||||||
version: ${{ env.BUILDX_VERSION }}
|
|
||||||
driver: docker
|
|
||||||
-
|
-
|
||||||
name: Docker meta
|
name: Docker meta
|
||||||
uses: ./
|
uses: ./
|
||||||
@ -62,13 +51,7 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
-
|
-
|
||||||
name: Checkout
|
name: Checkout
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v3
|
||||||
-
|
|
||||||
name: Set up Docker Buildx
|
|
||||||
uses: docker/setup-buildx-action@v3
|
|
||||||
with:
|
|
||||||
version: ${{ env.BUILDX_VERSION }}
|
|
||||||
driver: docker
|
|
||||||
-
|
-
|
||||||
name: Docker meta
|
name: Docker meta
|
||||||
uses: ./
|
uses: ./
|
||||||
@ -98,13 +81,7 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
-
|
-
|
||||||
name: Checkout
|
name: Checkout
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v3
|
||||||
-
|
|
||||||
name: Set up Docker Buildx
|
|
||||||
uses: docker/setup-buildx-action@v3
|
|
||||||
with:
|
|
||||||
version: ${{ env.BUILDX_VERSION }}
|
|
||||||
driver: docker
|
|
||||||
-
|
-
|
||||||
name: Docker meta
|
name: Docker meta
|
||||||
uses: ./
|
uses: ./
|
||||||
@ -132,13 +109,7 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
-
|
-
|
||||||
name: Checkout
|
name: Checkout
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v3
|
||||||
-
|
|
||||||
name: Set up Docker Buildx
|
|
||||||
uses: docker/setup-buildx-action@v3
|
|
||||||
with:
|
|
||||||
version: ${{ env.BUILDX_VERSION }}
|
|
||||||
driver: docker
|
|
||||||
-
|
-
|
||||||
name: Docker meta
|
name: Docker meta
|
||||||
uses: ./
|
uses: ./
|
||||||
@ -163,13 +134,7 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
-
|
-
|
||||||
name: Checkout
|
name: Checkout
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v3
|
||||||
-
|
|
||||||
name: Set up Docker Buildx
|
|
||||||
uses: docker/setup-buildx-action@v3
|
|
||||||
with:
|
|
||||||
version: ${{ env.BUILDX_VERSION }}
|
|
||||||
driver: docker
|
|
||||||
-
|
-
|
||||||
name: Docker meta
|
name: Docker meta
|
||||||
uses: ./
|
uses: ./
|
||||||
@ -186,13 +151,7 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
-
|
-
|
||||||
name: Checkout
|
name: Checkout
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v3
|
||||||
-
|
|
||||||
name: Set up Docker Buildx
|
|
||||||
uses: docker/setup-buildx-action@v3
|
|
||||||
with:
|
|
||||||
version: ${{ env.BUILDX_VERSION }}
|
|
||||||
driver: docker
|
|
||||||
-
|
-
|
||||||
name: Docker meta
|
name: Docker meta
|
||||||
uses: ./
|
uses: ./
|
||||||
@ -202,18 +161,12 @@ jobs:
|
|||||||
name=ghcr.io/name/app,enable=${{ github.event_name == 'pull_request' }}
|
name=ghcr.io/name/app,enable=${{ github.event_name == 'pull_request' }}
|
||||||
name=ghcr.io/name/release,enable=${{ startsWith(github.ref, 'refs/tags/') }}
|
name=ghcr.io/name/release,enable=${{ startsWith(github.ref, 'refs/tags/') }}
|
||||||
|
|
||||||
custom-labels-annotations:
|
labels:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
-
|
-
|
||||||
name: Checkout
|
name: Checkout
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v3
|
||||||
-
|
|
||||||
name: Set up Docker Buildx
|
|
||||||
uses: docker/setup-buildx-action@v3
|
|
||||||
with:
|
|
||||||
version: ${{ env.BUILDX_VERSION }}
|
|
||||||
driver: docker
|
|
||||||
-
|
-
|
||||||
name: Docker meta
|
name: Docker meta
|
||||||
uses: ./
|
uses: ./
|
||||||
@ -226,24 +179,13 @@ jobs:
|
|||||||
org.opencontainers.image.title=MyCustomTitle
|
org.opencontainers.image.title=MyCustomTitle
|
||||||
org.opencontainers.image.description=this is a "good" example
|
org.opencontainers.image.description=this is a "good" example
|
||||||
org.opencontainers.image.vendor=MyCompany
|
org.opencontainers.image.vendor=MyCompany
|
||||||
annotations: |
|
|
||||||
maintainer=Foo
|
|
||||||
org.opencontainers.image.title=MyFooTitle
|
|
||||||
org.opencontainers.image.description=this is a "foo" example
|
|
||||||
org.opencontainers.image.vendor=MyFooCompany
|
|
||||||
|
|
||||||
global-exps:
|
global-exps:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
-
|
-
|
||||||
name: Checkout
|
name: Checkout
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v3
|
||||||
-
|
|
||||||
name: Set up Docker Buildx
|
|
||||||
uses: docker/setup-buildx-action@v3
|
|
||||||
with:
|
|
||||||
version: ${{ env.BUILDX_VERSION }}
|
|
||||||
driver: docker
|
|
||||||
-
|
-
|
||||||
name: Docker meta
|
name: Docker meta
|
||||||
uses: ./
|
uses: ./
|
||||||
@ -264,13 +206,7 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
-
|
-
|
||||||
name: Checkout
|
name: Checkout
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v3
|
||||||
-
|
|
||||||
name: Set up Docker Buildx
|
|
||||||
uses: docker/setup-buildx-action@v3
|
|
||||||
with:
|
|
||||||
version: ${{ env.BUILDX_VERSION }}
|
|
||||||
driver: docker
|
|
||||||
-
|
-
|
||||||
name: Docker meta
|
name: Docker meta
|
||||||
id: meta
|
id: meta
|
||||||
@ -299,13 +235,7 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
-
|
-
|
||||||
name: Checkout
|
name: Checkout
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v3
|
||||||
-
|
|
||||||
name: Set up Docker Buildx
|
|
||||||
uses: docker/setup-buildx-action@v3
|
|
||||||
with:
|
|
||||||
version: ${{ env.BUILDX_VERSION }}
|
|
||||||
driver-opts: network=host
|
|
||||||
-
|
-
|
||||||
name: Docker meta
|
name: Docker meta
|
||||||
id: docker_meta
|
id: docker_meta
|
||||||
@ -322,9 +252,17 @@ jobs:
|
|||||||
type=semver,pattern=v{{major}}.{{minor}}
|
type=semver,pattern=v{{major}}.{{minor}}
|
||||||
type=semver,pattern=v{{major}}
|
type=semver,pattern=v{{major}}
|
||||||
type=sha
|
type=sha
|
||||||
|
-
|
||||||
|
name: Set up QEMU
|
||||||
|
uses: docker/setup-qemu-action@v2
|
||||||
|
-
|
||||||
|
name: Set up Docker Buildx
|
||||||
|
uses: docker/setup-buildx-action@v2
|
||||||
|
with:
|
||||||
|
driver-opts: network=host
|
||||||
-
|
-
|
||||||
name: Build and push to local registry
|
name: Build and push to local registry
|
||||||
uses: docker/build-push-action@v6
|
uses: docker/build-push-action@v4
|
||||||
with:
|
with:
|
||||||
context: ./test
|
context: ./test
|
||||||
file: ./test/Dockerfile
|
file: ./test/Dockerfile
|
||||||
@ -351,12 +289,7 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
-
|
-
|
||||||
name: Checkout
|
name: Checkout
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v3
|
||||||
-
|
|
||||||
name: Set up Docker Buildx
|
|
||||||
uses: docker/setup-buildx-action@v3
|
|
||||||
with:
|
|
||||||
version: ${{ env.BUILDX_VERSION }}
|
|
||||||
-
|
-
|
||||||
name: Docker meta
|
name: Docker meta
|
||||||
id: docker_meta
|
id: docker_meta
|
||||||
@ -374,14 +307,19 @@ jobs:
|
|||||||
type=semver,pattern={{major}}.{{minor}}
|
type=semver,pattern={{major}}.{{minor}}
|
||||||
type=semver,pattern={{major}}
|
type=semver,pattern={{major}}
|
||||||
type=sha
|
type=sha
|
||||||
|
-
|
||||||
|
name: Set up QEMU
|
||||||
|
uses: docker/setup-qemu-action@v2
|
||||||
|
-
|
||||||
|
name: Set up Docker Buildx
|
||||||
|
uses: docker/setup-buildx-action@v2
|
||||||
-
|
-
|
||||||
name: Build
|
name: Build
|
||||||
uses: docker/bake-action@v5
|
uses: docker/bake-action@v3
|
||||||
with:
|
with:
|
||||||
files: |
|
files: |
|
||||||
./test/docker-bake.hcl
|
./test/docker-bake.hcl
|
||||||
${{ steps.docker_meta.outputs.bake-file-tags }}
|
${{ steps.docker_meta.outputs.bake-file }}
|
||||||
${{ steps.docker_meta.outputs.bake-file-labels }}
|
|
||||||
targets: |
|
targets: |
|
||||||
release
|
release
|
||||||
|
|
||||||
@ -396,13 +334,7 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
-
|
-
|
||||||
name: Checkout
|
name: Checkout
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v3
|
||||||
-
|
|
||||||
name: Set up Docker Buildx
|
|
||||||
uses: docker/setup-buildx-action@v3
|
|
||||||
with:
|
|
||||||
version: ${{ env.BUILDX_VERSION }}
|
|
||||||
driver: docker
|
|
||||||
-
|
-
|
||||||
name: Docker meta
|
name: Docker meta
|
||||||
id: meta
|
id: meta
|
||||||
@ -414,7 +346,7 @@ jobs:
|
|||||||
sep-tags: ${{ matrix.sep }}
|
sep-tags: ${{ matrix.sep }}
|
||||||
-
|
-
|
||||||
name: Tags
|
name: Tags
|
||||||
uses: actions/github-script@v7
|
uses: actions/github-script@v6
|
||||||
with:
|
with:
|
||||||
script: |
|
script: |
|
||||||
console.log(`${{ steps.meta.outputs.tags }}`);
|
console.log(`${{ steps.meta.outputs.tags }}`);
|
||||||
@ -424,13 +356,7 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
-
|
-
|
||||||
name: Checkout
|
name: Checkout
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v3
|
||||||
-
|
|
||||||
name: Set up Docker Buildx
|
|
||||||
uses: docker/setup-buildx-action@v3
|
|
||||||
with:
|
|
||||||
version: ${{ env.BUILDX_VERSION }}
|
|
||||||
driver: docker
|
|
||||||
-
|
-
|
||||||
name: Docker meta
|
name: Docker meta
|
||||||
id: meta
|
id: meta
|
||||||
@ -441,11 +367,9 @@ jobs:
|
|||||||
ghcr.io/name/app
|
ghcr.io/name/app
|
||||||
labels: |
|
labels: |
|
||||||
maintainer=CrazyMax
|
maintainer=CrazyMax
|
||||||
annotations: |
|
|
||||||
maintainer=Foo
|
|
||||||
-
|
-
|
||||||
name: Build
|
name: Build
|
||||||
uses: docker/build-push-action@v6
|
uses: docker/build-push-action@v4
|
||||||
with:
|
with:
|
||||||
context: ./test
|
context: ./test
|
||||||
file: ./test/output.Dockerfile
|
file: ./test/output.Dockerfile
|
||||||
@ -453,99 +377,4 @@ jobs:
|
|||||||
DOCKER_METADATA_OUTPUT_VERSION
|
DOCKER_METADATA_OUTPUT_VERSION
|
||||||
DOCKER_METADATA_OUTPUT_TAGS
|
DOCKER_METADATA_OUTPUT_TAGS
|
||||||
DOCKER_METADATA_OUTPUT_LABELS
|
DOCKER_METADATA_OUTPUT_LABELS
|
||||||
DOCKER_METADATA_OUTPUT_ANNOTATIONS
|
|
||||||
DOCKER_METADATA_OUTPUT_JSON
|
DOCKER_METADATA_OUTPUT_JSON
|
||||||
|
|
||||||
bake-annotations:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
-
|
|
||||||
name: Checkout
|
|
||||||
uses: actions/checkout@v4
|
|
||||||
-
|
|
||||||
name: Set up Docker Buildx
|
|
||||||
uses: docker/setup-buildx-action@v3
|
|
||||||
with:
|
|
||||||
version: ${{ env.BUILDX_VERSION }}
|
|
||||||
-
|
|
||||||
name: Docker meta
|
|
||||||
id: docker_meta
|
|
||||||
uses: ./
|
|
||||||
with:
|
|
||||||
images: |
|
|
||||||
${{ env.DOCKER_IMAGE }}
|
|
||||||
ghcr.io/name/app
|
|
||||||
tags: |
|
|
||||||
type=schedule
|
|
||||||
type=ref,event=branch
|
|
||||||
type=ref,event=tag
|
|
||||||
type=ref,event=pr
|
|
||||||
type=semver,pattern={{version}}
|
|
||||||
type=semver,pattern={{major}}.{{minor}}
|
|
||||||
type=semver,pattern={{major}}
|
|
||||||
type=sha
|
|
||||||
env:
|
|
||||||
DOCKER_METADATA_ANNOTATIONS_LEVELS: manifest,index
|
|
||||||
-
|
|
||||||
name: Build
|
|
||||||
uses: docker/bake-action@v5
|
|
||||||
with:
|
|
||||||
files: |
|
|
||||||
./test/docker-bake.hcl
|
|
||||||
${{ steps.docker_meta.outputs.bake-file-tags }}
|
|
||||||
${{ steps.docker_meta.outputs.bake-file-annotations }}
|
|
||||||
targets: |
|
|
||||||
release
|
|
||||||
|
|
||||||
no-images:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
-
|
|
||||||
name: Checkout
|
|
||||||
uses: actions/checkout@v4
|
|
||||||
-
|
|
||||||
name: Set up Docker Buildx
|
|
||||||
uses: docker/setup-buildx-action@v3
|
|
||||||
with:
|
|
||||||
version: ${{ env.BUILDX_VERSION }}
|
|
||||||
driver: docker
|
|
||||||
-
|
|
||||||
name: Docker meta
|
|
||||||
uses: ./
|
|
||||||
with:
|
|
||||||
tags: |
|
|
||||||
type=schedule
|
|
||||||
type=ref,event=branch
|
|
||||||
type=ref,event=tag
|
|
||||||
type=ref,event=pr
|
|
||||||
type=sha
|
|
||||||
-
|
|
||||||
name: Print envs
|
|
||||||
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@v5
|
|
||||||
with:
|
|
||||||
source: "{{defaultContext}}"
|
|
||||||
files: |
|
|
||||||
./test/docker-bake.hcl
|
|
||||||
cwd://${{ steps.docker_meta.outputs.bake-file-tags }}
|
|
||||||
cwd://${{ steps.docker_meta.outputs.bake-file-labels }}
|
|
||||||
targets: |
|
|
||||||
release
|
|
||||||
|
11
.github/workflows/test.yml
vendored
11
.github/workflows/test.yml
vendored
@ -1,9 +1,5 @@
|
|||||||
name: test
|
name: test
|
||||||
|
|
||||||
concurrency:
|
|
||||||
group: ${{ github.workflow }}-${{ github.ref }}
|
|
||||||
cancel-in-progress: true
|
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches:
|
branches:
|
||||||
@ -17,15 +13,14 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
-
|
-
|
||||||
name: Checkout
|
name: Checkout
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v3
|
||||||
-
|
-
|
||||||
name: Test
|
name: Test
|
||||||
uses: docker/bake-action@v5
|
uses: docker/bake-action@v3
|
||||||
with:
|
with:
|
||||||
targets: test
|
targets: test
|
||||||
-
|
-
|
||||||
name: Upload coverage
|
name: Upload coverage
|
||||||
uses: codecov/codecov-action@v4
|
uses: codecov/codecov-action@v3
|
||||||
with:
|
with:
|
||||||
file: ./coverage/clover.xml
|
file: ./coverage/clover.xml
|
||||||
token: ${{ secrets.CODECOV_TOKEN }}
|
|
||||||
|
10
.github/workflows/validate.yml
vendored
10
.github/workflows/validate.yml
vendored
@ -1,9 +1,5 @@
|
|||||||
name: validate
|
name: validate
|
||||||
|
|
||||||
concurrency:
|
|
||||||
group: ${{ github.workflow }}-${{ github.ref }}
|
|
||||||
cancel-in-progress: true
|
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches:
|
branches:
|
||||||
@ -19,7 +15,7 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
-
|
-
|
||||||
name: Checkout
|
name: Checkout
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v3
|
||||||
-
|
-
|
||||||
name: Targets matrix
|
name: Targets matrix
|
||||||
id: targets
|
id: targets
|
||||||
@ -37,9 +33,9 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
-
|
-
|
||||||
name: Checkout
|
name: Checkout
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v3
|
||||||
-
|
-
|
||||||
name: Validate
|
name: Validate
|
||||||
uses: docker/bake-action@v5
|
uses: docker/bake-action@v3
|
||||||
with:
|
with:
|
||||||
targets: ${{ matrix.target }}
|
targets: ${{ matrix.target }}
|
||||||
|
71
.gitignore
vendored
71
.gitignore
vendored
@ -1,5 +1,12 @@
|
|||||||
# https://raw.githubusercontent.com/github/gitignore/main/Node.gitignore
|
/.dev
|
||||||
|
node_modules/
|
||||||
|
lib
|
||||||
|
|
||||||
|
# Jetbrains
|
||||||
|
/.idea
|
||||||
|
/*.iml
|
||||||
|
|
||||||
|
# Rest of the file pulled from https://github.com/github/gitignore/blob/master/Node.gitignore
|
||||||
# Logs
|
# Logs
|
||||||
logs
|
logs
|
||||||
*.log
|
*.log
|
||||||
@ -7,7 +14,6 @@ npm-debug.log*
|
|||||||
yarn-debug.log*
|
yarn-debug.log*
|
||||||
yarn-error.log*
|
yarn-error.log*
|
||||||
lerna-debug.log*
|
lerna-debug.log*
|
||||||
.pnpm-debug.log*
|
|
||||||
|
|
||||||
# Diagnostic reports (https://nodejs.org/api/report.html)
|
# Diagnostic reports (https://nodejs.org/api/report.html)
|
||||||
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
|
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
|
||||||
@ -18,14 +24,34 @@ pids
|
|||||||
*.seed
|
*.seed
|
||||||
*.pid.lock
|
*.pid.lock
|
||||||
|
|
||||||
|
# Directory for instrumented libs generated by jscoverage/JSCover
|
||||||
|
lib-cov
|
||||||
|
|
||||||
# Coverage directory used by tools like istanbul
|
# Coverage directory used by tools like istanbul
|
||||||
coverage
|
coverage
|
||||||
*.lcov
|
*.lcov
|
||||||
|
|
||||||
|
# nyc test coverage
|
||||||
|
.nyc_output
|
||||||
|
|
||||||
|
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
|
||||||
|
.grunt
|
||||||
|
|
||||||
|
# Bower dependency directory (https://bower.io/)
|
||||||
|
bower_components
|
||||||
|
|
||||||
|
# node-waf configuration
|
||||||
|
.lock-wscript
|
||||||
|
|
||||||
|
# Compiled binary addons (https://nodejs.org/api/addons.html)
|
||||||
|
build/Release
|
||||||
|
|
||||||
# Dependency directories
|
# Dependency directories
|
||||||
node_modules/
|
|
||||||
jspm_packages/
|
jspm_packages/
|
||||||
|
|
||||||
|
# TypeScript v1 declaration files
|
||||||
|
typings/
|
||||||
|
|
||||||
# TypeScript cache
|
# TypeScript cache
|
||||||
*.tsbuildinfo
|
*.tsbuildinfo
|
||||||
|
|
||||||
@ -35,19 +61,36 @@ jspm_packages/
|
|||||||
# Optional eslint cache
|
# Optional eslint cache
|
||||||
.eslintcache
|
.eslintcache
|
||||||
|
|
||||||
|
# Optional REPL history
|
||||||
|
.node_repl_history
|
||||||
|
|
||||||
|
# Output of 'npm pack'
|
||||||
|
*.tgz
|
||||||
|
|
||||||
# Yarn Integrity file
|
# Yarn Integrity file
|
||||||
.yarn-integrity
|
.yarn-integrity
|
||||||
|
|
||||||
# dotenv environment variable files
|
# dotenv environment variables file
|
||||||
.env
|
.env
|
||||||
.env.development.local
|
.env.test
|
||||||
.env.test.local
|
|
||||||
.env.production.local
|
|
||||||
.env.local
|
|
||||||
|
|
||||||
# yarn v2
|
# parcel-bundler cache (https://parceljs.org/)
|
||||||
.yarn/cache
|
.cache
|
||||||
.yarn/unplugged
|
|
||||||
.yarn/build-state.yml
|
# next.js build output
|
||||||
.yarn/install-state.gz
|
.next
|
||||||
.pnp.*
|
|
||||||
|
# nuxt.js build output
|
||||||
|
.nuxt
|
||||||
|
|
||||||
|
# vuepress build output
|
||||||
|
.vuepress/dist
|
||||||
|
|
||||||
|
# Serverless directories
|
||||||
|
.serverless/
|
||||||
|
|
||||||
|
# FuseBox cache
|
||||||
|
.fusebox/
|
||||||
|
|
||||||
|
# DynamoDB Local files
|
||||||
|
.dynamodb/
|
||||||
|
@ -1,6 +0,0 @@
|
|||||||
# Dependency directories
|
|
||||||
node_modules/
|
|
||||||
jspm_packages/
|
|
||||||
|
|
||||||
# yarn v2
|
|
||||||
.yarn/
|
|
541
.yarn/plugins/@yarnpkg/plugin-interactive-tools.cjs
vendored
541
.yarn/plugins/@yarnpkg/plugin-interactive-tools.cjs
vendored
File diff suppressed because one or more lines are too long
13
.yarnrc.yml
13
.yarnrc.yml
@ -1,13 +0,0 @@
|
|||||||
logFilters:
|
|
||||||
- code: YN0013
|
|
||||||
level: discard
|
|
||||||
- code: YN0019
|
|
||||||
level: discard
|
|
||||||
- code: YN0076
|
|
||||||
level: discard
|
|
||||||
|
|
||||||
nodeLinker: node-modules
|
|
||||||
|
|
||||||
plugins:
|
|
||||||
- path: .yarn/plugins/@yarnpkg/plugin-interactive-tools.cjs
|
|
||||||
spec: "@yarnpkg/plugin-interactive-tools"
|
|
204
README.md
204
README.md
@ -47,8 +47,7 @@ ___
|
|||||||
* [`{{date '<format>' tz='<timezone>'}}`](#date-format-tztimezone)
|
* [`{{date '<format>' tz='<timezone>'}}`](#date-format-tztimezone)
|
||||||
* [Major version zero](#major-version-zero)
|
* [Major version zero](#major-version-zero)
|
||||||
* [JSON output object](#json-output-object)
|
* [JSON output object](#json-output-object)
|
||||||
* [Overwrite labels and annotations](#overwrite-labels-and-annotations)
|
* [Overwrite labels](#overwrite-labels)
|
||||||
* [Annotations](#annotations)
|
|
||||||
* [Contributing](#contributing)
|
* [Contributing](#contributing)
|
||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
@ -75,23 +74,23 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
-
|
-
|
||||||
name: Checkout
|
name: Checkout
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v3
|
||||||
-
|
-
|
||||||
name: Docker meta
|
name: Docker meta
|
||||||
id: meta
|
id: meta
|
||||||
uses: docker/metadata-action@v5
|
uses: docker/metadata-action@v4
|
||||||
with:
|
with:
|
||||||
images: name/app
|
images: name/app
|
||||||
-
|
-
|
||||||
name: Login to DockerHub
|
name: Login to DockerHub
|
||||||
if: github.event_name != 'pull_request'
|
if: github.event_name != 'pull_request'
|
||||||
uses: docker/login-action@v3
|
uses: docker/login-action@v2
|
||||||
with:
|
with:
|
||||||
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||||
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||||
-
|
-
|
||||||
name: Build and push
|
name: Build and push
|
||||||
uses: docker/build-push-action@v5
|
uses: docker/build-push-action@v4
|
||||||
with:
|
with:
|
||||||
context: .
|
context: .
|
||||||
push: ${{ github.event_name != 'pull_request' }}
|
push: ${{ github.event_name != 'pull_request' }}
|
||||||
@ -129,11 +128,11 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
-
|
-
|
||||||
name: Checkout
|
name: Checkout
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v3
|
||||||
-
|
-
|
||||||
name: Docker meta
|
name: Docker meta
|
||||||
id: meta
|
id: meta
|
||||||
uses: docker/metadata-action@v5
|
uses: docker/metadata-action@v4
|
||||||
with:
|
with:
|
||||||
images: |
|
images: |
|
||||||
name/app
|
name/app
|
||||||
@ -145,13 +144,13 @@ jobs:
|
|||||||
-
|
-
|
||||||
name: Login to DockerHub
|
name: Login to DockerHub
|
||||||
if: github.event_name != 'pull_request'
|
if: github.event_name != 'pull_request'
|
||||||
uses: docker/login-action@v3
|
uses: docker/login-action@v2
|
||||||
with:
|
with:
|
||||||
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||||
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||||
-
|
-
|
||||||
name: Build and push
|
name: Build and push
|
||||||
uses: docker/build-push-action@v5
|
uses: docker/build-push-action@v4
|
||||||
with:
|
with:
|
||||||
context: .
|
context: .
|
||||||
push: ${{ github.event_name != 'pull_request' }}
|
push: ${{ github.event_name != 'pull_request' }}
|
||||||
@ -207,11 +206,11 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
-
|
-
|
||||||
name: Checkout
|
name: Checkout
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v3
|
||||||
-
|
-
|
||||||
name: Docker meta
|
name: Docker meta
|
||||||
id: meta
|
id: meta
|
||||||
uses: docker/metadata-action@v5
|
uses: docker/metadata-action@v4
|
||||||
with:
|
with:
|
||||||
images: |
|
images: |
|
||||||
name/app
|
name/app
|
||||||
@ -223,7 +222,7 @@ jobs:
|
|||||||
type=sha
|
type=sha
|
||||||
-
|
-
|
||||||
name: Build
|
name: Build
|
||||||
uses: docker/bake-action@v4
|
uses: docker/bake-action@v2
|
||||||
with:
|
with:
|
||||||
files: |
|
files: |
|
||||||
./docker-bake.hcl
|
./docker-bake.hcl
|
||||||
@ -231,8 +230,8 @@ jobs:
|
|||||||
targets: build
|
targets: build
|
||||||
```
|
```
|
||||||
|
|
||||||
Content of `${{ steps.meta.outputs.bake-file }}` file, combining tags and
|
Content of `${{ steps.meta.outputs.bake-file }}` file will look like this with
|
||||||
labels, will look like this with `refs/tags/v1.2.3` ref:
|
`refs/tags/v1.2.3` ref:
|
||||||
|
|
||||||
```json
|
```json
|
||||||
{
|
{
|
||||||
@ -263,44 +262,11 @@ labels, will look like this with `refs/tags/v1.2.3` ref:
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
You can also use the `bake-file-tags` and `bake-file-labels` outputs if you
|
|
||||||
just want to use tags and/or labels respectively. The following example is
|
|
||||||
similar to the previous one:
|
|
||||||
|
|
||||||
```yaml
|
|
||||||
-
|
|
||||||
name: Build
|
|
||||||
uses: docker/bake-action@v4
|
|
||||||
with:
|
|
||||||
files: |
|
|
||||||
./docker-bake.hcl
|
|
||||||
${{ steps.meta.outputs.bake-file-tags }}
|
|
||||||
${{ steps.meta.outputs.bake-file-labels }}
|
|
||||||
targets: build
|
|
||||||
```
|
|
||||||
|
|
||||||
If you're building a [remote Bake definition](https://docs.docker.com/build/bake/remote-definition/)
|
|
||||||
using a [Git context](https://github.com/docker/bake-action?tab=readme-ov-file#git-context),
|
|
||||||
you must specify the location of the metadata-only bake file using a `cwd://`
|
|
||||||
prefix:
|
|
||||||
|
|
||||||
```yaml
|
|
||||||
-
|
|
||||||
name: Build
|
|
||||||
uses: docker/bake-action@v4
|
|
||||||
with:
|
|
||||||
source: "${{ github.server_url }}/${{ github.repository }}.git#${{ github.ref }}"
|
|
||||||
files: |
|
|
||||||
./docker-bake.hcl
|
|
||||||
cwd://${{ steps.meta.outputs.bake-file }}
|
|
||||||
targets: build
|
|
||||||
```
|
|
||||||
|
|
||||||
## Customizing
|
## Customizing
|
||||||
|
|
||||||
### inputs
|
### inputs
|
||||||
|
|
||||||
The following inputs can be used as `step.with` keys:
|
Following inputs can be used as `step.with` keys
|
||||||
|
|
||||||
> `List` type is a newline-delimited string
|
> `List` type is a newline-delimited string
|
||||||
> ```yaml
|
> ```yaml
|
||||||
@ -310,49 +276,41 @@ The following inputs can be used as `step.with` keys:
|
|||||||
> org.opencontainers.image.vendor=MyCompany
|
> org.opencontainers.image.vendor=MyCompany
|
||||||
> ```
|
> ```
|
||||||
|
|
||||||
| Name | Type | Description |
|
| Name | Type | Description |
|
||||||
|-------------------|--------|------------------------------------------------------------------------------|
|
|---------------------|--------|-------------------------------------------------------------------------------|
|
||||||
| `context` | String | Where to get context data. Allowed options are: `workflow` (default), `git`. |
|
| `context` | String | Where to get context data. Allowed options are: `workflow` (default), `git`. |
|
||||||
| `images` | List | List of Docker images to use as base name for tags |
|
| `images` | List | List of Docker images to use as base name for tags |
|
||||||
| `tags` | List | List of [tags](#tags-input) as key-value pair attributes |
|
| `tags` | List | List of [tags](#tags-input) as key-value pair attributes |
|
||||||
| `flavor` | List | [Flavor](#flavor-input) to apply |
|
| `flavor` | List | [Flavor](#flavor-input) to apply |
|
||||||
| `labels` | List | List of custom labels |
|
| `labels` | List | List of custom labels |
|
||||||
| `annotations` | List | List of custom anntoations |
|
| `sep-tags` | String | Separator to use for tags output (default `\n`) |
|
||||||
| `sep-tags` | String | Separator to use for tags output (default `\n`) |
|
| `sep-labels` | String | Separator to use for labels output (default `\n`) |
|
||||||
| `sep-labels` | String | Separator to use for labels output (default `\n`) |
|
| `bake-target` | String | Bake target name (default `docker-metadata-action`) |
|
||||||
| `sep-annotations` | String | Separator to use for annotations output (default `\n`) |
|
|
||||||
| `bake-target` | String | Bake target name (default `docker-metadata-action`) |
|
|
||||||
|
|
||||||
### outputs
|
### outputs
|
||||||
|
|
||||||
The following outputs are available:
|
Following outputs are available
|
||||||
|
|
||||||
| Name | Type | Description |
|
| Name | Type | Description |
|
||||||
|-------------------------|--------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
|---------------|---------|--------------------------------------------------------------------------------------------|
|
||||||
| `version` | String | Docker image version |
|
| `version` | String | Docker image version |
|
||||||
| `tags` | String | Docker tags |
|
| `tags` | String | Docker tags |
|
||||||
| `labels` | String | Docker labels |
|
| `labels` | String | Docker labels |
|
||||||
| `annotations` | String | [Annotations](https://github.com/moby/buildkit/blob/master/docs/annotations.md) |
|
| `json` | String | JSON output of tags and labels |
|
||||||
| `json` | String | JSON output of tags and labels |
|
| `bake-file` | File | [Bake file definition](https://docs.docker.com/build/customize/bake/file-definition/) path |
|
||||||
| `bake-file-tags` | File | [Bake file definition](https://docs.docker.com/build/bake/reference/) path with tags |
|
|
||||||
| `bake-file-labels` | File | [Bake file definition](https://docs.docker.com/build/bake/reference/) path with labels |
|
|
||||||
| `bake-file-annotations` | File | [Bake file definition](https://docs.docker.com/build/bake/reference/) path with [annotations](https://github.com/moby/buildkit/blob/master/docs/annotations.md) |
|
|
||||||
|
|
||||||
Alternatively, each output is also exported as an environment variable:
|
Alternatively, each output is also exported as an environment variable:
|
||||||
|
|
||||||
* `DOCKER_METADATA_OUTPUT_VERSION`
|
* `DOCKER_METADATA_OUTPUT_VERSION`
|
||||||
* `DOCKER_METADATA_OUTPUT_TAGS`
|
* `DOCKER_METADATA_OUTPUT_TAGS`
|
||||||
* `DOCKER_METADATA_OUTPUT_LABELS`
|
* `DOCKER_METADATA_OUTPUT_LABELS`
|
||||||
* `DOCKER_METADATA_OUTPUT_ANNOTATIONS`
|
|
||||||
* `DOCKER_METADATA_OUTPUT_JSON`
|
* `DOCKER_METADATA_OUTPUT_JSON`
|
||||||
* `DOCKER_METADATA_OUTPUT_BAKE_FILE_TAGS`
|
* `DOCKER_METADATA_OUTPUT_BAKE_FILE`
|
||||||
* `DOCKER_METADATA_OUTPUT_BAKE_FILE_LABELS`
|
|
||||||
* `DOCKER_METADATA_OUTPUT_BAKE_FILE_ANNOTATIONS`
|
|
||||||
|
|
||||||
So it can be used with our [Docker Build Push action](https://github.com/docker/build-push-action/):
|
So it can be used with our [Docker Build Push action](https://github.com/docker/build-push-action/):
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
- uses: docker/build-push-action@v5
|
- uses: docker/build-push-action@v4
|
||||||
with:
|
with:
|
||||||
build-args: |
|
build-args: |
|
||||||
DOCKER_METADATA_OUTPUT_JSON
|
DOCKER_METADATA_OUTPUT_JSON
|
||||||
@ -360,10 +318,9 @@ So it can be used with our [Docker Build Push action](https://github.com/docker/
|
|||||||
|
|
||||||
### environment variables
|
### environment variables
|
||||||
|
|
||||||
| Name | Type | Description |
|
| Name | Type | Description |
|
||||||
|--------------------------------------|--------|------------------------------------------------------------------------------------------------------------|
|
|-------------------------------|------|------------------------------------------------------------------------------------------------------------|
|
||||||
| `DOCKER_METADATA_PR_HEAD_SHA` | Bool | If `true`, set associated head SHA instead of commit SHA that triggered the workflow on pull request event |
|
| `DOCKER_METADATA_PR_HEAD_SHA` | Bool | If `true`, set associated head SHA instead of commit SHA that triggered the workflow on pull request event |
|
||||||
| `DOCKER_METADATA_ANNOTATIONS_LEVELS` | String | Comma separated list of annotations levels to set for annotations output separated (default `manifest`) |
|
|
||||||
|
|
||||||
## `context` input
|
## `context` input
|
||||||
|
|
||||||
@ -402,8 +359,6 @@ images: |
|
|||||||
* `name=<string>` image base name
|
* `name=<string>` image base name
|
||||||
* `enable=<true|false>` enable this entry (default `true`)
|
* `enable=<true|false>` enable this entry (default `true`)
|
||||||
|
|
||||||
If `images` is empty, tags will be generated without base name.
|
|
||||||
|
|
||||||
## `flavor` input
|
## `flavor` input
|
||||||
|
|
||||||
`flavor` defines a global behavior for [`tags`](#tags-input):
|
`flavor` defines a global behavior for [`tags`](#tags-input):
|
||||||
@ -896,13 +851,13 @@ that you can reuse them further in your workflow using the [`fromJSON` function]
|
|||||||
```yaml
|
```yaml
|
||||||
-
|
-
|
||||||
name: Docker meta
|
name: Docker meta
|
||||||
uses: docker/metadata-action@v5
|
uses: docker/metadata-action@v4
|
||||||
id: meta
|
id: meta
|
||||||
with:
|
with:
|
||||||
images: name/app
|
images: name/app
|
||||||
-
|
-
|
||||||
name: Build and push
|
name: Build and push
|
||||||
uses: docker/build-push-action@v5
|
uses: docker/build-push-action@v4
|
||||||
with:
|
with:
|
||||||
tags: ${{ steps.meta.outputs.tags }}
|
tags: ${{ steps.meta.outputs.tags }}
|
||||||
labels: ${{ steps.meta.outputs.labels }}
|
labels: ${{ steps.meta.outputs.labels }}
|
||||||
@ -912,17 +867,16 @@ that you can reuse them further in your workflow using the [`fromJSON` function]
|
|||||||
REVISION=${{ fromJSON(steps.meta.outputs.json).labels['org.opencontainers.image.revision'] }}
|
REVISION=${{ fromJSON(steps.meta.outputs.json).labels['org.opencontainers.image.revision'] }}
|
||||||
```
|
```
|
||||||
|
|
||||||
### Overwrite labels and annotations
|
### Overwrite labels
|
||||||
|
|
||||||
If some [OCI Image Format Specification](https://github.com/opencontainers/image-spec/blob/master/annotations.md)
|
If some [OCI Image Format Specification](https://github.com/opencontainers/image-spec/blob/master/annotations.md)
|
||||||
generated are not suitable as labels/annotations, you can overwrite them like
|
labels generated are not suitable, you can overwrite them like this:
|
||||||
this:
|
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
-
|
-
|
||||||
name: Docker meta
|
name: Docker meta
|
||||||
id: meta
|
id: meta
|
||||||
uses: docker/metadata-action@v5
|
uses: docker/metadata-action@v4
|
||||||
with:
|
with:
|
||||||
images: name/app
|
images: name/app
|
||||||
labels: |
|
labels: |
|
||||||
@ -932,78 +886,6 @@ this:
|
|||||||
org.opencontainers.image.vendor=MyCompany
|
org.opencontainers.image.vendor=MyCompany
|
||||||
```
|
```
|
||||||
|
|
||||||
### Annotations
|
|
||||||
|
|
||||||
Since Buildx 0.12, it is possible to set annotations to your image through the
|
|
||||||
`--annotation` flag.
|
|
||||||
|
|
||||||
With the [`build-push-action`](https://github.com/docker/build-push-action/),
|
|
||||||
you can set the `annotations` input with the value of the `annotations` output
|
|
||||||
of the `metadata-action`:
|
|
||||||
|
|
||||||
```yaml
|
|
||||||
-
|
|
||||||
name: Docker meta
|
|
||||||
uses: docker/metadata-action@v5
|
|
||||||
with:
|
|
||||||
images: name/app
|
|
||||||
-
|
|
||||||
name: Build and push
|
|
||||||
uses: docker/build-push-action@v5
|
|
||||||
with:
|
|
||||||
tags: ${{ steps.meta.outputs.tags }}
|
|
||||||
annotations: ${{ steps.meta.outputs.annotations }}
|
|
||||||
```
|
|
||||||
|
|
||||||
The same can be done with the [`bake-action`](https://github.com/docker/bake-action/):
|
|
||||||
|
|
||||||
```yaml
|
|
||||||
-
|
|
||||||
name: Docker meta
|
|
||||||
uses: docker/metadata-action@v5
|
|
||||||
with:
|
|
||||||
images: name/app
|
|
||||||
-
|
|
||||||
name: Build
|
|
||||||
uses: docker/bake-action@v4
|
|
||||||
with:
|
|
||||||
files: |
|
|
||||||
./docker-bake.hcl
|
|
||||||
${{ steps.meta.outputs.bake-file-tags }}
|
|
||||||
${{ steps.meta.outputs.bake-file-annotations }}
|
|
||||||
targets: build
|
|
||||||
```
|
|
||||||
|
|
||||||
Note that annotations can be attached at many different levels within a manifest.
|
|
||||||
By default, the generated annotations will be attached to image manifests,
|
|
||||||
but different registries may expect annotations at different places;
|
|
||||||
a common practice is to read annotations at _image indexes_ if present,
|
|
||||||
which are often used by multi-arch builds to index platform-specific images.
|
|
||||||
If you want to specify level(s) for your annotations, you can use the
|
|
||||||
[`DOCKER_METADATA_ANNOTATIONS_LEVELS` environment variable](#environment-variables)
|
|
||||||
with a comma separated list of all levels the annotations should be attached to (defaults to `manifest`).
|
|
||||||
The following configuration demonstrates the ability to attach annotations to both image manifests and image indexes,
|
|
||||||
though your registry may only need annotations at the index level. (That is, `index` alone may be enough.)
|
|
||||||
Please consult the documentation of your registry.
|
|
||||||
|
|
||||||
```yaml
|
|
||||||
-
|
|
||||||
name: Docker meta
|
|
||||||
uses: docker/metadata-action@v5
|
|
||||||
with:
|
|
||||||
images: name/app
|
|
||||||
env:
|
|
||||||
DOCKER_METADATA_ANNOTATIONS_LEVELS: manifest,index
|
|
||||||
-
|
|
||||||
name: Build and push
|
|
||||||
uses: docker/build-push-action@v5
|
|
||||||
with:
|
|
||||||
tags: ${{ steps.meta.outputs.tags }}
|
|
||||||
annotations: ${{ steps.meta.outputs.annotations }}
|
|
||||||
```
|
|
||||||
|
|
||||||
More information about annotations in the [BuildKit documentation](https://github.com/moby/buildkit/blob/master/docs/annotations.md).
|
|
||||||
|
|
||||||
## Contributing
|
## Contributing
|
||||||
|
|
||||||
Want to contribute? Awesome! You can find information about contributing to
|
Want to contribute? Awesome! You can find information about contributing to
|
||||||
|
30
UPGRADE.md
30
UPGRADE.md
@ -3,7 +3,7 @@
|
|||||||
## v2 to v3
|
## v2 to v3
|
||||||
|
|
||||||
* Repository has been moved to docker org. Replace `crazy-max/ghaction-docker-meta@v2`
|
* Repository has been moved to docker org. Replace `crazy-max/ghaction-docker-meta@v2`
|
||||||
with `docker/metadata-action@v5`
|
with `docker/metadata-action@v4`
|
||||||
* The default bake target has been changed: `ghaction-docker-meta` > `docker-metadata-action`
|
* The default bake target has been changed: `ghaction-docker-meta` > `docker-metadata-action`
|
||||||
|
|
||||||
## v1 to v2
|
## v1 to v2
|
||||||
@ -133,7 +133,7 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
-
|
-
|
||||||
name: Checkout
|
name: Checkout
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v3
|
||||||
-
|
-
|
||||||
name: Docker meta
|
name: Docker meta
|
||||||
id: meta
|
id: meta
|
||||||
@ -143,13 +143,13 @@ jobs:
|
|||||||
-
|
-
|
||||||
name: Login to DockerHub
|
name: Login to DockerHub
|
||||||
if: github.event_name != 'pull_request'
|
if: github.event_name != 'pull_request'
|
||||||
uses: docker/login-action@v3
|
uses: docker/login-action@v2
|
||||||
with:
|
with:
|
||||||
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||||
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||||
-
|
-
|
||||||
name: Build and push
|
name: Build and push
|
||||||
uses: docker/build-push-action@v5
|
uses: docker/build-push-action@v4
|
||||||
with:
|
with:
|
||||||
context: .
|
context: .
|
||||||
push: ${{ github.event_name != 'pull_request' }}
|
push: ${{ github.event_name != 'pull_request' }}
|
||||||
@ -177,23 +177,23 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
-
|
-
|
||||||
name: Checkout
|
name: Checkout
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v3
|
||||||
-
|
-
|
||||||
name: Docker meta
|
name: Docker meta
|
||||||
id: meta
|
id: meta
|
||||||
uses: docker/metadata-action@v5
|
uses: docker/metadata-action@v4
|
||||||
with:
|
with:
|
||||||
images: name/app
|
images: name/app
|
||||||
-
|
-
|
||||||
name: Login to DockerHub
|
name: Login to DockerHub
|
||||||
if: github.event_name != 'pull_request'
|
if: github.event_name != 'pull_request'
|
||||||
uses: docker/login-action@v3
|
uses: docker/login-action@v2
|
||||||
with:
|
with:
|
||||||
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||||
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||||
-
|
-
|
||||||
name: Build and push
|
name: Build and push
|
||||||
uses: docker/build-push-action@v5
|
uses: docker/build-push-action@v4
|
||||||
with:
|
with:
|
||||||
context: .
|
context: .
|
||||||
push: ${{ github.event_name != 'pull_request' }}
|
push: ${{ github.event_name != 'pull_request' }}
|
||||||
@ -223,7 +223,7 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
-
|
-
|
||||||
name: Checkout
|
name: Checkout
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v3
|
||||||
-
|
-
|
||||||
name: Docker meta
|
name: Docker meta
|
||||||
id: meta
|
id: meta
|
||||||
@ -236,13 +236,13 @@ jobs:
|
|||||||
-
|
-
|
||||||
name: Login to DockerHub
|
name: Login to DockerHub
|
||||||
if: github.event_name != 'pull_request'
|
if: github.event_name != 'pull_request'
|
||||||
uses: docker/login-action@v3
|
uses: docker/login-action@v2
|
||||||
with:
|
with:
|
||||||
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||||
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||||
-
|
-
|
||||||
name: Build and push
|
name: Build and push
|
||||||
uses: docker/build-push-action@v5
|
uses: docker/build-push-action@v4
|
||||||
with:
|
with:
|
||||||
context: .
|
context: .
|
||||||
push: ${{ github.event_name != 'pull_request' }}
|
push: ${{ github.event_name != 'pull_request' }}
|
||||||
@ -270,11 +270,11 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
-
|
-
|
||||||
name: Checkout
|
name: Checkout
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v3
|
||||||
-
|
-
|
||||||
name: Docker meta
|
name: Docker meta
|
||||||
id: meta
|
id: meta
|
||||||
uses: docker/metadata-action@v5
|
uses: docker/metadata-action@v4
|
||||||
with:
|
with:
|
||||||
images: name/app
|
images: name/app
|
||||||
tags: |
|
tags: |
|
||||||
@ -285,13 +285,13 @@ jobs:
|
|||||||
-
|
-
|
||||||
name: Login to DockerHub
|
name: Login to DockerHub
|
||||||
if: github.event_name != 'pull_request'
|
if: github.event_name != 'pull_request'
|
||||||
uses: docker/login-action@v3
|
uses: docker/login-action@v2
|
||||||
with:
|
with:
|
||||||
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||||
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||||
-
|
-
|
||||||
name: Build and push
|
name: Build and push
|
||||||
uses: docker/build-push-action@v5
|
uses: docker/build-push-action@v4
|
||||||
with:
|
with:
|
||||||
context: .
|
context: .
|
||||||
push: ${{ github.event_name != 'pull_request' }}
|
push: ${{ github.event_name != 'pull_request' }}
|
||||||
|
@ -39,10 +39,8 @@ describe('getInputs', () => {
|
|||||||
githubToken: '',
|
githubToken: '',
|
||||||
images: ['moby/buildkit', 'ghcr.io/moby/mbuildkit'],
|
images: ['moby/buildkit', 'ghcr.io/moby/mbuildkit'],
|
||||||
labels: [],
|
labels: [],
|
||||||
annotations: [],
|
|
||||||
sepLabels: '\n',
|
sepLabels: '\n',
|
||||||
sepTags: '\n',
|
sepTags: '\n',
|
||||||
sepAnnotations: '\n',
|
|
||||||
tags: [],
|
tags: [],
|
||||||
} as Inputs
|
} as Inputs
|
||||||
],
|
],
|
||||||
@ -53,7 +51,6 @@ describe('getInputs', () => {
|
|||||||
['images', 'moby/buildkit'],
|
['images', 'moby/buildkit'],
|
||||||
['sep-labels', ','],
|
['sep-labels', ','],
|
||||||
['sep-tags', ','],
|
['sep-tags', ','],
|
||||||
['sep-annotations', ',']
|
|
||||||
]),
|
]),
|
||||||
{
|
{
|
||||||
context: ContextSource.workflow,
|
context: ContextSource.workflow,
|
||||||
@ -62,10 +59,8 @@ describe('getInputs', () => {
|
|||||||
githubToken: '',
|
githubToken: '',
|
||||||
images: ['moby/buildkit'],
|
images: ['moby/buildkit'],
|
||||||
labels: [],
|
labels: [],
|
||||||
annotations: [],
|
|
||||||
sepLabels: ',',
|
sepLabels: ',',
|
||||||
sepTags: ',',
|
sepTags: ',',
|
||||||
sepAnnotations: ',',
|
|
||||||
tags: [],
|
tags: [],
|
||||||
} as Inputs
|
} as Inputs
|
||||||
],
|
],
|
||||||
@ -81,10 +76,8 @@ describe('getInputs', () => {
|
|||||||
githubToken: '',
|
githubToken: '',
|
||||||
images: ['moby/buildkit', 'ghcr.io/moby/mbuildkit'],
|
images: ['moby/buildkit', 'ghcr.io/moby/mbuildkit'],
|
||||||
labels: [],
|
labels: [],
|
||||||
annotations: [],
|
|
||||||
sepLabels: '\n',
|
sepLabels: '\n',
|
||||||
sepTags: '\n',
|
sepTags: '\n',
|
||||||
sepAnnotations: '\n',
|
|
||||||
tags: [],
|
tags: [],
|
||||||
} as Inputs
|
} as Inputs
|
||||||
],
|
],
|
||||||
|
File diff suppressed because it is too large
Load Diff
22
action.yml
22
action.yml
@ -13,7 +13,7 @@ inputs:
|
|||||||
required: true
|
required: true
|
||||||
images:
|
images:
|
||||||
description: 'List of Docker images to use as base name for tags'
|
description: 'List of Docker images to use as base name for tags'
|
||||||
required: false
|
required: true
|
||||||
tags:
|
tags:
|
||||||
description: 'List of tags as key-value pair attributes'
|
description: 'List of tags as key-value pair attributes'
|
||||||
required: false
|
required: false
|
||||||
@ -23,18 +23,12 @@ inputs:
|
|||||||
labels:
|
labels:
|
||||||
description: 'List of custom labels'
|
description: 'List of custom labels'
|
||||||
required: false
|
required: false
|
||||||
annotations:
|
|
||||||
description: 'List of custom annotations'
|
|
||||||
required: false
|
|
||||||
sep-tags:
|
sep-tags:
|
||||||
description: 'Separator to use for tags output (default \n)'
|
description: 'Separator to use for tags output (default \n)'
|
||||||
required: false
|
required: false
|
||||||
sep-labels:
|
sep-labels:
|
||||||
description: 'Separator to use for labels output (default \n)'
|
description: 'Separator to use for labels output (default \n)'
|
||||||
required: false
|
required: false
|
||||||
sep-annotations:
|
|
||||||
description: 'Separator to use for annotations output (default \n)'
|
|
||||||
required: false
|
|
||||||
bake-target:
|
bake-target:
|
||||||
description: 'Bake target name (default docker-metadata-action)'
|
description: 'Bake target name (default docker-metadata-action)'
|
||||||
required: false
|
required: false
|
||||||
@ -50,19 +44,11 @@ outputs:
|
|||||||
description: 'Generated Docker tags'
|
description: 'Generated Docker tags'
|
||||||
labels:
|
labels:
|
||||||
description: 'Generated Docker labels'
|
description: 'Generated Docker labels'
|
||||||
annotations:
|
bake-file:
|
||||||
description: 'Generated annotations'
|
description: 'Bake definiton file'
|
||||||
json:
|
json:
|
||||||
description: 'JSON output of tags and labels'
|
description: 'JSON output of tags and labels'
|
||||||
bake-file-tags:
|
|
||||||
description: 'Bake definition file with tags'
|
|
||||||
bake-file-labels:
|
|
||||||
description: 'Bake definition file with labels'
|
|
||||||
bake-file-annotations:
|
|
||||||
description: 'Bake definiton file with annotations'
|
|
||||||
bake-file:
|
|
||||||
description: 'Bake definition file with tags and labels'
|
|
||||||
|
|
||||||
runs:
|
runs:
|
||||||
using: 'node20'
|
using: 'node16'
|
||||||
main: 'dist/index.js'
|
main: 'dist/index.js'
|
||||||
|
@ -1,20 +1,13 @@
|
|||||||
# syntax=docker/dockerfile:1
|
# syntax=docker/dockerfile:1
|
||||||
|
|
||||||
ARG NODE_VERSION=20
|
ARG NODE_VERSION=16
|
||||||
|
|
||||||
FROM node:${NODE_VERSION}-alpine AS base
|
FROM node:${NODE_VERSION}-alpine AS base
|
||||||
RUN apk add --no-cache cpio findutils git
|
RUN apk add --no-cache cpio findutils git
|
||||||
WORKDIR /src
|
WORKDIR /src
|
||||||
RUN --mount=type=bind,target=.,rw \
|
|
||||||
--mount=type=cache,target=/src/.yarn/cache <<EOT
|
|
||||||
corepack enable
|
|
||||||
yarn --version
|
|
||||||
yarn config set --home enableTelemetry 0
|
|
||||||
EOT
|
|
||||||
|
|
||||||
FROM base AS deps
|
FROM base AS deps
|
||||||
RUN --mount=type=bind,target=.,rw \
|
RUN --mount=type=bind,target=.,rw \
|
||||||
--mount=type=cache,target=/src/.yarn/cache \
|
|
||||||
--mount=type=cache,target=/src/node_modules \
|
--mount=type=cache,target=/src/node_modules \
|
||||||
yarn install && mkdir /vendor && cp yarn.lock /vendor
|
yarn install && mkdir /vendor && cp yarn.lock /vendor
|
||||||
|
|
||||||
@ -27,7 +20,7 @@ RUN --mount=type=bind,target=.,rw <<EOT
|
|||||||
git add -A
|
git add -A
|
||||||
cp -rf /vendor/* .
|
cp -rf /vendor/* .
|
||||||
if [ -n "$(git status --porcelain -- yarn.lock)" ]; then
|
if [ -n "$(git status --porcelain -- yarn.lock)" ]; then
|
||||||
echo >&2 'ERROR: Vendor result differs. Please vendor your package with "docker buildx bake vendor"'
|
echo >&2 'ERROR: Vendor result differs. Please vendor your package with "docker buildx bake vendor-update"'
|
||||||
git status --porcelain -- yarn.lock
|
git status --porcelain -- yarn.lock
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
@ -35,7 +28,6 @@ EOT
|
|||||||
|
|
||||||
FROM deps AS build
|
FROM deps AS build
|
||||||
RUN --mount=type=bind,target=.,rw \
|
RUN --mount=type=bind,target=.,rw \
|
||||||
--mount=type=cache,target=/src/.yarn/cache \
|
|
||||||
--mount=type=cache,target=/src/node_modules \
|
--mount=type=cache,target=/src/node_modules \
|
||||||
yarn run build && mkdir /out && cp -Rf dist /out/
|
yarn run build && mkdir /out && cp -Rf dist /out/
|
||||||
|
|
||||||
@ -56,25 +48,24 @@ EOT
|
|||||||
|
|
||||||
FROM deps AS format
|
FROM deps AS format
|
||||||
RUN --mount=type=bind,target=.,rw \
|
RUN --mount=type=bind,target=.,rw \
|
||||||
--mount=type=cache,target=/src/.yarn/cache \
|
|
||||||
--mount=type=cache,target=/src/node_modules \
|
--mount=type=cache,target=/src/node_modules \
|
||||||
yarn run format \
|
yarn run format \
|
||||||
&& mkdir /out && find . -name '*.ts' -not -path './node_modules/*' -not -path './.yarn/*' | cpio -pdm /out
|
&& mkdir /out && find . -name '*.ts' -not -path './node_modules/*' | cpio -pdm /out
|
||||||
|
|
||||||
FROM scratch AS format-update
|
FROM scratch AS format-update
|
||||||
COPY --from=format /out /
|
COPY --from=format /out /
|
||||||
|
|
||||||
FROM deps AS lint
|
FROM deps AS lint
|
||||||
RUN --mount=type=bind,target=.,rw \
|
RUN --mount=type=bind,target=.,rw \
|
||||||
--mount=type=cache,target=/src/.yarn/cache \
|
|
||||||
--mount=type=cache,target=/src/node_modules \
|
--mount=type=cache,target=/src/node_modules \
|
||||||
yarn run lint
|
yarn run lint
|
||||||
|
|
||||||
FROM deps AS test
|
FROM deps AS test
|
||||||
|
ENV RUNNER_TEMP=/tmp/github_runner
|
||||||
|
ENV RUNNER_TOOL_CACHE=/tmp/github_tool_cache
|
||||||
RUN --mount=type=bind,target=.,rw \
|
RUN --mount=type=bind,target=.,rw \
|
||||||
--mount=type=cache,target=/src/.yarn/cache \
|
|
||||||
--mount=type=cache,target=/src/node_modules \
|
--mount=type=cache,target=/src/node_modules \
|
||||||
yarn run test --coverage --coverageDirectory=/tmp/coverage
|
yarn run test --coverageDirectory=/tmp/coverage
|
||||||
|
|
||||||
FROM scratch AS test-coverage
|
FROM scratch AS test-coverage
|
||||||
COPY --from=test /tmp/coverage /
|
COPY --from=test /tmp/coverage /
|
||||||
|
119
dist/index.js
generated
vendored
119
dist/index.js
generated
vendored
File diff suppressed because one or more lines are too long
2
dist/index.js.map
generated
vendored
2
dist/index.js.map
generated
vendored
File diff suppressed because one or more lines are too long
2785
dist/licenses.txt
generated
vendored
2785
dist/licenses.txt
generated
vendored
File diff suppressed because it is too large
Load Diff
@ -3,7 +3,7 @@ group "default" {
|
|||||||
}
|
}
|
||||||
|
|
||||||
group "pre-checkin" {
|
group "pre-checkin" {
|
||||||
targets = ["vendor", "format", "build"]
|
targets = ["vendor-update", "format", "build"]
|
||||||
}
|
}
|
||||||
|
|
||||||
group "validate" {
|
group "validate" {
|
||||||
@ -34,7 +34,7 @@ target "lint" {
|
|||||||
output = ["type=cacheonly"]
|
output = ["type=cacheonly"]
|
||||||
}
|
}
|
||||||
|
|
||||||
target "vendor" {
|
target "vendor-update" {
|
||||||
dockerfile = "dev.Dockerfile"
|
dockerfile = "dev.Dockerfile"
|
||||||
target = "vendor-update"
|
target = "vendor-update"
|
||||||
output = ["."]
|
output = ["."]
|
||||||
|
70
package.json
70
package.json
@ -1,16 +1,13 @@
|
|||||||
{
|
{
|
||||||
"name": "docker-metadata-action",
|
"name": "docker-metadata-action",
|
||||||
"description": "GitHub Action to extract metadata (tags, labels) for Docker",
|
"description": "GitHub Action to extract metadata (tags, labels) for Docker",
|
||||||
"main": "src/main.ts",
|
"main": "lib/main.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "ncc build --source-map --minify --license licenses.txt",
|
"build": "ncc build src/main.ts --source-map --minify --license licenses.txt",
|
||||||
"lint": "yarn run prettier && yarn run eslint",
|
"lint": "eslint src/**/*.ts __tests__/**/*.ts",
|
||||||
"format": "yarn run prettier:fix && yarn run eslint:fix",
|
"format": "eslint --fix src/**/*.ts __tests__/**/*.ts",
|
||||||
"eslint": "eslint --max-warnings=0 .",
|
"test": "jest --coverage",
|
||||||
"eslint:fix": "eslint --fix .",
|
"all": "yarn run build && yarn run format && yarn test"
|
||||||
"prettier": "prettier --check \"./**/*.ts\"",
|
|
||||||
"prettier:fix": "prettier --write \"./**/*.ts\"",
|
|
||||||
"test": "jest"
|
|
||||||
},
|
},
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
@ -23,36 +20,41 @@
|
|||||||
"tag",
|
"tag",
|
||||||
"label"
|
"label"
|
||||||
],
|
],
|
||||||
"author": "Docker Inc.",
|
"author": "Docker",
|
||||||
|
"contributors": [
|
||||||
|
{
|
||||||
|
"name": "CrazyMax",
|
||||||
|
"url": "https://crazymax.dev"
|
||||||
|
}
|
||||||
|
],
|
||||||
"license": "Apache-2.0",
|
"license": "Apache-2.0",
|
||||||
"packageManager": "yarn@3.6.3",
|
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@actions/core": "^1.10.1",
|
"@actions/core": "^1.10.0",
|
||||||
"@actions/github": "^6.0.0",
|
"@actions/github": "^5.1.1",
|
||||||
"@docker/actions-toolkit": "^0.35.0",
|
"@docker/actions-toolkit": "^0.5.0",
|
||||||
"@renovate/pep440": "^1.0.0",
|
"@renovate/pep440": "^1.0.0",
|
||||||
"csv-parse": "^5.5.6",
|
"csv-parse": "^5.4.0",
|
||||||
"handlebars": "^4.7.8",
|
"handlebars": "^4.7.7",
|
||||||
"moment": "^2.30.1",
|
"moment": "^2.29.4",
|
||||||
"moment-timezone": "^0.5.45",
|
"moment-timezone": "^0.5.43",
|
||||||
"semver": "^7.6.3"
|
"semver": "^7.5.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/csv-parse": "^1.2.2",
|
"@types/csv-parse": "^1.2.2",
|
||||||
"@types/node": "^20.12.12",
|
"@types/node": "^16.18.23",
|
||||||
"@types/semver": "^7.5.8",
|
"@types/semver": "^7.3.13",
|
||||||
"@typescript-eslint/eslint-plugin": "^7.9.0",
|
"@typescript-eslint/eslint-plugin": "^5.56.0",
|
||||||
"@typescript-eslint/parser": "^7.9.0",
|
"@typescript-eslint/parser": "^5.56.0",
|
||||||
"@vercel/ncc": "^0.38.1",
|
"@vercel/ncc": "^0.36.1",
|
||||||
"dotenv": "^16.4.5",
|
"dotenv": "^16.0.3",
|
||||||
"eslint": "^8.57.0",
|
"eslint": "^8.36.0",
|
||||||
"eslint-config-prettier": "^9.1.0",
|
"eslint-config-prettier": "^8.8.0",
|
||||||
"eslint-plugin-jest": "^28.5.0",
|
"eslint-plugin-jest": "^27.2.1",
|
||||||
"eslint-plugin-prettier": "^5.1.3",
|
"eslint-plugin-prettier": "^4.2.1",
|
||||||
"jest": "^29.7.0",
|
"jest": "^29.5.0",
|
||||||
"prettier": "^3.2.5",
|
"prettier": "^2.8.7",
|
||||||
"ts-jest": "^29.1.2",
|
"ts-jest": "^29.0.5",
|
||||||
"ts-node": "^10.9.2",
|
"ts-node": "^10.9.1",
|
||||||
"typescript": "^5.4.5"
|
"typescript": "^4.9.5"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -10,10 +10,8 @@ export interface Inputs {
|
|||||||
tags: string[];
|
tags: string[];
|
||||||
flavor: string[];
|
flavor: string[];
|
||||||
labels: string[];
|
labels: string[];
|
||||||
annotations: string[];
|
|
||||||
sepTags: string;
|
sepTags: string;
|
||||||
sepLabels: string;
|
sepLabels: string;
|
||||||
sepAnnotations: string;
|
|
||||||
bakeTarget: string;
|
bakeTarget: string;
|
||||||
githubToken: string;
|
githubToken: string;
|
||||||
}
|
}
|
||||||
@ -25,10 +23,8 @@ export function getInputs(): Inputs {
|
|||||||
tags: Util.getInputList('tags', {ignoreComma: true, comment: '#'}),
|
tags: Util.getInputList('tags', {ignoreComma: true, comment: '#'}),
|
||||||
flavor: Util.getInputList('flavor', {ignoreComma: true, comment: '#'}),
|
flavor: Util.getInputList('flavor', {ignoreComma: true, comment: '#'}),
|
||||||
labels: Util.getInputList('labels', {ignoreComma: true, comment: '#'}),
|
labels: Util.getInputList('labels', {ignoreComma: true, comment: '#'}),
|
||||||
annotations: Util.getInputList('annotations', {ignoreComma: true, comment: '#'}),
|
|
||||||
sepTags: core.getInput('sep-tags', {trimWhitespace: false}) || `\n`,
|
sepTags: core.getInput('sep-tags', {trimWhitespace: false}) || `\n`,
|
||||||
sepLabels: core.getInput('sep-labels', {trimWhitespace: false}) || `\n`,
|
sepLabels: core.getInput('sep-labels', {trimWhitespace: false}) || `\n`,
|
||||||
sepAnnotations: core.getInput('sep-annotations', {trimWhitespace: false}) || `\n`,
|
|
||||||
bakeTarget: core.getInput('bake-target') || `docker-metadata-action`,
|
bakeTarget: core.getInput('bake-target') || `docker-metadata-action`,
|
||||||
githubToken: core.getInput('github-token')
|
githubToken: core.getInput('github-token')
|
||||||
};
|
};
|
||||||
|
51
src/main.ts
51
src/main.ts
@ -6,10 +6,19 @@ import {Toolkit} from '@docker/actions-toolkit/lib/toolkit';
|
|||||||
import {getContext, getInputs, Inputs} from './context';
|
import {getContext, getInputs, Inputs} from './context';
|
||||||
import {Meta, Version} from './meta';
|
import {Meta, Version} from './meta';
|
||||||
|
|
||||||
|
function setOutput(name: string, value: string) {
|
||||||
|
core.setOutput(name, value);
|
||||||
|
core.exportVariable(`DOCKER_METADATA_OUTPUT_${name.replace(/\W/g, '_').toUpperCase()}`, value);
|
||||||
|
}
|
||||||
|
|
||||||
actionsToolkit.run(
|
actionsToolkit.run(
|
||||||
// main
|
// main
|
||||||
async () => {
|
async () => {
|
||||||
const inputs: Inputs = getInputs();
|
const inputs: Inputs = getInputs();
|
||||||
|
if (inputs.images.length == 0) {
|
||||||
|
throw new Error(`images input required`);
|
||||||
|
}
|
||||||
|
|
||||||
const toolkit = new Toolkit({githubToken: inputs.githubToken});
|
const toolkit = new Toolkit({githubToken: inputs.githubToken});
|
||||||
const context = await getContext(inputs.context);
|
const context = await getContext(inputs.context);
|
||||||
const repo = await toolkit.github.repoData();
|
const repo = await toolkit.github.repoData();
|
||||||
@ -65,46 +74,18 @@ actionsToolkit.run(
|
|||||||
setOutput('labels', labels.join(inputs.sepLabels));
|
setOutput('labels', labels.join(inputs.sepLabels));
|
||||||
});
|
});
|
||||||
|
|
||||||
// Annotations
|
|
||||||
const annotationsRaw: Array<string> = meta.getAnnotations();
|
|
||||||
const annotationsLevels = process.env.DOCKER_METADATA_ANNOTATIONS_LEVELS || 'manifest';
|
|
||||||
await core.group(`Annotations`, async () => {
|
|
||||||
const annotations: Array<string> = [];
|
|
||||||
for (const level of annotationsLevels.split(',')) {
|
|
||||||
annotations.push(
|
|
||||||
...annotationsRaw.map(label => {
|
|
||||||
const v = `${level}:${label}`;
|
|
||||||
core.info(v);
|
|
||||||
return v;
|
|
||||||
})
|
|
||||||
);
|
|
||||||
}
|
|
||||||
setOutput(`annotations`, annotations.join(inputs.sepAnnotations));
|
|
||||||
});
|
|
||||||
|
|
||||||
// JSON
|
// JSON
|
||||||
const jsonOutput = meta.getJSON(annotationsLevels.split(','));
|
const jsonOutput = meta.getJSON();
|
||||||
await core.group(`JSON output`, async () => {
|
await core.group(`JSON output`, async () => {
|
||||||
core.info(JSON.stringify(jsonOutput, null, 2));
|
core.info(JSON.stringify(jsonOutput, null, 2));
|
||||||
setOutput('json', JSON.stringify(jsonOutput));
|
setOutput('json', JSON.stringify(jsonOutput));
|
||||||
});
|
});
|
||||||
|
|
||||||
// Bake files
|
// Bake file definition
|
||||||
for (const kind of ['tags', 'labels', 'annotations:' + annotationsLevels]) {
|
const bakeFile: string = meta.getBakeFile();
|
||||||
const outputName = kind.split(':')[0];
|
await core.group(`Bake file definition`, async () => {
|
||||||
const bakeFile: string = meta.getBakeFile(kind);
|
core.info(fs.readFileSync(bakeFile, 'utf8'));
|
||||||
await core.group(`Bake file definition (${outputName})`, async () => {
|
setOutput('bake-file', bakeFile);
|
||||||
core.info(fs.readFileSync(bakeFile, 'utf8'));
|
});
|
||||||
setOutput(`bake-file-${outputName}`, bakeFile);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
// Bake file with tags and labels
|
|
||||||
setOutput(`bake-file`, `${meta.getBakeFileTagsLabels()}`);
|
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
function setOutput(name: string, value: string) {
|
|
||||||
core.setOutput(name, value);
|
|
||||||
core.exportVariable(`DOCKER_METADATA_OUTPUT_${name.replace(/\W/g, '_').toUpperCase()}`, value);
|
|
||||||
}
|
|
||||||
|
130
src/meta.ts
130
src/meta.ts
@ -440,43 +440,22 @@ export class Meta {
|
|||||||
if (!this.version.main) {
|
if (!this.version.main) {
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
|
const tags: Array<string> = [];
|
||||||
const generateTags = (imageName: string, version: string): Array<string> => {
|
for (const imageName of this.getImageNames()) {
|
||||||
const tags: Array<string> = [];
|
tags.push(`${imageName}:${this.version.main}`);
|
||||||
const prefix = imageName !== '' ? `${imageName}:` : '';
|
|
||||||
tags.push(`${prefix}${version}`);
|
|
||||||
for (const partial of this.version.partial) {
|
for (const partial of this.version.partial) {
|
||||||
tags.push(`${prefix}${partial}`);
|
tags.push(`${imageName}:${partial}`);
|
||||||
}
|
}
|
||||||
if (this.version.latest) {
|
if (this.version.latest) {
|
||||||
const latestTag = `${this.flavor.prefixLatest ? this.flavor.prefix : ''}latest${this.flavor.suffixLatest ? this.flavor.suffix : ''}`;
|
const latestTag = `${this.flavor.prefixLatest ? this.flavor.prefix : ''}latest${this.flavor.suffixLatest ? this.flavor.suffix : ''}`;
|
||||||
tags.push(`${prefix}${Meta.sanitizeTag(latestTag)}`);
|
tags.push(`${imageName}:${Meta.sanitizeTag(latestTag)}`);
|
||||||
}
|
}
|
||||||
return tags;
|
|
||||||
};
|
|
||||||
|
|
||||||
const tags: Array<string> = [];
|
|
||||||
const images = this.getImageNames();
|
|
||||||
if (images.length > 0) {
|
|
||||||
for (const imageName of images) {
|
|
||||||
tags.push(...generateTags(imageName, this.version.main));
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
tags.push(...generateTags('', this.version.main));
|
|
||||||
}
|
}
|
||||||
return tags;
|
return tags;
|
||||||
}
|
}
|
||||||
|
|
||||||
public getLabels(): Array<string> {
|
public getLabels(): Array<string> {
|
||||||
return this.getOCIAnnotationsWithCustoms(this.inputs.labels);
|
const labels: Array<string> = [
|
||||||
}
|
|
||||||
|
|
||||||
public getAnnotations(): Array<string> {
|
|
||||||
return this.getOCIAnnotationsWithCustoms(this.inputs.annotations);
|
|
||||||
}
|
|
||||||
|
|
||||||
private getOCIAnnotationsWithCustoms(extra: string[]): Array<string> {
|
|
||||||
const res: Array<string> = [
|
|
||||||
`org.opencontainers.image.title=${this.repo.name || ''}`,
|
`org.opencontainers.image.title=${this.repo.name || ''}`,
|
||||||
`org.opencontainers.image.description=${this.repo.description || ''}`,
|
`org.opencontainers.image.description=${this.repo.description || ''}`,
|
||||||
`org.opencontainers.image.url=${this.repo.html_url || ''}`,
|
`org.opencontainers.image.url=${this.repo.html_url || ''}`,
|
||||||
@ -486,11 +465,11 @@ export class Meta {
|
|||||||
`org.opencontainers.image.revision=${this.context.sha || ''}`,
|
`org.opencontainers.image.revision=${this.context.sha || ''}`,
|
||||||
`org.opencontainers.image.licenses=${this.repo.license?.spdx_id || ''}`
|
`org.opencontainers.image.licenses=${this.repo.license?.spdx_id || ''}`
|
||||||
];
|
];
|
||||||
res.push(...extra);
|
labels.push(...this.inputs.labels);
|
||||||
|
|
||||||
return Array.from(
|
return Array.from(
|
||||||
new Map<string, string>(
|
new Map<string, string>(
|
||||||
res
|
labels
|
||||||
.map(label => label.split('='))
|
.map(label => label.split('='))
|
||||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||||
.filter(([_key, ...values]) => values.length > 0)
|
.filter(([_key, ...values]) => values.length > 0)
|
||||||
@ -501,11 +480,7 @@ export class Meta {
|
|||||||
.map(([key, value]) => `${key}=${value}`);
|
.map(([key, value]) => `${key}=${value}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
public getJSON(alevels: string[]): unknown {
|
public getJSON(): unknown {
|
||||||
const annotations: Array<string> = [];
|
|
||||||
for (const level of alevels) {
|
|
||||||
annotations.push(...this.getAnnotations().map(label => `${level}:${label}`));
|
|
||||||
}
|
|
||||||
return {
|
return {
|
||||||
tags: this.getTags(),
|
tags: this.getTags(),
|
||||||
labels: this.getLabels().reduce((res, label) => {
|
labels: this.getLabels().reduce((res, label) => {
|
||||||
@ -515,74 +490,39 @@ export class Meta {
|
|||||||
}
|
}
|
||||||
res[matches[1]] = matches[2];
|
res[matches[1]] = matches[2];
|
||||||
return res;
|
return res;
|
||||||
}, {}),
|
}, {})
|
||||||
annotations: annotations
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
public getBakeFile(kind: string): string {
|
public getBakeFile(): string {
|
||||||
if (kind == 'tags') {
|
const bakeFile = path.join(ToolkitContext.tmpDir(), 'docker-metadata-action-bake.json');
|
||||||
return this.generateBakeFile(
|
fs.writeFileSync(
|
||||||
|
bakeFile,
|
||||||
|
JSON.stringify(
|
||||||
{
|
{
|
||||||
tags: this.getTags(),
|
target: {
|
||||||
args: {
|
[this.inputs.bakeTarget]: {
|
||||||
DOCKER_META_IMAGES: this.getImageNames().join(','),
|
tags: this.getTags(),
|
||||||
DOCKER_META_VERSION: this.version.main
|
labels: this.getLabels().reduce((res, label) => {
|
||||||
|
const matches = label.match(/([^=]*)=(.*)/);
|
||||||
|
if (!matches) {
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
res[matches[1]] = matches[2];
|
||||||
|
return res;
|
||||||
|
}, {}),
|
||||||
|
args: {
|
||||||
|
DOCKER_META_IMAGES: this.getImageNames().join(','),
|
||||||
|
DOCKER_META_VERSION: this.version.main
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
kind
|
null,
|
||||||
);
|
2
|
||||||
} else if (kind == 'labels') {
|
)
|
||||||
return this.generateBakeFile(
|
);
|
||||||
{
|
|
||||||
labels: this.getLabels().reduce((res, label) => {
|
|
||||||
const matches = label.match(/([^=]*)=(.*)/);
|
|
||||||
if (!matches) {
|
|
||||||
return res;
|
|
||||||
}
|
|
||||||
res[matches[1]] = matches[2];
|
|
||||||
return res;
|
|
||||||
}, {})
|
|
||||||
},
|
|
||||||
kind
|
|
||||||
);
|
|
||||||
} else if (kind.startsWith('annotations:')) {
|
|
||||||
const name = kind.split(':')[0];
|
|
||||||
const annotations: Array<string> = [];
|
|
||||||
for (const level of kind.split(':')[1].split(',')) {
|
|
||||||
annotations.push(...this.getAnnotations().map(label => `${level}:${label}`));
|
|
||||||
}
|
|
||||||
return this.generateBakeFile(
|
|
||||||
{
|
|
||||||
annotations: annotations
|
|
||||||
},
|
|
||||||
name
|
|
||||||
);
|
|
||||||
}
|
|
||||||
throw new Error(`Unknown bake file type: ${kind}`);
|
|
||||||
}
|
|
||||||
|
|
||||||
public getBakeFileTagsLabels(): string {
|
|
||||||
return this.generateBakeFile({
|
|
||||||
tags: this.getTags(),
|
|
||||||
labels: this.getLabels().reduce((res, label) => {
|
|
||||||
const matches = label.match(/([^=]*)=(.*)/);
|
|
||||||
if (!matches) {
|
|
||||||
return res;
|
|
||||||
}
|
|
||||||
res[matches[1]] = matches[2];
|
|
||||||
return res;
|
|
||||||
}, {}),
|
|
||||||
args: {
|
|
||||||
DOCKER_META_IMAGES: this.getImageNames().join(','),
|
|
||||||
DOCKER_META_VERSION: this.version.main
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
private generateBakeFile(dt, suffix?: string): string {
|
|
||||||
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));
|
|
||||||
return bakeFile;
|
return bakeFile;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4,11 +4,9 @@ RUN apk add --no-cache coreutils jq
|
|||||||
ARG DOCKER_METADATA_OUTPUT_VERSION
|
ARG DOCKER_METADATA_OUTPUT_VERSION
|
||||||
ARG DOCKER_METADATA_OUTPUT_TAGS
|
ARG DOCKER_METADATA_OUTPUT_TAGS
|
||||||
ARG DOCKER_METADATA_OUTPUT_LABELS
|
ARG DOCKER_METADATA_OUTPUT_LABELS
|
||||||
ARG DOCKER_METADATA_OUTPUT_ANNOTATIONS
|
|
||||||
ARG DOCKER_METADATA_OUTPUT_JSON
|
ARG DOCKER_METADATA_OUTPUT_JSON
|
||||||
RUN printenv DOCKER_METADATA_OUTPUT_VERSION
|
RUN printenv DOCKER_METADATA_OUTPUT_VERSION
|
||||||
RUN printenv DOCKER_METADATA_OUTPUT_TAGS
|
RUN printenv DOCKER_METADATA_OUTPUT_TAGS
|
||||||
RUN printenv DOCKER_METADATA_OUTPUT_LABELS
|
RUN printenv DOCKER_METADATA_OUTPUT_LABELS
|
||||||
RUN printenv DOCKER_METADATA_OUTPUT_ANNOTATIONS
|
|
||||||
RUN printenv DOCKER_METADATA_OUTPUT_JSON
|
RUN printenv DOCKER_METADATA_OUTPUT_JSON
|
||||||
RUN echo $DOCKER_METADATA_OUTPUT_JSON | jq
|
RUN echo $DOCKER_METADATA_OUTPUT_JSON | jq
|
||||||
|
Loading…
x
Reference in New Issue
Block a user