mirror of
https://github.com/docker/bake-action.git
synced 2026-06-05 09:38:40 +02:00
Compare commits
156 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 73b0efa7a0 | |||
| 29394f21ba | |||
| 908c98f276 | |||
| b6cc37d5b9 | |||
| dc557970d4 | |||
| 75d6ba252c | |||
| 49c6172f1b | |||
| c2d911883d | |||
| 1a7ee794b9 | |||
| d905335142 | |||
| c8060c064e | |||
| c4a4a41172 | |||
| 8529ef025a | |||
| 9775caf8a9 | |||
| 11d4bbed70 | |||
| 33a1cc61da | |||
| f423d25e3d | |||
| 017aa056d6 | |||
| ac8675748b | |||
| efcacd553e | |||
| 7ea090ddec | |||
| 9c020d87bf | |||
| 2930c788f0 | |||
| 5adcaf655c | |||
| 27bea1331e | |||
| dd824dd722 | |||
| ccc779750c | |||
| 9ef2cc9961 | |||
| b5447a726f | |||
| cd4ed51f40 | |||
| a1e9d9056a | |||
| a36b3d6c7b | |||
| 8ee01addc6 | |||
| fe4533e90f | |||
| 52a1696536 | |||
| 31ed06a2f8 | |||
| 849707117b | |||
| 76293d20bc | |||
| 8af72e0be9 | |||
| 0aeb216f16 | |||
| 286a2006a7 | |||
| b0c3bbe901 | |||
| db7848b641 | |||
| c2495acbad | |||
| 76ed7c5809 | |||
| 063b84c928 | |||
| f14c88d45c | |||
| f9a9d0f498 | |||
| 165199437b | |||
| 098c554ca2 | |||
| 9ceda10db5 | |||
| cff9398622 | |||
| 723de4133f | |||
| 6e0695d43f | |||
| 0ac360076f | |||
| 07a6fa9498 | |||
| 02fc58e41a | |||
| 29640fa79b | |||
| cfc6565e6e | |||
| 13d6925be9 | |||
| d7c9efcb85 | |||
| 04c7b671ff | |||
| 97e2ce4543 | |||
| 511fde2517 | |||
| 78f6bcc0c7 | |||
| 182ac9c10d | |||
| 3529f9f26a | |||
| 3a006c6dda | |||
| fcbf0b54f7 | |||
| d79fe12cbd | |||
| 1b6be708ad | |||
| c21c03ebb4 | |||
| 9a10c7c75c | |||
| e7c069c943 | |||
| 2f1dcd74d6 | |||
| 029c97d421 | |||
| 21b54260ab | |||
| aff6b59653 | |||
| 681d26bef6 | |||
| 2359948f31 | |||
| c3d79c1f33 | |||
| 82d9962996 | |||
| 8570565b5f | |||
| 41f3f77c35 | |||
| d38ae4f644 | |||
| f32fbeac61 | |||
| f081c1d573 | |||
| f0b60add7d | |||
| 674fd7a5cb | |||
| c6d0a7c2e8 | |||
| bcff464424 | |||
| 73fc28eadc | |||
| b587bf2d34 | |||
| d3191ad8da | |||
| f32f8b8d70 | |||
| 16a26530c2 | |||
| 917146eee9 | |||
| b4f450cb7d | |||
| 4cf768c75b | |||
| a841142820 | |||
| aeda4d1cdb | |||
| 445d2b3e0a | |||
| f50c6ab3a8 | |||
| 2891007d0d | |||
| e69738929b | |||
| 2c2cde50c2 | |||
| ad0d2a9712 | |||
| 21bfa47320 | |||
| c47b2ec26c | |||
| 9bcfb28dc6 | |||
| 4c1169b967 | |||
| 90417c5f4e | |||
| 0aa139c0c8 | |||
| e136219da1 | |||
| 39f20cb017 | |||
| 79237baae1 | |||
| 4d50b5c816 | |||
| 794e8fa13e | |||
| 0322b1ba9d | |||
| af2b81ec1f | |||
| 6926262e59 | |||
| d4d5e643fb | |||
| c5f51499a0 | |||
| dc94000d7c | |||
| b5a1ab1e8c | |||
| 6cf674e56b | |||
| 41bb376a43 | |||
| fd09ebd0b9 | |||
| 483bc58234 | |||
| 3f932d0083 | |||
| edc3f2a02e | |||
| 26816e4a1d | |||
| 51ec4ad8f4 | |||
| 9144340090 | |||
| 8d9b8f5e34 | |||
| f96d17d3cb | |||
| d156b88b24 | |||
| d6cd574eb3 | |||
| 209654f2ca | |||
| 134551bf17 | |||
| 667a8e0115 | |||
| 7594aa1931 | |||
| 01a0b5eddc | |||
| 8a5e28c41a | |||
| b2cff86154 | |||
| 7cd078e6ec | |||
| eadc6525c5 | |||
| bee1d8155e | |||
| e6b9522341 | |||
| f845891f5a | |||
| c89ac4a376 | |||
| fcc9bbc659 | |||
| d73a09800c | |||
| 33fe53ec17 | |||
| 6122353776 | |||
| 862a5ef0d5 |
@@ -0,0 +1,3 @@
|
|||||||
|
/dist/**
|
||||||
|
/coverage/**
|
||||||
|
/node_modules/**
|
||||||
+3
-2
@@ -1,11 +1,12 @@
|
|||||||
{
|
{
|
||||||
"env": {
|
"env": {
|
||||||
"node": true,
|
"node": true,
|
||||||
"es2021": true,
|
"es6": true,
|
||||||
"jest/globals": true
|
"jest": 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"
|
||||||
|
|||||||
@@ -1 +0,0 @@
|
|||||||
* @crazy-max
|
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
# Code of conduct
|
||||||
|
|
||||||
|
- [Moby community guidelines](https://github.com/moby/moby/blob/master/CONTRIBUTING.md#moby-community-guidelines)
|
||||||
@@ -0,0 +1,101 @@
|
|||||||
|
# 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/bake-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.
|
||||||
@@ -1,34 +0,0 @@
|
|||||||
---
|
|
||||||
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.
|
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
# 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/bake-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.
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
# 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
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
# 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.
|
||||||
@@ -1,31 +0,0 @@
|
|||||||
# Support [](https://isitmaintained.com/project/docker/bake-action)
|
|
||||||
|
|
||||||
First, [be a good guy](https://github.com/kossnocorp/etiquette/blob/master/README.md).
|
|
||||||
|
|
||||||
## Reporting an issue
|
|
||||||
|
|
||||||
Please do a search in [open issues](https://github.com/docker/bake-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/bake-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.
|
|
||||||
@@ -11,6 +11,7 @@ updates:
|
|||||||
directory: "/"
|
directory: "/"
|
||||||
schedule:
|
schedule:
|
||||||
interval: "daily"
|
interval: "daily"
|
||||||
|
versioning-strategy: "increase"
|
||||||
allow:
|
allow:
|
||||||
- dependency-type: "production"
|
- dependency-type: "production"
|
||||||
labels:
|
labels:
|
||||||
|
|||||||
@@ -0,0 +1,61 @@
|
|||||||
|
name: ci-subaction
|
||||||
|
|
||||||
|
concurrency:
|
||||||
|
group: ${{ github.workflow }}-${{ github.ref }}
|
||||||
|
cancel-in-progress: true
|
||||||
|
|
||||||
|
on:
|
||||||
|
workflow_dispatch:
|
||||||
|
schedule:
|
||||||
|
- cron: '0 10 * * *'
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- 'master'
|
||||||
|
- 'releases/v*'
|
||||||
|
tags:
|
||||||
|
- 'v*'
|
||||||
|
paths:
|
||||||
|
- '.github/workflows/ci-subaction.yml'
|
||||||
|
- 'subaction/**'
|
||||||
|
- 'test/**'
|
||||||
|
pull_request:
|
||||||
|
paths:
|
||||||
|
- '.github/workflows/ci-subaction.yml'
|
||||||
|
- 'subaction/**'
|
||||||
|
- 'test/**'
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
list-targets-group:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
-
|
||||||
|
name: Checkout
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
-
|
||||||
|
name: Matrix gen
|
||||||
|
id: gen
|
||||||
|
uses: ./subaction/list-targets
|
||||||
|
with:
|
||||||
|
workdir: ./test/group
|
||||||
|
-
|
||||||
|
name: Show matrix
|
||||||
|
run: |
|
||||||
|
echo matrix=${{ steps.gen.outputs.matrix }}
|
||||||
|
|
||||||
|
list-targets-group-matrix:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
-
|
||||||
|
name: Checkout
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
-
|
||||||
|
name: Matrix gen
|
||||||
|
id: gen
|
||||||
|
uses: ./subaction/list-targets
|
||||||
|
with:
|
||||||
|
workdir: ./test/group-matrix
|
||||||
|
target: validate
|
||||||
|
-
|
||||||
|
name: Show matrix
|
||||||
|
run: |
|
||||||
|
echo matrix=${{ steps.gen.outputs.matrix }}
|
||||||
+411
-16
@@ -1,18 +1,39 @@
|
|||||||
name: ci
|
name: ci
|
||||||
|
|
||||||
|
concurrency:
|
||||||
|
group: ${{ github.workflow }}-${{ github.ref }}
|
||||||
|
cancel-in-progress: true
|
||||||
|
|
||||||
on:
|
on:
|
||||||
|
workflow_dispatch:
|
||||||
|
inputs:
|
||||||
|
buildx-version:
|
||||||
|
description: 'Buildx version or Git context'
|
||||||
|
default: 'latest'
|
||||||
|
required: false
|
||||||
|
buildkit-image:
|
||||||
|
description: 'BuildKit image'
|
||||||
|
default: 'moby/buildkit:buildx-stable-1'
|
||||||
|
required: false
|
||||||
schedule:
|
schedule:
|
||||||
- cron: '0 10 * * *' # everyday at 10am
|
- cron: '0 10 * * *'
|
||||||
push:
|
push:
|
||||||
branches:
|
branches:
|
||||||
- 'master'
|
- 'master'
|
||||||
- 'releases/v*'
|
- 'releases/v*'
|
||||||
tags:
|
tags:
|
||||||
- 'v*'
|
- 'v*'
|
||||||
|
paths-ignore:
|
||||||
|
- '.github/workflows/ci-subaction.yml'
|
||||||
|
- 'subaction/**'
|
||||||
pull_request:
|
pull_request:
|
||||||
branches:
|
paths-ignore:
|
||||||
- 'master'
|
- '.github/workflows/ci-subaction.yml'
|
||||||
- 'releases/v*'
|
- 'subaction/**'
|
||||||
|
|
||||||
|
env:
|
||||||
|
BUILDX_VERSION: latest
|
||||||
|
BUILDKIT_IMAGE: moby/buildkit:buildx-stable-1
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
bake:
|
bake:
|
||||||
@@ -31,16 +52,19 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
-
|
-
|
||||||
name: Checkout
|
name: Checkout
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v4
|
||||||
-
|
-
|
||||||
name: Set up QEMU
|
name: Set up QEMU
|
||||||
uses: docker/setup-qemu-action@v2
|
uses: docker/setup-qemu-action@v3
|
||||||
-
|
-
|
||||||
name: Set up Docker Buildx
|
name: Set up Docker Buildx
|
||||||
id: buildx
|
id: buildx
|
||||||
uses: docker/setup-buildx-action@v2
|
uses: docker/setup-buildx-action@v3
|
||||||
with:
|
with:
|
||||||
driver-opts: network=host
|
version: ${{ inputs.buildx-version || env.BUILDX_VERSION }}
|
||||||
|
driver-opts: |
|
||||||
|
image=${{ inputs.buildkit-image || env.BUILDKIT_IMAGE }}
|
||||||
|
network=host
|
||||||
-
|
-
|
||||||
name: Build and push
|
name: Build and push
|
||||||
uses: ./
|
uses: ./
|
||||||
@@ -57,7 +81,7 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
-
|
-
|
||||||
name: Checkout
|
name: Checkout
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v4
|
||||||
-
|
-
|
||||||
name: Build
|
name: Build
|
||||||
continue-on-error: true
|
continue-on-error: true
|
||||||
@@ -73,11 +97,11 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
-
|
-
|
||||||
name: Checkout
|
name: Checkout
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v4
|
||||||
-
|
-
|
||||||
name: Stop docker
|
name: Stop docker
|
||||||
run: |
|
run: |
|
||||||
sudo systemctl stop docker
|
sudo systemctl stop docker docker.socket
|
||||||
-
|
-
|
||||||
name: Build
|
name: Build
|
||||||
id: bake
|
id: bake
|
||||||
@@ -100,14 +124,22 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
-
|
-
|
||||||
name: Checkout
|
name: Checkout
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v4
|
||||||
-
|
-
|
||||||
name: Uninstall moby cli
|
name: Uninstall docker cli
|
||||||
run: |
|
run: |
|
||||||
sudo apt-get purge -y moby-cli moby-buildx
|
if dpkg -s "docker-ce" >/dev/null 2>&1; then
|
||||||
|
sudo dpkg -r --force-depends docker-ce-cli docker-buildx-plugin
|
||||||
|
else
|
||||||
|
sudo apt-get purge -y moby-cli moby-buildx
|
||||||
|
fi
|
||||||
-
|
-
|
||||||
name: Set up Docker Buildx
|
name: Set up Docker Buildx
|
||||||
uses: docker/setup-buildx-action@v2
|
uses: docker/setup-buildx-action@v3
|
||||||
|
with:
|
||||||
|
version: ${{ inputs.buildx-version || env.BUILDX_VERSION }}
|
||||||
|
driver-opts: |
|
||||||
|
image=${{ inputs.buildkit-image || env.BUILDKIT_IMAGE }}
|
||||||
-
|
-
|
||||||
name: Build
|
name: Build
|
||||||
uses: ./
|
uses: ./
|
||||||
@@ -120,10 +152,373 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
-
|
-
|
||||||
name: Checkout
|
name: Checkout
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v4
|
||||||
-
|
-
|
||||||
name: Build
|
name: Build
|
||||||
uses: ./
|
uses: ./
|
||||||
with:
|
with:
|
||||||
source: https://github.com/docker/buildx.git#v0.8.2
|
source: https://github.com/docker/buildx.git#v0.8.2
|
||||||
targets: update-docs
|
targets: update-docs
|
||||||
|
|
||||||
|
provenance:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
attrs:
|
||||||
|
- ''
|
||||||
|
- mode=max
|
||||||
|
- builder-id=foo
|
||||||
|
- false
|
||||||
|
- true
|
||||||
|
steps:
|
||||||
|
-
|
||||||
|
name: Checkout
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
-
|
||||||
|
name: Set up Docker Buildx
|
||||||
|
uses: docker/setup-buildx-action@v3
|
||||||
|
with:
|
||||||
|
version: ${{ inputs.buildx-version || env.BUILDX_VERSION }}
|
||||||
|
driver-opts: |
|
||||||
|
network=host
|
||||||
|
image=${{ inputs.buildkit-image || env.BUILDKIT_IMAGE }}
|
||||||
|
-
|
||||||
|
name: Build
|
||||||
|
uses: ./
|
||||||
|
with:
|
||||||
|
workdir: ./test/go
|
||||||
|
targets: binary
|
||||||
|
provenance: ${{ matrix.attrs }}
|
||||||
|
set: |
|
||||||
|
*.output=type=oci,dest=/tmp/build.tar
|
||||||
|
*.cache-from=type=gha,scope=provenance
|
||||||
|
*.cache-to=type=gha,scope=provenance,mode=max
|
||||||
|
|
||||||
|
sbom:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
env:
|
||||||
|
DESTDIR: /tmp/bake-build
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
include:
|
||||||
|
- target: image
|
||||||
|
output: type=image,name=localhost:5000/name/app:latest,push=true
|
||||||
|
- target: binary
|
||||||
|
output: /tmp/bake-build
|
||||||
|
services:
|
||||||
|
registry:
|
||||||
|
image: registry:2
|
||||||
|
ports:
|
||||||
|
- 5000:5000
|
||||||
|
steps:
|
||||||
|
-
|
||||||
|
name: Checkout
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
-
|
||||||
|
name: Set up Docker Buildx
|
||||||
|
uses: docker/setup-buildx-action@v3
|
||||||
|
with:
|
||||||
|
version: ${{ inputs.buildx-version || env.BUILDX_VERSION }}
|
||||||
|
driver-opts: |
|
||||||
|
network=host
|
||||||
|
image=${{ inputs.buildkit-image || env.BUILDKIT_IMAGE }}
|
||||||
|
-
|
||||||
|
name: Build
|
||||||
|
uses: ./
|
||||||
|
with:
|
||||||
|
workdir: ./test/go
|
||||||
|
targets: ${{ matrix.target }}
|
||||||
|
sbom: true
|
||||||
|
set: |
|
||||||
|
*.output=${{ matrix.output }}
|
||||||
|
*.cache-from=type=gha,scope=attests-${{ matrix.target }}
|
||||||
|
*.cache-to=type=gha,scope=attests-${{ matrix.target }},mode=max
|
||||||
|
-
|
||||||
|
name: Inspect image
|
||||||
|
if: matrix.target == 'image'
|
||||||
|
run: |
|
||||||
|
docker buildx imagetools inspect localhost:5000/name/app:latest --format '{{json .}}'
|
||||||
|
-
|
||||||
|
name: Check output folder
|
||||||
|
if: matrix.target == 'binary'
|
||||||
|
working-directory: ${{ env.DESTDIR }}
|
||||||
|
run: |
|
||||||
|
tree .
|
||||||
|
-
|
||||||
|
name: Print provenance
|
||||||
|
if: matrix.target == 'binary'
|
||||||
|
working-directory: ${{ env.DESTDIR }}
|
||||||
|
run: |
|
||||||
|
cat provenance.json | jq
|
||||||
|
-
|
||||||
|
name: Print SBOM
|
||||||
|
if: matrix.target == 'binary'
|
||||||
|
working-directory: ${{ env.DESTDIR }}
|
||||||
|
run: |
|
||||||
|
cat sbom.spdx.json | jq
|
||||||
|
|
||||||
|
set:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
services:
|
||||||
|
registry:
|
||||||
|
image: registry:2
|
||||||
|
ports:
|
||||||
|
- 5000:5000
|
||||||
|
steps:
|
||||||
|
-
|
||||||
|
name: Checkout
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
-
|
||||||
|
name: Build
|
||||||
|
uses: ./
|
||||||
|
with:
|
||||||
|
workdir: ./test/go
|
||||||
|
set: |
|
||||||
|
*.platform=linux/amd64
|
||||||
|
*.output=type=image,"name=localhost:5000/name/app:v1.0.0,localhost:5000/name/app:latest",push=true
|
||||||
|
*.tags=
|
||||||
|
|
||||||
|
group:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
services:
|
||||||
|
registry:
|
||||||
|
image: registry:2
|
||||||
|
ports:
|
||||||
|
- 5000:5000
|
||||||
|
steps:
|
||||||
|
-
|
||||||
|
name: Checkout
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
-
|
||||||
|
name: Set up Docker Buildx
|
||||||
|
uses: docker/setup-buildx-action@v3
|
||||||
|
with:
|
||||||
|
version: ${{ inputs.buildx-version || env.BUILDX_VERSION }}
|
||||||
|
driver-opts: |
|
||||||
|
image=${{ inputs.buildkit-image || env.BUILDKIT_IMAGE }}
|
||||||
|
network=host
|
||||||
|
-
|
||||||
|
name: Build and push
|
||||||
|
uses: ./
|
||||||
|
with:
|
||||||
|
workdir: ./test/group
|
||||||
|
push: true
|
||||||
|
set: |
|
||||||
|
t1.tags=localhost:5000/name/app:t1
|
||||||
|
t2.tags=localhost:5000/name/app:t2
|
||||||
|
|
||||||
|
docker-config-malformed:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
-
|
||||||
|
name: Checkout
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
-
|
||||||
|
name: Set malformed docker config
|
||||||
|
run: |
|
||||||
|
mkdir -p ~/.docker
|
||||||
|
echo 'foo_bar' >> ~/.docker/config.json
|
||||||
|
-
|
||||||
|
name: Build
|
||||||
|
uses: ./
|
||||||
|
with:
|
||||||
|
files: |
|
||||||
|
./test/config.hcl
|
||||||
|
|
||||||
|
proxy-docker-config:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
services:
|
||||||
|
squid-proxy:
|
||||||
|
image: ubuntu/squid:latest
|
||||||
|
ports:
|
||||||
|
- 3128:3128
|
||||||
|
steps:
|
||||||
|
-
|
||||||
|
name: Check proxy
|
||||||
|
run: |
|
||||||
|
netstat -aptn
|
||||||
|
curl --retry 5 --retry-all-errors --retry-delay 0 --connect-timeout 5 --proxy http://127.0.0.1:3128 -v --insecure --head https://www.google.com
|
||||||
|
-
|
||||||
|
name: Checkout
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
-
|
||||||
|
name: Set proxy config
|
||||||
|
run: |
|
||||||
|
mkdir -p ~/.docker
|
||||||
|
echo '{"proxies":{"default":{"httpProxy":"http://127.0.0.1:3128","httpsProxy":"http://127.0.0.1:3128"}}}' > ~/.docker/config.json
|
||||||
|
-
|
||||||
|
name: Set up Docker Buildx
|
||||||
|
uses: docker/setup-buildx-action@v3
|
||||||
|
with:
|
||||||
|
version: ${{ inputs.buildx-version || env.BUILDX_VERSION }}
|
||||||
|
driver-opts: |
|
||||||
|
image=${{ inputs.buildkit-image || env.BUILDKIT_IMAGE }}
|
||||||
|
network=host
|
||||||
|
buildkitd-flags: --debug
|
||||||
|
-
|
||||||
|
name: Build
|
||||||
|
uses: ./
|
||||||
|
with:
|
||||||
|
files: |
|
||||||
|
./test/config.hcl
|
||||||
|
targets: app-proxy
|
||||||
|
|
||||||
|
proxy-buildkitd:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
services:
|
||||||
|
squid-proxy:
|
||||||
|
image: ubuntu/squid:latest
|
||||||
|
ports:
|
||||||
|
- 3128:3128
|
||||||
|
steps:
|
||||||
|
-
|
||||||
|
name: Check proxy
|
||||||
|
run: |
|
||||||
|
netstat -aptn
|
||||||
|
curl --retry 5 --retry-all-errors --retry-delay 0 --connect-timeout 5 --proxy http://127.0.0.1:3128 -v --insecure --head https://www.google.com
|
||||||
|
-
|
||||||
|
name: Checkout
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
-
|
||||||
|
name: Set up Docker Buildx
|
||||||
|
uses: docker/setup-buildx-action@v3
|
||||||
|
with:
|
||||||
|
version: ${{ inputs.buildx-version || env.BUILDX_VERSION }}
|
||||||
|
driver-opts: |
|
||||||
|
image=${{ inputs.buildkit-image || env.BUILDKIT_IMAGE }}
|
||||||
|
network=host
|
||||||
|
env.http_proxy=http://127.0.0.1:3128
|
||||||
|
env.https_proxy=http://127.0.0.1:3128
|
||||||
|
buildkitd-flags: --debug
|
||||||
|
-
|
||||||
|
name: Build
|
||||||
|
uses: ./
|
||||||
|
with:
|
||||||
|
files: |
|
||||||
|
./test/config.hcl
|
||||||
|
|
||||||
|
git-context:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
-
|
||||||
|
name: Checkout
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
-
|
||||||
|
name: Set up Docker Buildx
|
||||||
|
uses: docker/setup-buildx-action@v3
|
||||||
|
with:
|
||||||
|
version: ${{ inputs.buildx-version || env.BUILDX_VERSION }}
|
||||||
|
driver-opts: |
|
||||||
|
image=${{ inputs.buildkit-image || env.BUILDKIT_IMAGE }}
|
||||||
|
-
|
||||||
|
name: Build
|
||||||
|
uses: ./
|
||||||
|
with:
|
||||||
|
source: "{{defaultContext}}"
|
||||||
|
|
||||||
|
git-context-and-local:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
-
|
||||||
|
name: Checkout
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
-
|
||||||
|
name: Set up Docker Buildx
|
||||||
|
uses: docker/setup-buildx-action@v3
|
||||||
|
with:
|
||||||
|
version: ${{ inputs.buildx-version || env.BUILDX_VERSION }}
|
||||||
|
driver-opts: |
|
||||||
|
image=${{ inputs.buildkit-image || env.BUILDKIT_IMAGE }}
|
||||||
|
-
|
||||||
|
name: Docker meta
|
||||||
|
id: meta
|
||||||
|
uses: docker/metadata-action@v5
|
||||||
|
-
|
||||||
|
name: Build
|
||||||
|
uses: ./
|
||||||
|
with:
|
||||||
|
source: "{{defaultContext}}"
|
||||||
|
files: |
|
||||||
|
cwd://${{ steps.meta.outputs.bake-file }}
|
||||||
|
|
||||||
|
multi-output:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
services:
|
||||||
|
registry:
|
||||||
|
image: registry:2
|
||||||
|
ports:
|
||||||
|
- 5000:5000
|
||||||
|
steps:
|
||||||
|
-
|
||||||
|
name: Checkout
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
-
|
||||||
|
name: Set up Docker Buildx
|
||||||
|
uses: docker/setup-buildx-action@v3
|
||||||
|
with:
|
||||||
|
version: ${{ inputs.buildx-version || env.BUILDX_VERSION }}
|
||||||
|
driver-opts: |
|
||||||
|
network=host
|
||||||
|
-
|
||||||
|
name: Build and push
|
||||||
|
uses: ./
|
||||||
|
with:
|
||||||
|
workdir: ./test/go
|
||||||
|
set: |
|
||||||
|
*.output=type=image,name=localhost:5000/name/app:latest,push=true
|
||||||
|
*.output=type=docker,name=app:local
|
||||||
|
*.output=type=oci,dest=/tmp/oci.tar
|
||||||
|
-
|
||||||
|
name: Check registry
|
||||||
|
run: |
|
||||||
|
docker buildx imagetools inspect localhost:5000/name/app:latest --format '{{json .}}'
|
||||||
|
-
|
||||||
|
name: Check docker
|
||||||
|
run: |
|
||||||
|
docker image inspect app:local
|
||||||
|
-
|
||||||
|
name: Check oci
|
||||||
|
run: |
|
||||||
|
set -ex
|
||||||
|
mkdir -p /tmp/oci-out
|
||||||
|
tar xf /tmp/oci.tar -C /tmp/oci-out
|
||||||
|
tree -nh /tmp/oci-out
|
||||||
|
|
||||||
|
load-and-push:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
services:
|
||||||
|
registry:
|
||||||
|
image: registry:2
|
||||||
|
ports:
|
||||||
|
- 5000:5000
|
||||||
|
steps:
|
||||||
|
-
|
||||||
|
name: Checkout
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
-
|
||||||
|
name: Set up Docker Buildx
|
||||||
|
uses: docker/setup-buildx-action@v3
|
||||||
|
with:
|
||||||
|
version: ${{ inputs.buildx-version || env.BUILDX_VERSION }}
|
||||||
|
driver-opts: |
|
||||||
|
network=host
|
||||||
|
-
|
||||||
|
name: Build and push
|
||||||
|
uses: ./
|
||||||
|
with:
|
||||||
|
workdir: ./test/go
|
||||||
|
targets: image
|
||||||
|
load: true
|
||||||
|
push: true
|
||||||
|
set: |
|
||||||
|
*.tags=localhost:5000/name/app:latest
|
||||||
|
-
|
||||||
|
name: Check registry
|
||||||
|
run: |
|
||||||
|
docker buildx imagetools inspect localhost:5000/name/app:latest --format '{{json .}}'
|
||||||
|
-
|
||||||
|
name: Check docker
|
||||||
|
run: |
|
||||||
|
docker image inspect localhost:5000/name/app:latest
|
||||||
|
|||||||
@@ -1,14 +1,21 @@
|
|||||||
name: test
|
name: test
|
||||||
|
|
||||||
|
concurrency:
|
||||||
|
group: ${{ github.workflow }}-${{ github.ref }}
|
||||||
|
cancel-in-progress: true
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches:
|
branches:
|
||||||
- 'master'
|
- 'master'
|
||||||
- 'releases/v*'
|
- 'releases/v*'
|
||||||
|
paths-ignore:
|
||||||
|
- '.github/workflows/ci-subaction.yml'
|
||||||
|
- 'subaction/**'
|
||||||
pull_request:
|
pull_request:
|
||||||
branches:
|
paths-ignore:
|
||||||
- 'master'
|
- '.github/workflows/ci-subaction.yml'
|
||||||
- 'releases/v*'
|
- 'subaction/**'
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
test:
|
test:
|
||||||
@@ -16,14 +23,15 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
-
|
-
|
||||||
name: Checkout
|
name: Checkout
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v4
|
||||||
-
|
-
|
||||||
name: Test
|
name: Test
|
||||||
uses: docker/bake-action@v2
|
uses: docker/bake-action@v4
|
||||||
with:
|
with:
|
||||||
targets: test
|
targets: test
|
||||||
-
|
-
|
||||||
name: Upload coverage
|
name: Upload coverage
|
||||||
uses: codecov/codecov-action@v3
|
uses: codecov/codecov-action@v4
|
||||||
with:
|
with:
|
||||||
file: ./coverage/clover.xml
|
file: ./coverage/clover.xml
|
||||||
|
token: ${{ secrets.CODECOV_TOKEN }}
|
||||||
|
|||||||
@@ -1,24 +1,46 @@
|
|||||||
name: validate
|
name: validate
|
||||||
|
|
||||||
|
concurrency:
|
||||||
|
group: ${{ github.workflow }}-${{ github.ref }}
|
||||||
|
cancel-in-progress: true
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches:
|
branches:
|
||||||
- 'master'
|
- 'master'
|
||||||
- 'releases/v*'
|
- 'releases/v*'
|
||||||
pull_request:
|
pull_request:
|
||||||
branches:
|
|
||||||
- 'master'
|
|
||||||
- 'releases/v*'
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
validate:
|
prepare:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
outputs:
|
||||||
|
targets: ${{ steps.generate.outputs.targets }}
|
||||||
steps:
|
steps:
|
||||||
-
|
-
|
||||||
name: Checkout
|
name: Checkout
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v4
|
||||||
|
-
|
||||||
|
name: List targets
|
||||||
|
id: generate
|
||||||
|
uses: ./subaction/list-targets
|
||||||
|
with:
|
||||||
|
target: validate
|
||||||
|
|
||||||
|
validate:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
needs:
|
||||||
|
- prepare
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
target: ${{ fromJson(needs.prepare.outputs.targets) }}
|
||||||
|
steps:
|
||||||
|
-
|
||||||
|
name: Checkout
|
||||||
|
uses: actions/checkout@v4
|
||||||
-
|
-
|
||||||
name: Validate
|
name: Validate
|
||||||
uses: docker/bake-action@v2
|
uses: docker/bake-action@v4
|
||||||
with:
|
with:
|
||||||
targets: validate
|
targets: ${{ matrix.target }}
|
||||||
|
|||||||
@@ -1,15 +1,9 @@
|
|||||||
[](https://github.com/docker/bake-action/releases/latest)
|
[](https://github.com/docker/bake-action/releases/latest)
|
||||||
[](https://github.com/marketplace/actions/docker-buildx-bake)
|
[](https://github.com/marketplace/actions/docker-buildx-bake)
|
||||||
[](https://github.com/docker/bake-action/actions?workflow=test)
|
[](https://github.com/docker/bake-action/actions?workflow=ci)
|
||||||
|
[](https://github.com/docker/bake-action/actions?workflow=test)
|
||||||
[](https://codecov.io/gh/docker/bake-action)
|
[](https://codecov.io/gh/docker/bake-action)
|
||||||
|
|
||||||
## :test_tube: Experimental
|
|
||||||
|
|
||||||
This repository is considered **EXPERIMENTAL** and under active development
|
|
||||||
until further notice. It is subject to non-backward compatible changes or
|
|
||||||
removal in any future version, so you should [pin to a specific tag/commit](https://docs.github.com/en/actions/creating-actions/about-actions#using-tags-for-release-management)
|
|
||||||
of this action in your workflow (i.e `docker/bake-action@v1.1.3`).
|
|
||||||
|
|
||||||
## About
|
## About
|
||||||
|
|
||||||
GitHub Action to use Docker [Buildx Bake](https://docs.docker.com/build/customize/bake/)
|
GitHub Action to use Docker [Buildx Bake](https://docs.docker.com/build/customize/bake/)
|
||||||
@@ -20,13 +14,23 @@ as a high-level build command.
|
|||||||
___
|
___
|
||||||
|
|
||||||
* [Usage](#usage)
|
* [Usage](#usage)
|
||||||
|
* [Path context](#path-context)
|
||||||
|
* [Git context](#git-context)
|
||||||
* [Customizing](#customizing)
|
* [Customizing](#customizing)
|
||||||
* [inputs](#inputs)
|
* [inputs](#inputs)
|
||||||
* [outputs](#outputs)
|
* [outputs](#outputs)
|
||||||
|
* [Subactions](#subactions)
|
||||||
|
* [`list-targets`](#list-targets)
|
||||||
* [Contributing](#contributing)
|
* [Contributing](#contributing)
|
||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
|
|
||||||
|
### Path context
|
||||||
|
|
||||||
|
By default, this action will use the local bake definition (`source: .`), so
|
||||||
|
you need to use the [`actions/checkout`](https://github.com/actions/checkout/)
|
||||||
|
action to check out the repository.
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
name: ci
|
name: ci
|
||||||
|
|
||||||
@@ -41,28 +45,103 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
-
|
-
|
||||||
name: Checkout
|
name: Checkout
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v4
|
||||||
-
|
-
|
||||||
name: Set up Docker Buildx
|
name: Set up Docker Buildx
|
||||||
uses: docker/setup-buildx-action@v2
|
uses: docker/setup-buildx-action@v3
|
||||||
-
|
-
|
||||||
name: Login to DockerHub
|
name: Login to DockerHub
|
||||||
uses: docker/login-action@v2
|
uses: docker/login-action@v3
|
||||||
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/bake-action@v2
|
uses: docker/bake-action@v4
|
||||||
with:
|
with:
|
||||||
push: true
|
push: true
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### Git context
|
||||||
|
|
||||||
|
Git context can be provided using the [`source` input](#inputs). This means
|
||||||
|
that you don't need to use the [`actions/checkout`](https://github.com/actions/checkout/)
|
||||||
|
action to check out the repository as [BuildKit](https://docs.docker.com/build/buildkit/)
|
||||||
|
will do this directly.
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
name: ci
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- 'master'
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
bake:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
-
|
||||||
|
name: Set up Docker Buildx
|
||||||
|
uses: docker/setup-buildx-action@v3
|
||||||
|
-
|
||||||
|
name: Login to DockerHub
|
||||||
|
uses: docker/login-action@v3
|
||||||
|
with:
|
||||||
|
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||||
|
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||||
|
-
|
||||||
|
name: Build and push
|
||||||
|
uses: docker/bake-action@v4
|
||||||
|
with:
|
||||||
|
source: "${{ github.server_url }}/${{ github.repository }}.git#${{ github.ref }}"
|
||||||
|
push: true
|
||||||
|
```
|
||||||
|
|
||||||
|
Be careful because **any file mutation in the steps that precede the build step
|
||||||
|
will be ignored, including processing of the `.dockerignore` file** since
|
||||||
|
the context is based on the Git reference. However, you can use the
|
||||||
|
[Path context](#path-context) alongside the [`actions/checkout`](https://github.com/actions/checkout/)
|
||||||
|
action to remove this restriction.
|
||||||
|
|
||||||
|
Default Git context can also be provided using the [Handlebars template](https://handlebarsjs.com/guide/)
|
||||||
|
expression `{{defaultContext}}`. Here we can use it to provide a subdirectory
|
||||||
|
to the default Git context:
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
-
|
||||||
|
name: Build and push
|
||||||
|
uses: docker/bake-action@v4
|
||||||
|
with:
|
||||||
|
source: "{{defaultContext}}:mysubdir"
|
||||||
|
push: true
|
||||||
|
```
|
||||||
|
|
||||||
|
Building from the current repository automatically uses the `GITHUB_TOKEN`
|
||||||
|
secret that GitHub [automatically creates for workflows](https://docs.github.com/en/actions/security-guides/automatic-token-authentication),
|
||||||
|
so you don't need to pass that manually. If you want to authenticate against
|
||||||
|
another private repository for remote definitions, you can set the
|
||||||
|
[`BUILDX_BAKE_GIT_AUTH_TOKEN` environment variable](https://docs.docker.com/build/building/variables/#buildx_bake_git_auth_token).
|
||||||
|
|
||||||
|
> [!NOTE]
|
||||||
|
> Supported since Buildx 0.14.0
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
-
|
||||||
|
name: Build and push
|
||||||
|
uses: docker/bake-action@v4
|
||||||
|
with:
|
||||||
|
source: "${{ github.server_url }}/${{ github.repository }}.git#${{ github.ref }}"
|
||||||
|
push: true
|
||||||
|
env:
|
||||||
|
BUILDX_BAKE_GIT_AUTH_TOKEN: ${{ secrets.MYTOKEN }}
|
||||||
|
```
|
||||||
|
|
||||||
## Customizing
|
## Customizing
|
||||||
|
|
||||||
### inputs
|
### inputs
|
||||||
|
|
||||||
Following inputs can be used as `step.with` keys
|
The 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
|
||||||
@@ -79,27 +158,103 @@ Following inputs can be used as `step.with` keys
|
|||||||
> targets: default,release
|
> targets: default,release
|
||||||
> ```
|
> ```
|
||||||
|
|
||||||
| Name | Type | Description |
|
| Name | Type | Description |
|
||||||
|------------|----------|---------------------------------------------------------------------------------------------------------------------------------------------|
|
|----------------|-------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
||||||
| `builder` | String | Builder instance (see [setup-buildx](https://github.com/docker/setup-buildx-action) action) |
|
| `builder` | String | Builder instance (see [setup-buildx](https://github.com/docker/setup-buildx-action) action) |
|
||||||
| `files` | List/CSV | List of [bake definition files](https://docs.docker.com/build/customize/bake/file-definition/) |
|
| `source` | String | Context to build from. Can be either local (`.`) or a [remote bake definition](https://docs.docker.com/build/customize/bake/file-definition/#remote-definition) |
|
||||||
| `workdir` | String | Working directory of execution |
|
| `files` | List/CSV | List of [bake definition files](https://docs.docker.com/build/customize/bake/file-definition/) |
|
||||||
| `targets` | List/CSV | List of bake targets (`default` target used if empty) |
|
| `workdir` | String | Working directory of execution |
|
||||||
| `no-cache` | Bool | Do not use cache when building the image (default `false`) |
|
| `targets` | List/CSV | List of bake targets (`default` target used if empty) |
|
||||||
| `pull` | Bool | Always attempt to pull a newer version of the image (default `false`) |
|
| `no-cache` | Bool | Do not use cache when building the image (default `false`) |
|
||||||
| `load` | Bool | Load is a shorthand for `--set=*.output=type=docker` (default `false`) |
|
| `pull` | Bool | Always attempt to pull a newer version of the image (default `false`) |
|
||||||
| `push` | Bool | Push is a shorthand for `--set=*.output=type=registry` (default `false`) |
|
| `load` | Bool | Load is a shorthand for `--set=*.output=type=docker` (default `false`) |
|
||||||
| `set` | List | List of [targets values to override](https://docs.docker.com/engine/reference/commandline/buildx_bake/#set) (eg: `targetpattern.key=value`) |
|
| `provenance` | Bool/String | [Provenance](https://docs.docker.com/build/attestations/slsa-provenance/) is a shorthand for `--set=*.attest=type=provenance` |
|
||||||
| `source` | String | [Remote bake definition](https://docs.docker.com/build/customize/bake/file-definition/#remote-definition) to build from |
|
| `push` | Bool | Push is a shorthand for `--set=*.output=type=registry` (default `false`) |
|
||||||
|
| `sbom` | Bool/String | [SBOM](https://docs.docker.com/build/attestations/sbom/) is a shorthand for `--set=*.attest=type=sbom` |
|
||||||
|
| `set` | List | List of [targets values to override](https://docs.docker.com/engine/reference/commandline/buildx_bake/#set) (eg: `targetpattern.key=value`) |
|
||||||
|
| `github-token` | String | API token used to authenticate to a Git repository for [remote definitions](https://docs.docker.com/build/bake/remote-definition/) (default `${{ github.token }}`) |
|
||||||
|
|
||||||
### outputs
|
### outputs
|
||||||
|
|
||||||
Following outputs are available
|
The following outputs are available
|
||||||
|
|
||||||
| Name | Type | Description |
|
| Name | Type | Description |
|
||||||
|------------|------|-----------------------|
|
|------------|------|-----------------------|
|
||||||
| `metadata` | JSON | Build result metadata |
|
| `metadata` | JSON | Build result metadata |
|
||||||
|
|
||||||
|
## Subactions
|
||||||
|
|
||||||
|
### `list-targets`
|
||||||
|
|
||||||
|
This subaction generates a list of Bake targets that can be used in a [GitHub matrix](https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstrategymatrix),
|
||||||
|
so you can distribute your builds across multiple runners.
|
||||||
|
|
||||||
|
```hcl
|
||||||
|
# docker-bake.hcl
|
||||||
|
group "validate" {
|
||||||
|
targets = ["lint", "doctoc"]
|
||||||
|
}
|
||||||
|
|
||||||
|
target "lint" {
|
||||||
|
target = "lint"
|
||||||
|
}
|
||||||
|
|
||||||
|
target "doctoc" {
|
||||||
|
target = "doctoc"
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
jobs:
|
||||||
|
prepare:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
outputs:
|
||||||
|
targets: ${{ steps.generate.outputs.targets }}
|
||||||
|
steps:
|
||||||
|
-
|
||||||
|
name: Checkout
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
-
|
||||||
|
name: List targets
|
||||||
|
id: generate
|
||||||
|
uses: docker/bake-action/subaction/list-targets@v4
|
||||||
|
with:
|
||||||
|
target: validate
|
||||||
|
|
||||||
|
validate:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
needs:
|
||||||
|
- prepare
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
target: ${{ fromJson(needs.prepare.outputs.targets) }}
|
||||||
|
steps:
|
||||||
|
-
|
||||||
|
name: Checkout
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
-
|
||||||
|
name: Validate
|
||||||
|
uses: docker/bake-action@v4
|
||||||
|
with:
|
||||||
|
targets: ${{ matrix.target }}
|
||||||
|
```
|
||||||
|
#### inputs
|
||||||
|
|
||||||
|
| Name | Type | Description |
|
||||||
|
|--------------|-------------|---------------------------------------------------------------------------------------------------------------------------------------------|
|
||||||
|
| `workdir` | String | Working directory to use (defaults to `.`) |
|
||||||
|
| `files` | List/CSV | List of [bake definition files](https://docs.docker.com/build/customize/bake/file-definition/) |
|
||||||
|
| `target` | String | The target to use within the bake file |
|
||||||
|
|
||||||
|
#### outputs
|
||||||
|
|
||||||
|
The following outputs are available
|
||||||
|
|
||||||
|
| Name | Type | Description |
|
||||||
|
|------------|----------|----------------------------|
|
||||||
|
| `targets` | List/CSV | List of extracted targest |
|
||||||
|
|
||||||
## Contributing
|
## Contributing
|
||||||
|
|
||||||
Want to contribute? Awesome! You can find information about contributing to
|
Want to contribute? Awesome! You can find information about contributing to
|
||||||
|
|||||||
@@ -0,0 +1,207 @@
|
|||||||
|
import {jest} from '@jest/globals';
|
||||||
|
|
||||||
|
export const context = {
|
||||||
|
repo: {
|
||||||
|
owner: 'docker',
|
||||||
|
repo: 'build-push-action'
|
||||||
|
},
|
||||||
|
ref: 'refs/heads/master',
|
||||||
|
runId: 123456789,
|
||||||
|
payload: {
|
||||||
|
after: '860c1904a1ce19322e91ac35af1ab07466440c37',
|
||||||
|
base_ref: null,
|
||||||
|
before: '5f3331d7f7044c18ca9f12c77d961c4d7cf3276a',
|
||||||
|
commits: [
|
||||||
|
{
|
||||||
|
author: {
|
||||||
|
email: 'crazy-max@users.noreply.github.com',
|
||||||
|
name: 'CrazyMax',
|
||||||
|
username: 'crazy-max'
|
||||||
|
},
|
||||||
|
committer: {
|
||||||
|
email: 'crazy-max@users.noreply.github.com',
|
||||||
|
name: 'CrazyMax',
|
||||||
|
username: 'crazy-max'
|
||||||
|
},
|
||||||
|
distinct: true,
|
||||||
|
id: '860c1904a1ce19322e91ac35af1ab07466440c37',
|
||||||
|
message: 'hello dev',
|
||||||
|
timestamp: '2022-04-19T11:27:24+02:00',
|
||||||
|
tree_id: 'd2c60af597e863787d2d27f569e30495b0b92820',
|
||||||
|
url: 'https://github.com/docker/test-docker-action/commit/860c1904a1ce19322e91ac35af1ab07466440c37'
|
||||||
|
}
|
||||||
|
],
|
||||||
|
compare: 'https://github.com/docker/test-docker-action/compare/5f3331d7f704...860c1904a1ce',
|
||||||
|
created: false,
|
||||||
|
deleted: false,
|
||||||
|
forced: false,
|
||||||
|
head_commit: {
|
||||||
|
author: {
|
||||||
|
email: 'crazy-max@users.noreply.github.com',
|
||||||
|
name: 'CrazyMax',
|
||||||
|
username: 'crazy-max'
|
||||||
|
},
|
||||||
|
committer: {
|
||||||
|
email: 'crazy-max@users.noreply.github.com',
|
||||||
|
name: 'CrazyMax',
|
||||||
|
username: 'crazy-max'
|
||||||
|
},
|
||||||
|
distinct: true,
|
||||||
|
id: '860c1904a1ce19322e91ac35af1ab07466440c37',
|
||||||
|
message: 'hello dev',
|
||||||
|
timestamp: '2022-04-19T11:27:24+02:00',
|
||||||
|
tree_id: 'd2c60af597e863787d2d27f569e30495b0b92820',
|
||||||
|
url: 'https://github.com/docker/test-docker-action/commit/860c1904a1ce19322e91ac35af1ab07466440c37'
|
||||||
|
},
|
||||||
|
organization: {
|
||||||
|
avatar_url: 'https://avatars.githubusercontent.com/u/5429470?v=4',
|
||||||
|
description: 'Docker helps developers bring their ideas to life by conquering the complexity of app development.',
|
||||||
|
events_url: 'https://api.github.com/orgs/docker/events',
|
||||||
|
hooks_url: 'https://api.github.com/orgs/docker/hooks',
|
||||||
|
id: 5429470,
|
||||||
|
issues_url: 'https://api.github.com/orgs/docker/issues',
|
||||||
|
login: 'docker',
|
||||||
|
members_url: 'https://api.github.com/orgs/docker/members{/member}',
|
||||||
|
node_id: 'MDEyOk9yZ2FuaXphdGlvbjU0Mjk0NzA=',
|
||||||
|
public_members_url: 'https://api.github.com/orgs/docker/public_members{/member}',
|
||||||
|
repos_url: 'https://api.github.com/orgs/docker/repos',
|
||||||
|
url: 'https://api.github.com/orgs/docker'
|
||||||
|
},
|
||||||
|
pusher: {
|
||||||
|
email: 'github@crazymax.dev',
|
||||||
|
name: 'crazy-max'
|
||||||
|
},
|
||||||
|
ref: 'refs/heads/dev',
|
||||||
|
repository: {
|
||||||
|
allow_forking: true,
|
||||||
|
archive_url: 'https://api.github.com/repos/docker/test-docker-action/{archive_format}{/ref}',
|
||||||
|
archived: false,
|
||||||
|
assignees_url: 'https://api.github.com/repos/docker/test-docker-action/assignees{/user}',
|
||||||
|
blobs_url: 'https://api.github.com/repos/docker/test-docker-action/git/blobs{/sha}',
|
||||||
|
branches_url: 'https://api.github.com/repos/docker/test-docker-action/branches{/branch}',
|
||||||
|
clone_url: 'https://github.com/docker/test-docker-action.git',
|
||||||
|
collaborators_url: 'https://api.github.com/repos/docker/test-docker-action/collaborators{/collaborator}',
|
||||||
|
comments_url: 'https://api.github.com/repos/docker/test-docker-action/comments{/number}',
|
||||||
|
commits_url: 'https://api.github.com/repos/docker/test-docker-action/commits{/sha}',
|
||||||
|
compare_url: 'https://api.github.com/repos/docker/test-docker-action/compare/{base}...{head}',
|
||||||
|
contents_url: 'https://api.github.com/repos/docker/test-docker-action/contents/{+path}',
|
||||||
|
contributors_url: 'https://api.github.com/repos/docker/test-docker-action/contributors',
|
||||||
|
created_at: 1596792180,
|
||||||
|
default_branch: 'master',
|
||||||
|
deployments_url: 'https://api.github.com/repos/docker/test-docker-action/deployments',
|
||||||
|
description: 'Test "Docker" Actions',
|
||||||
|
disabled: false,
|
||||||
|
downloads_url: 'https://api.github.com/repos/docker/test-docker-action/downloads',
|
||||||
|
events_url: 'https://api.github.com/repos/docker/test-docker-action/events',
|
||||||
|
fork: false,
|
||||||
|
forks: 1,
|
||||||
|
forks_count: 1,
|
||||||
|
forks_url: 'https://api.github.com/repos/docker/test-docker-action/forks',
|
||||||
|
full_name: 'docker/test-docker-action',
|
||||||
|
git_commits_url: 'https://api.github.com/repos/docker/test-docker-action/git/commits{/sha}',
|
||||||
|
git_refs_url: 'https://api.github.com/repos/docker/test-docker-action/git/refs{/sha}',
|
||||||
|
git_tags_url: 'https://api.github.com/repos/docker/test-docker-action/git/tags{/sha}',
|
||||||
|
git_url: 'git://github.com/docker/test-docker-action.git',
|
||||||
|
has_downloads: true,
|
||||||
|
has_issues: true,
|
||||||
|
has_pages: false,
|
||||||
|
has_projects: true,
|
||||||
|
has_wiki: true,
|
||||||
|
homepage: '',
|
||||||
|
hooks_url: 'https://api.github.com/repos/docker/test-docker-action/hooks',
|
||||||
|
html_url: 'https://github.com/docker/test-docker-action',
|
||||||
|
id: 285789493,
|
||||||
|
is_template: false,
|
||||||
|
issue_comment_url: 'https://api.github.com/repos/docker/test-docker-action/issues/comments{/number}',
|
||||||
|
issue_events_url: 'https://api.github.com/repos/docker/test-docker-action/issues/events{/number}',
|
||||||
|
issues_url: 'https://api.github.com/repos/docker/test-docker-action/issues{/number}',
|
||||||
|
keys_url: 'https://api.github.com/repos/docker/test-docker-action/keys{/key_id}',
|
||||||
|
labels_url: 'https://api.github.com/repos/docker/test-docker-action/labels{/name}',
|
||||||
|
language: 'JavaScript',
|
||||||
|
languages_url: 'https://api.github.com/repos/docker/test-docker-action/languages',
|
||||||
|
license: {
|
||||||
|
key: 'mit',
|
||||||
|
name: 'MIT License',
|
||||||
|
node_id: 'MDc6TGljZW5zZTEz',
|
||||||
|
spdx_id: 'MIT',
|
||||||
|
url: 'https://api.github.com/licenses/mit'
|
||||||
|
},
|
||||||
|
master_branch: 'master',
|
||||||
|
merges_url: 'https://api.github.com/repos/docker/test-docker-action/merges',
|
||||||
|
milestones_url: 'https://api.github.com/repos/docker/test-docker-action/milestones{/number}',
|
||||||
|
mirror_url: null,
|
||||||
|
name: 'test-docker-action',
|
||||||
|
node_id: 'MDEwOlJlcG9zaXRvcnkyODU3ODk0OTM=',
|
||||||
|
notifications_url: 'https://api.github.com/repos/docker/test-docker-action/notifications{?since,all,participating}',
|
||||||
|
open_issues: 6,
|
||||||
|
open_issues_count: 6,
|
||||||
|
organization: 'docker',
|
||||||
|
owner: {
|
||||||
|
avatar_url: 'https://avatars.githubusercontent.com/u/5429470?v=4',
|
||||||
|
email: 'info@docker.com',
|
||||||
|
events_url: 'https://api.github.com/users/docker/events{/privacy}',
|
||||||
|
followers_url: 'https://api.github.com/users/docker/followers',
|
||||||
|
following_url: 'https://api.github.com/users/docker/following{/other_user}',
|
||||||
|
gists_url: 'https://api.github.com/users/docker/gists{/gist_id}',
|
||||||
|
gravatar_id: '',
|
||||||
|
html_url: 'https://github.com/docker',
|
||||||
|
id: 5429470,
|
||||||
|
login: 'docker',
|
||||||
|
name: 'docker',
|
||||||
|
node_id: 'MDEyOk9yZ2FuaXphdGlvbjU0Mjk0NzA=',
|
||||||
|
organizations_url: 'https://api.github.com/users/docker/orgs',
|
||||||
|
received_events_url: 'https://api.github.com/users/docker/received_events',
|
||||||
|
repos_url: 'https://api.github.com/users/docker/repos',
|
||||||
|
site_admin: false,
|
||||||
|
starred_url: 'https://api.github.com/users/docker/starred{/owner}{/repo}',
|
||||||
|
subscriptions_url: 'https://api.github.com/users/docker/subscriptions',
|
||||||
|
type: 'Organization',
|
||||||
|
url: 'https://api.github.com/users/docker'
|
||||||
|
},
|
||||||
|
private: true,
|
||||||
|
pulls_url: 'https://api.github.com/repos/docker/test-docker-action/pulls{/number}',
|
||||||
|
pushed_at: 1650360446,
|
||||||
|
releases_url: 'https://api.github.com/repos/docker/test-docker-action/releases{/id}',
|
||||||
|
size: 796,
|
||||||
|
ssh_url: 'git@github.com:docker/test-docker-action.git',
|
||||||
|
stargazers: 0,
|
||||||
|
stargazers_count: 0,
|
||||||
|
stargazers_url: 'https://api.github.com/repos/docker/test-docker-action/stargazers',
|
||||||
|
statuses_url: 'https://api.github.com/repos/docker/test-docker-action/statuses/{sha}',
|
||||||
|
subscribers_url: 'https://api.github.com/repos/docker/test-docker-action/subscribers',
|
||||||
|
subscription_url: 'https://api.github.com/repos/docker/test-docker-action/subscription',
|
||||||
|
svn_url: 'https://github.com/docker/test-docker-action',
|
||||||
|
tags_url: 'https://api.github.com/repos/docker/test-docker-action/tags',
|
||||||
|
teams_url: 'https://api.github.com/repos/docker/test-docker-action/teams',
|
||||||
|
topics: [],
|
||||||
|
trees_url: 'https://api.github.com/repos/docker/test-docker-action/git/trees{/sha}',
|
||||||
|
updated_at: '2022-04-19T09:05:09Z',
|
||||||
|
url: 'https://github.com/docker/test-docker-action',
|
||||||
|
visibility: 'private',
|
||||||
|
watchers: 0,
|
||||||
|
watchers_count: 0
|
||||||
|
},
|
||||||
|
sender: {
|
||||||
|
avatar_url: 'https://avatars.githubusercontent.com/u/1951866?v=4',
|
||||||
|
events_url: 'https://api.github.com/users/crazy-max/events{/privacy}',
|
||||||
|
followers_url: 'https://api.github.com/users/crazy-max/followers',
|
||||||
|
following_url: 'https://api.github.com/users/crazy-max/following{/other_user}',
|
||||||
|
gists_url: 'https://api.github.com/users/crazy-max/gists{/gist_id}',
|
||||||
|
gravatar_id: '',
|
||||||
|
html_url: 'https://github.com/crazy-max',
|
||||||
|
id: 1951866,
|
||||||
|
login: 'crazy-max',
|
||||||
|
node_id: 'MDQ6VXNlcjE5NTE4NjY=',
|
||||||
|
organizations_url: 'https://api.github.com/users/crazy-max/orgs',
|
||||||
|
received_events_url: 'https://api.github.com/users/crazy-max/received_events',
|
||||||
|
repos_url: 'https://api.github.com/users/crazy-max/repos',
|
||||||
|
site_admin: false,
|
||||||
|
starred_url: 'https://api.github.com/users/crazy-max/starred{/owner}{/repo}',
|
||||||
|
subscriptions_url: 'https://api.github.com/users/crazy-max/subscriptions',
|
||||||
|
type: 'User',
|
||||||
|
url: 'https://api.github.com/users/crazy-max'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
export const getOctokit = jest.fn();
|
||||||
@@ -1,74 +0,0 @@
|
|||||||
import {describe, expect, it, jest, test} from '@jest/globals';
|
|
||||||
import * as fs from 'fs';
|
|
||||||
import * as path from 'path';
|
|
||||||
import * as semver from 'semver';
|
|
||||||
import * as exec from '@actions/exec';
|
|
||||||
import * as buildx from '../src/buildx';
|
|
||||||
import * as context from '../src/context';
|
|
||||||
|
|
||||||
const tmpNameSync = path.join('/tmp/.docker-bake-jest', '.tmpname-jest').split(path.sep).join(path.posix.sep);
|
|
||||||
const metadata = `{
|
|
||||||
"containerimage.config.digest": "sha256:059b68a595b22564a1cbc167af369349fdc2ecc1f7bc092c2235cbf601a795fd",
|
|
||||||
"containerimage.digest": "sha256:b09b9482c72371486bb2c1d2c2a2633ed1d0b8389e12c8d52b9e052725c0c83c"
|
|
||||||
}`;
|
|
||||||
|
|
||||||
jest.spyOn(context, 'tmpDir').mockImplementation((): string => {
|
|
||||||
const tmpDir = path.join('/tmp/.docker-bake-jest').split(path.sep).join(path.posix.sep);
|
|
||||||
if (!fs.existsSync(tmpDir)) {
|
|
||||||
fs.mkdirSync(tmpDir, {recursive: true});
|
|
||||||
}
|
|
||||||
return tmpDir;
|
|
||||||
});
|
|
||||||
|
|
||||||
jest.spyOn(context, 'tmpNameSync').mockImplementation((): string => {
|
|
||||||
return tmpNameSync;
|
|
||||||
});
|
|
||||||
|
|
||||||
describe('getMetadata', () => {
|
|
||||||
it('matches', async () => {
|
|
||||||
const metadataFile = await buildx.getMetadataFile();
|
|
||||||
await fs.writeFileSync(metadataFile, metadata);
|
|
||||||
const expected = await buildx.getMetadata();
|
|
||||||
expect(expected).toEqual(metadata);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
describe('isAvailable', () => {
|
|
||||||
const execSpy = jest.spyOn(exec, 'getExecOutput');
|
|
||||||
buildx.isAvailable();
|
|
||||||
|
|
||||||
// eslint-disable-next-line jest/no-standalone-expect
|
|
||||||
expect(execSpy).toHaveBeenCalledWith(`docker`, ['buildx'], {
|
|
||||||
silent: true,
|
|
||||||
ignoreReturnCode: true
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
describe('isAvailable standalone', () => {
|
|
||||||
const execSpy = jest.spyOn(exec, 'getExecOutput');
|
|
||||||
buildx.isAvailable(true);
|
|
||||||
|
|
||||||
// eslint-disable-next-line jest/no-standalone-expect
|
|
||||||
expect(execSpy).toHaveBeenCalledWith(`buildx`, [], {
|
|
||||||
silent: true,
|
|
||||||
ignoreReturnCode: true
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
describe('getVersion', () => {
|
|
||||||
it('valid', async () => {
|
|
||||||
const version = await buildx.getVersion();
|
|
||||||
expect(semver.valid(version)).not.toBeNull();
|
|
||||||
}, 100000);
|
|
||||||
});
|
|
||||||
|
|
||||||
describe('parseVersion', () => {
|
|
||||||
test.each([
|
|
||||||
['github.com/docker/buildx 0.4.1+azure bda4882a65349ca359216b135896bddc1d92461c', '0.4.1'],
|
|
||||||
['github.com/docker/buildx v0.4.1 bda4882a65349ca359216b135896bddc1d92461c', '0.4.1'],
|
|
||||||
['github.com/docker/buildx v0.4.2 fb7b670b764764dc4716df3eba07ffdae4cc47b2', '0.4.2'],
|
|
||||||
['github.com/docker/buildx f117971 f11797113e5a9b86bd976329c5dbb8a8bfdfadfa', 'f117971']
|
|
||||||
])('given %p', async (stdout, expected) => {
|
|
||||||
expect(buildx.parseVersion(stdout)).toEqual(expected);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
+348
-140
@@ -1,151 +1,359 @@
|
|||||||
import {describe, expect, it} from '@jest/globals';
|
import {beforeEach, describe, expect, jest, test} from '@jest/globals';
|
||||||
|
import * as fs from 'fs';
|
||||||
|
import * as path from 'path';
|
||||||
|
import {Bake} from '@docker/actions-toolkit/lib/buildx/bake';
|
||||||
|
import {Builder} from '@docker/actions-toolkit/lib/buildx/builder';
|
||||||
|
import {Buildx} from '@docker/actions-toolkit/lib/buildx/buildx';
|
||||||
|
import {Context} from '@docker/actions-toolkit/lib/context';
|
||||||
|
import {Docker} from '@docker/actions-toolkit/lib/docker/docker';
|
||||||
|
import {GitHub} from '@docker/actions-toolkit/lib/github';
|
||||||
|
import {Toolkit} from '@docker/actions-toolkit/lib/toolkit';
|
||||||
|
import {BakeDefinition} from '@docker/actions-toolkit/lib/types/bake';
|
||||||
|
import {BuilderInfo} from '@docker/actions-toolkit/lib/types/builder';
|
||||||
|
import {GitHubRepo} from '@docker/actions-toolkit/lib/types/github';
|
||||||
|
|
||||||
import * as context from '../src/context';
|
import * as context from '../src/context';
|
||||||
|
|
||||||
describe('getInputList', () => {
|
const tmpDir = path.join('/tmp', '.docker-bake-action-jest');
|
||||||
it('single line correctly', async () => {
|
const tmpName = path.join(tmpDir, '.tmpname-jest');
|
||||||
await setInput('foo', 'bar');
|
|
||||||
const res = context.getInputList('foo');
|
|
||||||
expect(res).toEqual(['bar']);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('multiline correctly', async () => {
|
import repoFixture from './fixtures/github-repo.json';
|
||||||
setInput('foo', 'bar\nbaz');
|
jest.spyOn(GitHub.prototype, 'repoData').mockImplementation((): Promise<GitHubRepo> => {
|
||||||
const res = context.getInputList('foo');
|
return <Promise<GitHubRepo>>(repoFixture as unknown);
|
||||||
expect(res).toEqual(['bar', 'baz']);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('empty lines correctly', async () => {
|
|
||||||
setInput('foo', 'bar\n\nbaz');
|
|
||||||
const res = context.getInputList('foo');
|
|
||||||
expect(res).toEqual(['bar', 'baz']);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('comma correctly', async () => {
|
|
||||||
setInput('foo', 'bar,baz');
|
|
||||||
const res = context.getInputList('foo');
|
|
||||||
expect(res).toEqual(['bar', 'baz']);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('empty result correctly', async () => {
|
|
||||||
setInput('foo', 'bar,baz,');
|
|
||||||
const res = context.getInputList('foo');
|
|
||||||
expect(res).toEqual(['bar', 'baz']);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('different new lines correctly', async () => {
|
|
||||||
setInput('foo', 'bar\r\nbaz');
|
|
||||||
const res = context.getInputList('foo');
|
|
||||||
expect(res).toEqual(['bar', 'baz']);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('different new lines and comma correctly', async () => {
|
|
||||||
setInput('foo', 'bar\r\nbaz,bat');
|
|
||||||
const res = context.getInputList('foo');
|
|
||||||
expect(res).toEqual(['bar', 'baz', 'bat']);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('multiline and ignoring comma correctly', async () => {
|
|
||||||
setInput('cache-from', 'user/app:cache\ntype=local,src=path/to/dir');
|
|
||||||
const res = context.getInputList('cache-from', true);
|
|
||||||
expect(res).toEqual(['user/app:cache', 'type=local,src=path/to/dir']);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('different new lines and ignoring comma correctly', async () => {
|
|
||||||
setInput('cache-from', 'user/app:cache\r\ntype=local,src=path/to/dir');
|
|
||||||
const res = context.getInputList('cache-from', true);
|
|
||||||
expect(res).toEqual(['user/app:cache', 'type=local,src=path/to/dir']);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('multiline values', async () => {
|
|
||||||
setInput(
|
|
||||||
'secrets',
|
|
||||||
`GIT_AUTH_TOKEN=abcdefgh,ijklmno=0123456789
|
|
||||||
"MYSECRET=aaaaaaaa
|
|
||||||
bbbbbbb
|
|
||||||
ccccccccc"
|
|
||||||
FOO=bar`
|
|
||||||
);
|
|
||||||
const res = context.getInputList('secrets', true);
|
|
||||||
expect(res).toEqual([
|
|
||||||
'GIT_AUTH_TOKEN=abcdefgh,ijklmno=0123456789',
|
|
||||||
`MYSECRET=aaaaaaaa
|
|
||||||
bbbbbbb
|
|
||||||
ccccccccc`,
|
|
||||||
'FOO=bar'
|
|
||||||
]);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('multiline values with empty lines', async () => {
|
|
||||||
setInput(
|
|
||||||
'secrets',
|
|
||||||
`GIT_AUTH_TOKEN=abcdefgh,ijklmno=0123456789
|
|
||||||
"MYSECRET=aaaaaaaa
|
|
||||||
bbbbbbb
|
|
||||||
ccccccccc"
|
|
||||||
FOO=bar
|
|
||||||
"EMPTYLINE=aaaa
|
|
||||||
|
|
||||||
bbbb
|
|
||||||
ccc"`
|
|
||||||
);
|
|
||||||
const res = context.getInputList('secrets', true);
|
|
||||||
expect(res).toEqual([
|
|
||||||
'GIT_AUTH_TOKEN=abcdefgh,ijklmno=0123456789',
|
|
||||||
`MYSECRET=aaaaaaaa
|
|
||||||
bbbbbbb
|
|
||||||
ccccccccc`,
|
|
||||||
'FOO=bar',
|
|
||||||
`EMPTYLINE=aaaa
|
|
||||||
|
|
||||||
bbbb
|
|
||||||
ccc`
|
|
||||||
]);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('multiline values without quotes', async () => {
|
|
||||||
setInput(
|
|
||||||
'secrets',
|
|
||||||
`GIT_AUTH_TOKEN=abcdefgh,ijklmno=0123456789
|
|
||||||
MYSECRET=aaaaaaaa
|
|
||||||
bbbbbbb
|
|
||||||
ccccccccc
|
|
||||||
FOO=bar`
|
|
||||||
);
|
|
||||||
const res = context.getInputList('secrets', true);
|
|
||||||
expect(res).toEqual(['GIT_AUTH_TOKEN=abcdefgh,ijklmno=0123456789', 'MYSECRET=aaaaaaaa', 'bbbbbbb', 'ccccccccc', 'FOO=bar']);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('multiline values escape quotes', async () => {
|
|
||||||
setInput(
|
|
||||||
'secrets',
|
|
||||||
`GIT_AUTH_TOKEN=abcdefgh,ijklmno=0123456789
|
|
||||||
"MYSECRET=aaaaaaaa
|
|
||||||
bbbb""bbb
|
|
||||||
ccccccccc"
|
|
||||||
FOO=bar`
|
|
||||||
);
|
|
||||||
const res = context.getInputList('secrets', true);
|
|
||||||
expect(res).toEqual([
|
|
||||||
'GIT_AUTH_TOKEN=abcdefgh,ijklmno=0123456789',
|
|
||||||
`MYSECRET=aaaaaaaa
|
|
||||||
bbbb"bbb
|
|
||||||
ccccccccc`,
|
|
||||||
'FOO=bar'
|
|
||||||
]);
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('asyncForEach', () => {
|
jest.spyOn(Context, 'tmpDir').mockImplementation((): string => {
|
||||||
it('executes async tasks sequentially', async () => {
|
if (!fs.existsSync(tmpDir)) {
|
||||||
const testValues = [1, 2, 3, 4, 5];
|
fs.mkdirSync(tmpDir, {recursive: true});
|
||||||
const results: number[] = [];
|
}
|
||||||
|
return tmpDir;
|
||||||
|
});
|
||||||
|
|
||||||
await context.asyncForEach(testValues, async value => {
|
jest.spyOn(Context, 'tmpName').mockImplementation((): string => {
|
||||||
results.push(value);
|
return tmpName;
|
||||||
});
|
});
|
||||||
|
|
||||||
expect(results).toEqual(testValues);
|
jest.spyOn(Docker, 'isAvailable').mockImplementation(async (): Promise<boolean> => {
|
||||||
|
return true;
|
||||||
|
});
|
||||||
|
|
||||||
|
jest.spyOn(Builder.prototype, 'inspect').mockImplementation(async (): Promise<BuilderInfo> => {
|
||||||
|
return {
|
||||||
|
name: 'builder2',
|
||||||
|
driver: 'docker-container',
|
||||||
|
lastActivity: new Date('2023-01-16 09:45:23 +0000 UTC'),
|
||||||
|
nodes: [
|
||||||
|
{
|
||||||
|
buildkit: 'v0.11.0',
|
||||||
|
'buildkitd-flags': '--debug --allow-insecure-entitlement security.insecure --allow-insecure-entitlement network.host',
|
||||||
|
'driver-opts': ['BUILDKIT_STEP_LOG_MAX_SIZE=10485760', 'BUILDKIT_STEP_LOG_MAX_SPEED=10485760', 'JAEGER_TRACE=localhost:6831', 'image=moby/buildkit:latest', 'network=host'],
|
||||||
|
endpoint: 'unix:///var/run/docker.sock',
|
||||||
|
name: 'builder20',
|
||||||
|
platforms: 'linux/amd64,linux/amd64/v2,linux/amd64/v3,linux/arm64,linux/riscv64,linux/ppc64le,linux/s390x,linux/386,linux/mips64le,linux/mips64,linux/arm/v7,linux/arm/v6',
|
||||||
|
status: 'running'
|
||||||
|
}
|
||||||
|
]
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|
||||||
|
jest.spyOn(Bake.prototype, 'getDefinition').mockImplementation(async (): Promise<BakeDefinition> => {
|
||||||
|
return JSON.parse(`{
|
||||||
|
"group": {
|
||||||
|
"default": {
|
||||||
|
"targets": [
|
||||||
|
"validate"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"validate": {
|
||||||
|
"targets": [
|
||||||
|
"lint",
|
||||||
|
"validate-vendor",
|
||||||
|
"validate-docs"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"target": {
|
||||||
|
"lint": {
|
||||||
|
"context": ".",
|
||||||
|
"dockerfile": "./hack/dockerfiles/lint.Dockerfile",
|
||||||
|
"args": {
|
||||||
|
"BUILDKIT_CONTEXT_KEEP_GIT_DIR": "1",
|
||||||
|
"GO_VERSION": "1.20"
|
||||||
|
},
|
||||||
|
"output": [
|
||||||
|
"type=cacheonly"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"validate-docs": {
|
||||||
|
"context": ".",
|
||||||
|
"dockerfile": "./hack/dockerfiles/docs.Dockerfile",
|
||||||
|
"args": {
|
||||||
|
"BUILDKIT_CONTEXT_KEEP_GIT_DIR": "1",
|
||||||
|
"BUILDX_EXPERIMENTAL": "1",
|
||||||
|
"FORMATS": "md",
|
||||||
|
"GO_VERSION": "1.20"
|
||||||
|
},
|
||||||
|
"target": "validate",
|
||||||
|
"output": [
|
||||||
|
"type=cacheonly"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"validate-vendor": {
|
||||||
|
"context": ".",
|
||||||
|
"dockerfile": "./hack/dockerfiles/vendor.Dockerfile",
|
||||||
|
"args": {
|
||||||
|
"BUILDKIT_CONTEXT_KEEP_GIT_DIR": "1",
|
||||||
|
"GO_VERSION": "1.20"
|
||||||
|
},
|
||||||
|
"target": "validate",
|
||||||
|
"output": [
|
||||||
|
"type=cacheonly"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}`) as BakeDefinition;
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('getArgs', () => {
|
||||||
|
beforeEach(() => {
|
||||||
|
process.env = Object.keys(process.env).reduce((object, key) => {
|
||||||
|
if (!key.startsWith('INPUT_')) {
|
||||||
|
object[key] = process.env[key];
|
||||||
|
}
|
||||||
|
return object;
|
||||||
|
}, {});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// prettier-ignore
|
||||||
|
test.each([
|
||||||
|
[
|
||||||
|
0,
|
||||||
|
'0.4.1',
|
||||||
|
new Map<string, string>([
|
||||||
|
['load', 'false'],
|
||||||
|
['no-cache', 'false'],
|
||||||
|
['push', 'false'],
|
||||||
|
['pull', 'false'],
|
||||||
|
]),
|
||||||
|
[
|
||||||
|
'bake',
|
||||||
|
]
|
||||||
|
],
|
||||||
|
[
|
||||||
|
1,
|
||||||
|
'0.8.2',
|
||||||
|
new Map<string, string>([
|
||||||
|
['load', 'false'],
|
||||||
|
['no-cache', 'false'],
|
||||||
|
['push', 'false'],
|
||||||
|
['pull', 'false']
|
||||||
|
]),
|
||||||
|
[
|
||||||
|
'bake',
|
||||||
|
'--metadata-file', path.join(tmpDir, 'metadata-file')
|
||||||
|
]
|
||||||
|
],
|
||||||
|
[
|
||||||
|
2,
|
||||||
|
'0.8.2',
|
||||||
|
new Map<string, string>([
|
||||||
|
['targets', 'webapp\nvalidate'],
|
||||||
|
['load', 'false'],
|
||||||
|
['no-cache', 'false'],
|
||||||
|
['push', 'false'],
|
||||||
|
['pull', 'false']
|
||||||
|
]),
|
||||||
|
[
|
||||||
|
'bake',
|
||||||
|
'--metadata-file', path.join(tmpDir, 'metadata-file'),
|
||||||
|
'webapp', 'validate'
|
||||||
|
]
|
||||||
|
],
|
||||||
|
[
|
||||||
|
3,
|
||||||
|
'0.8.2',
|
||||||
|
new Map<string, string>([
|
||||||
|
['set', '*.cache-from=type=gha\n*.cache-to=type=gha'],
|
||||||
|
['load', 'false'],
|
||||||
|
['no-cache', 'false'],
|
||||||
|
['push', 'false'],
|
||||||
|
['pull', 'false']
|
||||||
|
]),
|
||||||
|
[
|
||||||
|
'bake',
|
||||||
|
'--set', '*.cache-from=type=gha',
|
||||||
|
'--set', '*.cache-to=type=gha',
|
||||||
|
'--metadata-file', path.join(tmpDir, 'metadata-file')
|
||||||
|
]
|
||||||
|
],
|
||||||
|
[
|
||||||
|
4,
|
||||||
|
'0.10.0',
|
||||||
|
new Map<string, string>([
|
||||||
|
['load', 'false'],
|
||||||
|
['no-cache', 'false'],
|
||||||
|
['push', 'false'],
|
||||||
|
['pull', 'false'],
|
||||||
|
]),
|
||||||
|
[
|
||||||
|
'bake',
|
||||||
|
'--metadata-file', path.join(tmpDir, 'metadata-file'),
|
||||||
|
"--provenance", `mode=min,inline-only=true,builder-id=https://github.com/docker/build-push-action/actions/runs/123456789`,
|
||||||
|
]
|
||||||
|
],
|
||||||
|
[
|
||||||
|
5,
|
||||||
|
'0.10.0',
|
||||||
|
new Map<string, string>([
|
||||||
|
['load', 'false'],
|
||||||
|
['no-cache', 'false'],
|
||||||
|
['push', 'false'],
|
||||||
|
['pull', 'false'],
|
||||||
|
['provenance', 'true'],
|
||||||
|
]),
|
||||||
|
[
|
||||||
|
'bake',
|
||||||
|
'--metadata-file', path.join(tmpDir, 'metadata-file'),
|
||||||
|
"--provenance", `builder-id=https://github.com/docker/build-push-action/actions/runs/123456789`
|
||||||
|
]
|
||||||
|
],
|
||||||
|
[
|
||||||
|
6,
|
||||||
|
'0.10.0',
|
||||||
|
new Map<string, string>([
|
||||||
|
['load', 'false'],
|
||||||
|
['no-cache', 'false'],
|
||||||
|
['push', 'false'],
|
||||||
|
['pull', 'false'],
|
||||||
|
['provenance', 'mode=max'],
|
||||||
|
]),
|
||||||
|
[
|
||||||
|
'bake',
|
||||||
|
'--metadata-file', path.join(tmpDir, 'metadata-file'),
|
||||||
|
"--provenance", `mode=max,builder-id=https://github.com/docker/build-push-action/actions/runs/123456789`
|
||||||
|
]
|
||||||
|
],
|
||||||
|
[
|
||||||
|
7,
|
||||||
|
'0.10.0',
|
||||||
|
new Map<string, string>([
|
||||||
|
['load', 'false'],
|
||||||
|
['no-cache', 'false'],
|
||||||
|
['push', 'false'],
|
||||||
|
['pull', 'false'],
|
||||||
|
['provenance', 'false'],
|
||||||
|
]),
|
||||||
|
[
|
||||||
|
'bake',
|
||||||
|
'--metadata-file', path.join(tmpDir, 'metadata-file'),
|
||||||
|
"--provenance", 'false'
|
||||||
|
]
|
||||||
|
],
|
||||||
|
[
|
||||||
|
8,
|
||||||
|
'0.10.0',
|
||||||
|
new Map<string, string>([
|
||||||
|
['load', 'false'],
|
||||||
|
['no-cache', 'false'],
|
||||||
|
['push', 'false'],
|
||||||
|
['pull', 'false'],
|
||||||
|
['provenance', 'builder-id=foo'],
|
||||||
|
]),
|
||||||
|
[
|
||||||
|
'bake',
|
||||||
|
'--metadata-file', path.join(tmpDir, 'metadata-file'),
|
||||||
|
"--provenance", 'builder-id=foo'
|
||||||
|
]
|
||||||
|
],
|
||||||
|
[
|
||||||
|
9,
|
||||||
|
'0.10.0',
|
||||||
|
new Map<string, string>([
|
||||||
|
['load', 'false'],
|
||||||
|
['no-cache', 'false'],
|
||||||
|
['push', 'false'],
|
||||||
|
['pull', 'false'],
|
||||||
|
['set', `*.platform=linux/amd64,linux/ppc64le,linux/s390x\n*.output=type=image,"name=moby/buildkit:v0.11.0,moby/buildkit:latest",push=true`],
|
||||||
|
['targets', `"image-all"`],
|
||||||
|
]),
|
||||||
|
[
|
||||||
|
'bake',
|
||||||
|
'--set', '*.platform=linux/amd64,linux/ppc64le,linux/s390x',
|
||||||
|
'--set', `*.output=type=image,"name=moby/buildkit:v0.11.0,moby/buildkit:latest",push=true`,
|
||||||
|
'--metadata-file', path.join(tmpDir, 'metadata-file'),
|
||||||
|
'--provenance', `mode=min,inline-only=true,builder-id=https://github.com/docker/build-push-action/actions/runs/123456789`,
|
||||||
|
'image-all'
|
||||||
|
]
|
||||||
|
],
|
||||||
|
[
|
||||||
|
10,
|
||||||
|
'0.10.0',
|
||||||
|
new Map<string, string>([
|
||||||
|
['load', 'false'],
|
||||||
|
['no-cache', 'false'],
|
||||||
|
['push', 'false'],
|
||||||
|
['pull', 'false'],
|
||||||
|
['set', `*.labels.foo=bar=#baz`],
|
||||||
|
['targets', `"image-all"`],
|
||||||
|
]),
|
||||||
|
[
|
||||||
|
'bake',
|
||||||
|
'--set', `*.labels.foo=bar=#baz`,
|
||||||
|
'--metadata-file', path.join(tmpDir, 'metadata-file'),
|
||||||
|
'--provenance', `mode=min,inline-only=true,builder-id=https://github.com/docker/build-push-action/actions/runs/123456789`,
|
||||||
|
'image-all'
|
||||||
|
]
|
||||||
|
],
|
||||||
|
[
|
||||||
|
11,
|
||||||
|
'0.10.0',
|
||||||
|
new Map<string, string>([
|
||||||
|
['source', '{{defaultContext}}'],
|
||||||
|
['load', 'false'],
|
||||||
|
['no-cache', 'false'],
|
||||||
|
['push', 'false'],
|
||||||
|
['pull', 'false'],
|
||||||
|
['files', './foo.hcl'],
|
||||||
|
]),
|
||||||
|
[
|
||||||
|
'bake',
|
||||||
|
'https://github.com/docker/build-push-action.git#refs/heads/master',
|
||||||
|
'--file', './foo.hcl',
|
||||||
|
'--metadata-file', path.join(tmpDir, 'metadata-file'),
|
||||||
|
'--provenance', `mode=min,inline-only=true,builder-id=https://github.com/docker/build-push-action/actions/runs/123456789`,
|
||||||
|
]
|
||||||
|
],
|
||||||
|
])(
|
||||||
|
'[%d] given %p with %p as inputs, returns %p',
|
||||||
|
async (num: number, buildxVersion: string, inputs: Map<string, string>, expected: Array<string>) => {
|
||||||
|
inputs.forEach((value: string, name: string) => {
|
||||||
|
setInput(name, value);
|
||||||
|
});
|
||||||
|
const toolkit = new Toolkit();
|
||||||
|
jest.spyOn(Buildx.prototype, 'version').mockImplementation(async (): Promise<string> => {
|
||||||
|
return buildxVersion;
|
||||||
|
});
|
||||||
|
const inp = await context.getInputs();
|
||||||
|
const definition = await toolkit.bake.getDefinition(
|
||||||
|
{
|
||||||
|
files: inp.files,
|
||||||
|
load: inp.load,
|
||||||
|
noCache: inp.noCache,
|
||||||
|
overrides: inp.set,
|
||||||
|
provenance: inp.provenance,
|
||||||
|
push: inp.push,
|
||||||
|
sbom: inp.sbom,
|
||||||
|
source: inp.source,
|
||||||
|
targets: inp.targets
|
||||||
|
},
|
||||||
|
{
|
||||||
|
cwd: inp.workdir
|
||||||
|
}
|
||||||
|
);
|
||||||
|
const res = await context.getArgs(inp, definition, toolkit);
|
||||||
|
expect(res).toEqual(expected);
|
||||||
|
}
|
||||||
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
// See: https://github.com/actions/toolkit/blob/a1b068ec31a042ff1e10a522d8fdf0b8869d53ca/packages/core/src/core.ts#L89
|
// See: https://github.com/actions/toolkit/blob/a1b068ec31a042ff1e10a522d8fdf0b8869d53ca/packages/core/src/core.ts#L89
|
||||||
|
|||||||
@@ -1,16 +0,0 @@
|
|||||||
import {describe, expect, it, jest} from '@jest/globals';
|
|
||||||
import * as docker from '../src/docker';
|
|
||||||
import * as exec from '@actions/exec';
|
|
||||||
|
|
||||||
describe('isAvailable', () => {
|
|
||||||
it('cli', () => {
|
|
||||||
const execSpy = jest.spyOn(exec, 'getExecOutput');
|
|
||||||
docker.isAvailable();
|
|
||||||
|
|
||||||
// eslint-disable-next-line jest/no-standalone-expect
|
|
||||||
expect(execSpy).toHaveBeenCalledWith(`docker`, undefined, {
|
|
||||||
silent: true,
|
|
||||||
ignoreReturnCode: true
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
|
||||||
@@ -0,0 +1,362 @@
|
|||||||
|
{
|
||||||
|
"id": 1296269,
|
||||||
|
"node_id": "MDEwOlJlcG9zaXRvcnkxMjk2MjY5",
|
||||||
|
"name": "Hello-World",
|
||||||
|
"full_name": "octocat/Hello-World",
|
||||||
|
"owner": {
|
||||||
|
"login": "octocat",
|
||||||
|
"id": 1,
|
||||||
|
"node_id": "MDQ6VXNlcjE=",
|
||||||
|
"avatar_url": "https://github.com/images/error/octocat_happy.gif",
|
||||||
|
"gravatar_id": "",
|
||||||
|
"url": "https://api.github.com/users/octocat",
|
||||||
|
"html_url": "https://github.com/octocat",
|
||||||
|
"followers_url": "https://api.github.com/users/octocat/followers",
|
||||||
|
"following_url": "https://api.github.com/users/octocat/following{/other_user}",
|
||||||
|
"gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
|
||||||
|
"starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
|
||||||
|
"subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
|
||||||
|
"organizations_url": "https://api.github.com/users/octocat/orgs",
|
||||||
|
"repos_url": "https://api.github.com/users/octocat/repos",
|
||||||
|
"events_url": "https://api.github.com/users/octocat/events{/privacy}",
|
||||||
|
"received_events_url": "https://api.github.com/users/octocat/received_events",
|
||||||
|
"type": "User",
|
||||||
|
"site_admin": false
|
||||||
|
},
|
||||||
|
"private": false,
|
||||||
|
"html_url": "https://github.com/octocat/Hello-World",
|
||||||
|
"description": "This your first repo!",
|
||||||
|
"fork": false,
|
||||||
|
"url": "https://api.github.com/repos/octocat/Hello-World",
|
||||||
|
"archive_url": "http://api.github.com/repos/octocat/Hello-World/{archive_format}{/ref}",
|
||||||
|
"assignees_url": "http://api.github.com/repos/octocat/Hello-World/assignees{/user}",
|
||||||
|
"blobs_url": "http://api.github.com/repos/octocat/Hello-World/git/blobs{/sha}",
|
||||||
|
"branches_url": "http://api.github.com/repos/octocat/Hello-World/branches{/branch}",
|
||||||
|
"collaborators_url": "http://api.github.com/repos/octocat/Hello-World/collaborators{/collaborator}",
|
||||||
|
"comments_url": "http://api.github.com/repos/octocat/Hello-World/comments{/number}",
|
||||||
|
"commits_url": "http://api.github.com/repos/octocat/Hello-World/commits{/sha}",
|
||||||
|
"compare_url": "http://api.github.com/repos/octocat/Hello-World/compare/{base}...{head}",
|
||||||
|
"contents_url": "http://api.github.com/repos/octocat/Hello-World/contents/{+path}",
|
||||||
|
"contributors_url": "http://api.github.com/repos/octocat/Hello-World/contributors",
|
||||||
|
"deployments_url": "http://api.github.com/repos/octocat/Hello-World/deployments",
|
||||||
|
"downloads_url": "http://api.github.com/repos/octocat/Hello-World/downloads",
|
||||||
|
"events_url": "http://api.github.com/repos/octocat/Hello-World/events",
|
||||||
|
"forks_url": "http://api.github.com/repos/octocat/Hello-World/forks",
|
||||||
|
"git_commits_url": "http://api.github.com/repos/octocat/Hello-World/git/commits{/sha}",
|
||||||
|
"git_refs_url": "http://api.github.com/repos/octocat/Hello-World/git/refs{/sha}",
|
||||||
|
"git_tags_url": "http://api.github.com/repos/octocat/Hello-World/git/tags{/sha}",
|
||||||
|
"git_url": "git:github.com/octocat/Hello-World.git",
|
||||||
|
"issue_comment_url": "http://api.github.com/repos/octocat/Hello-World/issues/comments{/number}",
|
||||||
|
"issue_events_url": "http://api.github.com/repos/octocat/Hello-World/issues/events{/number}",
|
||||||
|
"issues_url": "http://api.github.com/repos/octocat/Hello-World/issues{/number}",
|
||||||
|
"keys_url": "http://api.github.com/repos/octocat/Hello-World/keys{/key_id}",
|
||||||
|
"labels_url": "http://api.github.com/repos/octocat/Hello-World/labels{/name}",
|
||||||
|
"languages_url": "http://api.github.com/repos/octocat/Hello-World/languages",
|
||||||
|
"merges_url": "http://api.github.com/repos/octocat/Hello-World/merges",
|
||||||
|
"milestones_url": "http://api.github.com/repos/octocat/Hello-World/milestones{/number}",
|
||||||
|
"notifications_url": "http://api.github.com/repos/octocat/Hello-World/notifications{?since,all,participating}",
|
||||||
|
"pulls_url": "http://api.github.com/repos/octocat/Hello-World/pulls{/number}",
|
||||||
|
"releases_url": "http://api.github.com/repos/octocat/Hello-World/releases{/id}",
|
||||||
|
"ssh_url": "git@github.com:octocat/Hello-World.git",
|
||||||
|
"stargazers_url": "http://api.github.com/repos/octocat/Hello-World/stargazers",
|
||||||
|
"statuses_url": "http://api.github.com/repos/octocat/Hello-World/statuses/{sha}",
|
||||||
|
"subscribers_url": "http://api.github.com/repos/octocat/Hello-World/subscribers",
|
||||||
|
"subscription_url": "http://api.github.com/repos/octocat/Hello-World/subscription",
|
||||||
|
"tags_url": "http://api.github.com/repos/octocat/Hello-World/tags",
|
||||||
|
"teams_url": "http://api.github.com/repos/octocat/Hello-World/teams",
|
||||||
|
"trees_url": "http://api.github.com/repos/octocat/Hello-World/git/trees{/sha}",
|
||||||
|
"clone_url": "https://github.com/octocat/Hello-World.git",
|
||||||
|
"mirror_url": "git:git.example.com/octocat/Hello-World",
|
||||||
|
"hooks_url": "http://api.github.com/repos/octocat/Hello-World/hooks",
|
||||||
|
"svn_url": "https://svn.github.com/octocat/Hello-World",
|
||||||
|
"homepage": "https://github.com",
|
||||||
|
"language": null,
|
||||||
|
"forks_count": 9,
|
||||||
|
"stargazers_count": 80,
|
||||||
|
"watchers_count": 80,
|
||||||
|
"size": 108,
|
||||||
|
"default_branch": "master",
|
||||||
|
"open_issues_count": 0,
|
||||||
|
"is_template": true,
|
||||||
|
"topics": [
|
||||||
|
"octocat",
|
||||||
|
"atom",
|
||||||
|
"electron",
|
||||||
|
"api"
|
||||||
|
],
|
||||||
|
"has_issues": true,
|
||||||
|
"has_projects": true,
|
||||||
|
"has_wiki": true,
|
||||||
|
"has_pages": false,
|
||||||
|
"has_downloads": true,
|
||||||
|
"archived": false,
|
||||||
|
"disabled": false,
|
||||||
|
"visibility": "public",
|
||||||
|
"pushed_at": "2011-01-26T19:06:43Z",
|
||||||
|
"created_at": "2011-01-26T19:01:12Z",
|
||||||
|
"updated_at": "2011-01-26T19:14:43Z",
|
||||||
|
"permissions": {
|
||||||
|
"pull": true,
|
||||||
|
"triage": true,
|
||||||
|
"push": false,
|
||||||
|
"maintain": false,
|
||||||
|
"admin": false
|
||||||
|
},
|
||||||
|
"allow_rebase_merge": true,
|
||||||
|
"template_repository": null,
|
||||||
|
"temp_clone_token": "ABTLWHOULUVAXGTRYU7OC2876QJ2O",
|
||||||
|
"allow_squash_merge": true,
|
||||||
|
"delete_branch_on_merge": true,
|
||||||
|
"allow_merge_commit": true,
|
||||||
|
"subscribers_count": 42,
|
||||||
|
"network_count": 0,
|
||||||
|
"license": {
|
||||||
|
"key": "mit",
|
||||||
|
"name": "MIT License",
|
||||||
|
"spdx_id": "MIT",
|
||||||
|
"url": "https://api.github.com/licenses/mit",
|
||||||
|
"node_id": "MDc6TGljZW5zZW1pdA=="
|
||||||
|
},
|
||||||
|
"organization": {
|
||||||
|
"login": "octocat",
|
||||||
|
"id": 1,
|
||||||
|
"node_id": "MDQ6VXNlcjE=",
|
||||||
|
"avatar_url": "https://github.com/images/error/octocat_happy.gif",
|
||||||
|
"gravatar_id": "",
|
||||||
|
"url": "https://api.github.com/users/octocat",
|
||||||
|
"html_url": "https://github.com/octocat",
|
||||||
|
"followers_url": "https://api.github.com/users/octocat/followers",
|
||||||
|
"following_url": "https://api.github.com/users/octocat/following{/other_user}",
|
||||||
|
"gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
|
||||||
|
"starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
|
||||||
|
"subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
|
||||||
|
"organizations_url": "https://api.github.com/users/octocat/orgs",
|
||||||
|
"repos_url": "https://api.github.com/users/octocat/repos",
|
||||||
|
"events_url": "https://api.github.com/users/octocat/events{/privacy}",
|
||||||
|
"received_events_url": "https://api.github.com/users/octocat/received_events",
|
||||||
|
"type": "Organization",
|
||||||
|
"site_admin": false
|
||||||
|
},
|
||||||
|
"parent": {
|
||||||
|
"id": 1296269,
|
||||||
|
"node_id": "MDEwOlJlcG9zaXRvcnkxMjk2MjY5",
|
||||||
|
"name": "Hello-World",
|
||||||
|
"full_name": "octocat/Hello-World",
|
||||||
|
"owner": {
|
||||||
|
"login": "octocat",
|
||||||
|
"id": 1,
|
||||||
|
"node_id": "MDQ6VXNlcjE=",
|
||||||
|
"avatar_url": "https://github.com/images/error/octocat_happy.gif",
|
||||||
|
"gravatar_id": "",
|
||||||
|
"url": "https://api.github.com/users/octocat",
|
||||||
|
"html_url": "https://github.com/octocat",
|
||||||
|
"followers_url": "https://api.github.com/users/octocat/followers",
|
||||||
|
"following_url": "https://api.github.com/users/octocat/following{/other_user}",
|
||||||
|
"gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
|
||||||
|
"starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
|
||||||
|
"subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
|
||||||
|
"organizations_url": "https://api.github.com/users/octocat/orgs",
|
||||||
|
"repos_url": "https://api.github.com/users/octocat/repos",
|
||||||
|
"events_url": "https://api.github.com/users/octocat/events{/privacy}",
|
||||||
|
"received_events_url": "https://api.github.com/users/octocat/received_events",
|
||||||
|
"type": "User",
|
||||||
|
"site_admin": false
|
||||||
|
},
|
||||||
|
"private": false,
|
||||||
|
"html_url": "https://github.com/octocat/Hello-World",
|
||||||
|
"description": "This your first repo!",
|
||||||
|
"fork": false,
|
||||||
|
"url": "https://api.github.com/repos/octocat/Hello-World",
|
||||||
|
"archive_url": "http://api.github.com/repos/octocat/Hello-World/{archive_format}{/ref}",
|
||||||
|
"assignees_url": "http://api.github.com/repos/octocat/Hello-World/assignees{/user}",
|
||||||
|
"blobs_url": "http://api.github.com/repos/octocat/Hello-World/git/blobs{/sha}",
|
||||||
|
"branches_url": "http://api.github.com/repos/octocat/Hello-World/branches{/branch}",
|
||||||
|
"collaborators_url": "http://api.github.com/repos/octocat/Hello-World/collaborators{/collaborator}",
|
||||||
|
"comments_url": "http://api.github.com/repos/octocat/Hello-World/comments{/number}",
|
||||||
|
"commits_url": "http://api.github.com/repos/octocat/Hello-World/commits{/sha}",
|
||||||
|
"compare_url": "http://api.github.com/repos/octocat/Hello-World/compare/{base}...{head}",
|
||||||
|
"contents_url": "http://api.github.com/repos/octocat/Hello-World/contents/{+path}",
|
||||||
|
"contributors_url": "http://api.github.com/repos/octocat/Hello-World/contributors",
|
||||||
|
"deployments_url": "http://api.github.com/repos/octocat/Hello-World/deployments",
|
||||||
|
"downloads_url": "http://api.github.com/repos/octocat/Hello-World/downloads",
|
||||||
|
"events_url": "http://api.github.com/repos/octocat/Hello-World/events",
|
||||||
|
"forks_url": "http://api.github.com/repos/octocat/Hello-World/forks",
|
||||||
|
"git_commits_url": "http://api.github.com/repos/octocat/Hello-World/git/commits{/sha}",
|
||||||
|
"git_refs_url": "http://api.github.com/repos/octocat/Hello-World/git/refs{/sha}",
|
||||||
|
"git_tags_url": "http://api.github.com/repos/octocat/Hello-World/git/tags{/sha}",
|
||||||
|
"git_url": "git:github.com/octocat/Hello-World.git",
|
||||||
|
"issue_comment_url": "http://api.github.com/repos/octocat/Hello-World/issues/comments{/number}",
|
||||||
|
"issue_events_url": "http://api.github.com/repos/octocat/Hello-World/issues/events{/number}",
|
||||||
|
"issues_url": "http://api.github.com/repos/octocat/Hello-World/issues{/number}",
|
||||||
|
"keys_url": "http://api.github.com/repos/octocat/Hello-World/keys{/key_id}",
|
||||||
|
"labels_url": "http://api.github.com/repos/octocat/Hello-World/labels{/name}",
|
||||||
|
"languages_url": "http://api.github.com/repos/octocat/Hello-World/languages",
|
||||||
|
"merges_url": "http://api.github.com/repos/octocat/Hello-World/merges",
|
||||||
|
"milestones_url": "http://api.github.com/repos/octocat/Hello-World/milestones{/number}",
|
||||||
|
"notifications_url": "http://api.github.com/repos/octocat/Hello-World/notifications{?since,all,participating}",
|
||||||
|
"pulls_url": "http://api.github.com/repos/octocat/Hello-World/pulls{/number}",
|
||||||
|
"releases_url": "http://api.github.com/repos/octocat/Hello-World/releases{/id}",
|
||||||
|
"ssh_url": "git@github.com:octocat/Hello-World.git",
|
||||||
|
"stargazers_url": "http://api.github.com/repos/octocat/Hello-World/stargazers",
|
||||||
|
"statuses_url": "http://api.github.com/repos/octocat/Hello-World/statuses/{sha}",
|
||||||
|
"subscribers_url": "http://api.github.com/repos/octocat/Hello-World/subscribers",
|
||||||
|
"subscription_url": "http://api.github.com/repos/octocat/Hello-World/subscription",
|
||||||
|
"tags_url": "http://api.github.com/repos/octocat/Hello-World/tags",
|
||||||
|
"teams_url": "http://api.github.com/repos/octocat/Hello-World/teams",
|
||||||
|
"trees_url": "http://api.github.com/repos/octocat/Hello-World/git/trees{/sha}",
|
||||||
|
"clone_url": "https://github.com/octocat/Hello-World.git",
|
||||||
|
"mirror_url": "git:git.example.com/octocat/Hello-World",
|
||||||
|
"hooks_url": "http://api.github.com/repos/octocat/Hello-World/hooks",
|
||||||
|
"svn_url": "https://svn.github.com/octocat/Hello-World",
|
||||||
|
"homepage": "https://github.com",
|
||||||
|
"language": null,
|
||||||
|
"forks_count": 9,
|
||||||
|
"stargazers_count": 80,
|
||||||
|
"watchers_count": 80,
|
||||||
|
"size": 108,
|
||||||
|
"default_branch": "master",
|
||||||
|
"open_issues_count": 0,
|
||||||
|
"is_template": true,
|
||||||
|
"topics": [
|
||||||
|
"octocat",
|
||||||
|
"atom",
|
||||||
|
"electron",
|
||||||
|
"api"
|
||||||
|
],
|
||||||
|
"has_issues": true,
|
||||||
|
"has_projects": true,
|
||||||
|
"has_wiki": true,
|
||||||
|
"has_pages": false,
|
||||||
|
"has_downloads": true,
|
||||||
|
"archived": false,
|
||||||
|
"disabled": false,
|
||||||
|
"visibility": "public",
|
||||||
|
"pushed_at": "2011-01-26T19:06:43Z",
|
||||||
|
"created_at": "2011-01-26T19:01:12Z",
|
||||||
|
"updated_at": "2011-01-26T19:14:43Z",
|
||||||
|
"permissions": {
|
||||||
|
"admin": false,
|
||||||
|
"push": false,
|
||||||
|
"pull": true
|
||||||
|
},
|
||||||
|
"allow_rebase_merge": true,
|
||||||
|
"template_repository": null,
|
||||||
|
"temp_clone_token": "ABTLWHOULUVAXGTRYU7OC2876QJ2O",
|
||||||
|
"allow_squash_merge": true,
|
||||||
|
"delete_branch_on_merge": true,
|
||||||
|
"allow_merge_commit": true,
|
||||||
|
"subscribers_count": 42,
|
||||||
|
"network_count": 0
|
||||||
|
},
|
||||||
|
"source": {
|
||||||
|
"id": 1296269,
|
||||||
|
"node_id": "MDEwOlJlcG9zaXRvcnkxMjk2MjY5",
|
||||||
|
"name": "Hello-World",
|
||||||
|
"full_name": "octocat/Hello-World",
|
||||||
|
"owner": {
|
||||||
|
"login": "octocat",
|
||||||
|
"id": 1,
|
||||||
|
"node_id": "MDQ6VXNlcjE=",
|
||||||
|
"avatar_url": "https://github.com/images/error/octocat_happy.gif",
|
||||||
|
"gravatar_id": "",
|
||||||
|
"url": "https://api.github.com/users/octocat",
|
||||||
|
"html_url": "https://github.com/octocat",
|
||||||
|
"followers_url": "https://api.github.com/users/octocat/followers",
|
||||||
|
"following_url": "https://api.github.com/users/octocat/following{/other_user}",
|
||||||
|
"gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
|
||||||
|
"starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
|
||||||
|
"subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
|
||||||
|
"organizations_url": "https://api.github.com/users/octocat/orgs",
|
||||||
|
"repos_url": "https://api.github.com/users/octocat/repos",
|
||||||
|
"events_url": "https://api.github.com/users/octocat/events{/privacy}",
|
||||||
|
"received_events_url": "https://api.github.com/users/octocat/received_events",
|
||||||
|
"type": "User",
|
||||||
|
"site_admin": false
|
||||||
|
},
|
||||||
|
"private": false,
|
||||||
|
"html_url": "https://github.com/octocat/Hello-World",
|
||||||
|
"description": "This your first repo!",
|
||||||
|
"fork": false,
|
||||||
|
"url": "https://api.github.com/repos/octocat/Hello-World",
|
||||||
|
"archive_url": "http://api.github.com/repos/octocat/Hello-World/{archive_format}{/ref}",
|
||||||
|
"assignees_url": "http://api.github.com/repos/octocat/Hello-World/assignees{/user}",
|
||||||
|
"blobs_url": "http://api.github.com/repos/octocat/Hello-World/git/blobs{/sha}",
|
||||||
|
"branches_url": "http://api.github.com/repos/octocat/Hello-World/branches{/branch}",
|
||||||
|
"collaborators_url": "http://api.github.com/repos/octocat/Hello-World/collaborators{/collaborator}",
|
||||||
|
"comments_url": "http://api.github.com/repos/octocat/Hello-World/comments{/number}",
|
||||||
|
"commits_url": "http://api.github.com/repos/octocat/Hello-World/commits{/sha}",
|
||||||
|
"compare_url": "http://api.github.com/repos/octocat/Hello-World/compare/{base}...{head}",
|
||||||
|
"contents_url": "http://api.github.com/repos/octocat/Hello-World/contents/{+path}",
|
||||||
|
"contributors_url": "http://api.github.com/repos/octocat/Hello-World/contributors",
|
||||||
|
"deployments_url": "http://api.github.com/repos/octocat/Hello-World/deployments",
|
||||||
|
"downloads_url": "http://api.github.com/repos/octocat/Hello-World/downloads",
|
||||||
|
"events_url": "http://api.github.com/repos/octocat/Hello-World/events",
|
||||||
|
"forks_url": "http://api.github.com/repos/octocat/Hello-World/forks",
|
||||||
|
"git_commits_url": "http://api.github.com/repos/octocat/Hello-World/git/commits{/sha}",
|
||||||
|
"git_refs_url": "http://api.github.com/repos/octocat/Hello-World/git/refs{/sha}",
|
||||||
|
"git_tags_url": "http://api.github.com/repos/octocat/Hello-World/git/tags{/sha}",
|
||||||
|
"git_url": "git:github.com/octocat/Hello-World.git",
|
||||||
|
"issue_comment_url": "http://api.github.com/repos/octocat/Hello-World/issues/comments{/number}",
|
||||||
|
"issue_events_url": "http://api.github.com/repos/octocat/Hello-World/issues/events{/number}",
|
||||||
|
"issues_url": "http://api.github.com/repos/octocat/Hello-World/issues{/number}",
|
||||||
|
"keys_url": "http://api.github.com/repos/octocat/Hello-World/keys{/key_id}",
|
||||||
|
"labels_url": "http://api.github.com/repos/octocat/Hello-World/labels{/name}",
|
||||||
|
"languages_url": "http://api.github.com/repos/octocat/Hello-World/languages",
|
||||||
|
"merges_url": "http://api.github.com/repos/octocat/Hello-World/merges",
|
||||||
|
"milestones_url": "http://api.github.com/repos/octocat/Hello-World/milestones{/number}",
|
||||||
|
"notifications_url": "http://api.github.com/repos/octocat/Hello-World/notifications{?since,all,participating}",
|
||||||
|
"pulls_url": "http://api.github.com/repos/octocat/Hello-World/pulls{/number}",
|
||||||
|
"releases_url": "http://api.github.com/repos/octocat/Hello-World/releases{/id}",
|
||||||
|
"ssh_url": "git@github.com:octocat/Hello-World.git",
|
||||||
|
"stargazers_url": "http://api.github.com/repos/octocat/Hello-World/stargazers",
|
||||||
|
"statuses_url": "http://api.github.com/repos/octocat/Hello-World/statuses/{sha}",
|
||||||
|
"subscribers_url": "http://api.github.com/repos/octocat/Hello-World/subscribers",
|
||||||
|
"subscription_url": "http://api.github.com/repos/octocat/Hello-World/subscription",
|
||||||
|
"tags_url": "http://api.github.com/repos/octocat/Hello-World/tags",
|
||||||
|
"teams_url": "http://api.github.com/repos/octocat/Hello-World/teams",
|
||||||
|
"trees_url": "http://api.github.com/repos/octocat/Hello-World/git/trees{/sha}",
|
||||||
|
"clone_url": "https://github.com/octocat/Hello-World.git",
|
||||||
|
"mirror_url": "git:git.example.com/octocat/Hello-World",
|
||||||
|
"hooks_url": "http://api.github.com/repos/octocat/Hello-World/hooks",
|
||||||
|
"svn_url": "https://svn.github.com/octocat/Hello-World",
|
||||||
|
"homepage": "https://github.com",
|
||||||
|
"language": null,
|
||||||
|
"forks_count": 9,
|
||||||
|
"stargazers_count": 80,
|
||||||
|
"watchers_count": 80,
|
||||||
|
"size": 108,
|
||||||
|
"default_branch": "master",
|
||||||
|
"open_issues_count": 0,
|
||||||
|
"is_template": true,
|
||||||
|
"topics": [
|
||||||
|
"octocat",
|
||||||
|
"atom",
|
||||||
|
"electron",
|
||||||
|
"api"
|
||||||
|
],
|
||||||
|
"has_issues": true,
|
||||||
|
"has_projects": true,
|
||||||
|
"has_wiki": true,
|
||||||
|
"has_pages": false,
|
||||||
|
"has_downloads": true,
|
||||||
|
"archived": false,
|
||||||
|
"disabled": false,
|
||||||
|
"visibility": "public",
|
||||||
|
"pushed_at": "2011-01-26T19:06:43Z",
|
||||||
|
"created_at": "2011-01-26T19:01:12Z",
|
||||||
|
"updated_at": "2011-01-26T19:14:43Z",
|
||||||
|
"permissions": {
|
||||||
|
"admin": false,
|
||||||
|
"push": false,
|
||||||
|
"pull": true
|
||||||
|
},
|
||||||
|
"allow_rebase_merge": true,
|
||||||
|
"template_repository": null,
|
||||||
|
"temp_clone_token": "ABTLWHOULUVAXGTRYU7OC2876QJ2O",
|
||||||
|
"allow_squash_merge": true,
|
||||||
|
"delete_branch_on_merge": true,
|
||||||
|
"allow_merge_commit": true,
|
||||||
|
"subscribers_count": 42,
|
||||||
|
"network_count": 0
|
||||||
|
}
|
||||||
|
}
|
||||||
+14
-4
@@ -10,9 +10,12 @@ inputs:
|
|||||||
builder:
|
builder:
|
||||||
description: "Builder instance"
|
description: "Builder instance"
|
||||||
required: false
|
required: false
|
||||||
|
source:
|
||||||
|
description: "Context to build from. Can be either local or a remote bake definition"
|
||||||
|
required: false
|
||||||
files:
|
files:
|
||||||
description: "List of bake definition files"
|
description: "List of bake definition files"
|
||||||
required: true
|
required: false
|
||||||
workdir:
|
workdir:
|
||||||
description: "Working directory of bake execution"
|
description: "Working directory of bake execution"
|
||||||
required: false
|
required: false
|
||||||
@@ -32,15 +35,22 @@ inputs:
|
|||||||
description: "Load is a shorthand for --set=*.output=type=docker"
|
description: "Load is a shorthand for --set=*.output=type=docker"
|
||||||
required: false
|
required: false
|
||||||
default: 'false'
|
default: 'false'
|
||||||
|
provenance:
|
||||||
|
description: "Provenance is a shorthand for --set=*.attest=type=provenance"
|
||||||
|
required: false
|
||||||
push:
|
push:
|
||||||
description: "Push is a shorthand for --set=*.output=type=registry"
|
description: "Push is a shorthand for --set=*.output=type=registry"
|
||||||
required: false
|
required: false
|
||||||
default: 'false'
|
default: 'false'
|
||||||
|
sbom:
|
||||||
|
description: "SBOM is a shorthand for --set=*.attest=type=sbom"
|
||||||
|
required: false
|
||||||
set:
|
set:
|
||||||
description: "List of targets values to override (eg. targetpattern.key=value)"
|
description: "List of targets values to override (eg. targetpattern.key=value)"
|
||||||
required: false
|
required: false
|
||||||
source:
|
github-token:
|
||||||
description: "Remote bake definition to build from"
|
description: "API token used to authenticate to a Git repository for remote definitions"
|
||||||
|
default: ${{ github.token }}
|
||||||
required: false
|
required: false
|
||||||
|
|
||||||
outputs:
|
outputs:
|
||||||
@@ -48,5 +58,5 @@ outputs:
|
|||||||
description: 'Build result metadata'
|
description: 'Build result metadata'
|
||||||
|
|
||||||
runs:
|
runs:
|
||||||
using: 'node16'
|
using: 'node20'
|
||||||
main: 'dist/index.js'
|
main: 'dist/index.js'
|
||||||
|
|||||||
+18
-27
@@ -1,8 +1,6 @@
|
|||||||
# syntax=docker/dockerfile:1
|
# syntax=docker/dockerfile:1
|
||||||
|
|
||||||
ARG NODE_VERSION=16
|
ARG NODE_VERSION=20
|
||||||
ARG DOCKER_VERSION=20.10.13
|
|
||||||
ARG BUILDX_VERSION=0.8.1
|
|
||||||
|
|
||||||
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
|
||||||
@@ -18,14 +16,14 @@ COPY --from=deps /vendor /
|
|||||||
|
|
||||||
FROM deps AS vendor-validate
|
FROM deps AS vendor-validate
|
||||||
RUN --mount=type=bind,target=.,rw <<EOT
|
RUN --mount=type=bind,target=.,rw <<EOT
|
||||||
set -e
|
set -e
|
||||||
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-update"'
|
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
|
||||||
EOT
|
EOT
|
||||||
|
|
||||||
FROM deps AS build
|
FROM deps AS build
|
||||||
@@ -38,14 +36,14 @@ COPY --from=build /out /
|
|||||||
|
|
||||||
FROM build AS build-validate
|
FROM build AS build-validate
|
||||||
RUN --mount=type=bind,target=.,rw <<EOT
|
RUN --mount=type=bind,target=.,rw <<EOT
|
||||||
set -e
|
set -e
|
||||||
git add -A
|
git add -A
|
||||||
cp -rf /out/* .
|
cp -rf /out/* .
|
||||||
if [ -n "$(git status --porcelain -- dist)" ]; then
|
if [ -n "$(git status --porcelain -- dist)" ]; then
|
||||||
echo >&2 'ERROR: Build result differs. Please build first with "docker buildx bake build"'
|
echo >&2 'ERROR: Build result differs. Please build first with "docker buildx bake build"'
|
||||||
git status --porcelain -- dist
|
git status --porcelain -- dist
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
EOT
|
EOT
|
||||||
|
|
||||||
FROM deps AS format
|
FROM deps AS format
|
||||||
@@ -62,17 +60,10 @@ RUN --mount=type=bind,target=.,rw \
|
|||||||
--mount=type=cache,target=/src/node_modules \
|
--mount=type=cache,target=/src/node_modules \
|
||||||
yarn run lint
|
yarn run lint
|
||||||
|
|
||||||
FROM docker:${DOCKER_VERSION} as docker
|
|
||||||
FROM docker/buildx-bin:${BUILDX_VERSION} as buildx
|
|
||||||
|
|
||||||
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/node_modules \
|
--mount=type=cache,target=/src/node_modules \
|
||||||
--mount=type=bind,from=docker,source=/usr/local/bin/docker,target=/usr/bin/docker \
|
yarn run test --coverage --coverageDirectory=/tmp/coverage
|
||||||
--mount=type=bind,from=buildx,source=/buildx,target=/usr/libexec/docker/cli-plugins/docker-buildx \
|
|
||||||
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 /
|
||||||
|
|||||||
+24
-2
File diff suppressed because one or more lines are too long
+1
-1
File diff suppressed because one or more lines are too long
+1536
-114
File diff suppressed because it is too large
Load Diff
+1
-1
File diff suppressed because one or more lines are too long
+18
-1
@@ -1,7 +1,22 @@
|
|||||||
|
import fs from 'fs';
|
||||||
|
import os from 'os';
|
||||||
|
import path from 'path';
|
||||||
|
|
||||||
|
const tmpDir = fs.mkdtempSync(path.join(os.tmpdir(), 'docker-bake-action-'));
|
||||||
|
|
||||||
|
process.env = Object.assign({}, process.env, {
|
||||||
|
TEMP: tmpDir,
|
||||||
|
GITHUB_REPOSITORY: 'docker/bake-action',
|
||||||
|
RUNNER_TEMP: path.join(tmpDir, 'runner-temp'),
|
||||||
|
RUNNER_TOOL_CACHE: path.join(tmpDir, 'runner-tool-cache')
|
||||||
|
}) as {
|
||||||
|
[key: string]: string;
|
||||||
|
};
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
clearMocks: true,
|
clearMocks: true,
|
||||||
|
testEnvironment: 'node',
|
||||||
moduleFileExtensions: ['js', 'ts'],
|
moduleFileExtensions: ['js', 'ts'],
|
||||||
setupFiles: ['dotenv/config'],
|
|
||||||
testMatch: ['**/*.test.ts'],
|
testMatch: ['**/*.test.ts'],
|
||||||
transform: {
|
transform: {
|
||||||
'^.+\\.ts$': 'ts-jest'
|
'^.+\\.ts$': 'ts-jest'
|
||||||
@@ -9,5 +24,7 @@ module.exports = {
|
|||||||
moduleNameMapper: {
|
moduleNameMapper: {
|
||||||
'^csv-parse/sync': '<rootDir>/node_modules/csv-parse/dist/cjs/sync.cjs'
|
'^csv-parse/sync': '<rootDir>/node_modules/csv-parse/dist/cjs/sync.cjs'
|
||||||
},
|
},
|
||||||
|
collectCoverageFrom: ['src/**/{!(main.ts),}.ts'],
|
||||||
|
coveragePathIgnorePatterns: ['lib/', 'node_modules/', '__mocks__/', '__tests__/'],
|
||||||
verbose: true
|
verbose: true
|
||||||
};
|
};
|
||||||
|
|||||||
+24
-32
@@ -4,9 +4,13 @@
|
|||||||
"main": "lib/main.js",
|
"main": "lib/main.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "ncc build src/main.ts --source-map --minify --license licenses.txt",
|
"build": "ncc build src/main.ts --source-map --minify --license licenses.txt",
|
||||||
"lint": "eslint src/**/*.ts __tests__/**/*.ts",
|
"lint": "yarn run prettier && yarn run eslint",
|
||||||
"format": "eslint --fix src/**/*.ts __tests__/**/*.ts",
|
"format": "yarn run prettier:fix && yarn run eslint:fix",
|
||||||
"test": "jest --coverage",
|
"eslint": "eslint --max-warnings=0 .",
|
||||||
|
"eslint:fix": "eslint --fix .",
|
||||||
|
"prettier": "prettier --check \"./**/*.ts\"",
|
||||||
|
"prettier:fix": "prettier --write \"./**/*.ts\"",
|
||||||
|
"test": "jest",
|
||||||
"all": "yarn run build && yarn run format && yarn test"
|
"all": "yarn run build && yarn run format && yarn test"
|
||||||
},
|
},
|
||||||
"repository": {
|
"repository": {
|
||||||
@@ -19,38 +23,26 @@
|
|||||||
"buildx",
|
"buildx",
|
||||||
"bake"
|
"bake"
|
||||||
],
|
],
|
||||||
"author": "Docker",
|
"author": "Docker Inc.",
|
||||||
"contributors": [
|
|
||||||
{
|
|
||||||
"name": "CrazyMax",
|
|
||||||
"url": "https://crazymax.dev"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"license": "Apache-2.0",
|
"license": "Apache-2.0",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@actions/core": "^1.10.0",
|
"@actions/core": "^1.10.1",
|
||||||
"@actions/exec": "^1.1.1",
|
"@docker/actions-toolkit": "^0.21.1",
|
||||||
"csv-parse": "^5.3.0",
|
"handlebars": "^4.7.8"
|
||||||
"semver": "^7.3.7",
|
|
||||||
"tmp": "^0.2.1"
|
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/csv-parse": "^1.2.2",
|
"@types/node": "^20.5.9",
|
||||||
"@types/node": "^16.11.26",
|
"@typescript-eslint/eslint-plugin": "^6.6.0",
|
||||||
"@types/semver": "^7.3.9",
|
"@typescript-eslint/parser": "^6.6.0",
|
||||||
"@types/tmp": "^0.2.3",
|
"@vercel/ncc": "^0.38.0",
|
||||||
"@typescript-eslint/eslint-plugin": "^5.14.0",
|
"eslint": "^8.48.0",
|
||||||
"@typescript-eslint/parser": "^5.14.0",
|
"eslint-config-prettier": "^9.0.0",
|
||||||
"@vercel/ncc": "^0.33.3",
|
"eslint-plugin-jest": "^27.2.3",
|
||||||
"dotenv": "^16.0.0",
|
"eslint-plugin-prettier": "^5.0.0",
|
||||||
"eslint": "^8.11.0",
|
"jest": "^29.6.4",
|
||||||
"eslint-config-prettier": "^8.5.0",
|
"prettier": "^3.0.3",
|
||||||
"eslint-plugin-jest": "^26.1.1",
|
"ts-jest": "^29.1.1",
|
||||||
"eslint-plugin-prettier": "^4.0.0",
|
"ts-node": "^10.9.1",
|
||||||
"jest": "^27.2.5",
|
"typescript": "^5.2.2"
|
||||||
"prettier": "^2.3.1",
|
|
||||||
"ts-jest": "^27.1.2",
|
|
||||||
"ts-node": "^10.7.0",
|
|
||||||
"typescript": "^4.4.4"
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,75 +0,0 @@
|
|||||||
import fs from 'fs';
|
|
||||||
import path from 'path';
|
|
||||||
import * as semver from 'semver';
|
|
||||||
import * as exec from '@actions/exec';
|
|
||||||
|
|
||||||
import * as context from './context';
|
|
||||||
|
|
||||||
export async function getMetadataFile(): Promise<string> {
|
|
||||||
return path.join(context.tmpDir(), 'metadata-file').split(path.sep).join(path.posix.sep);
|
|
||||||
}
|
|
||||||
|
|
||||||
export async function getMetadata(): Promise<string | undefined> {
|
|
||||||
const metadataFile = await getMetadataFile();
|
|
||||||
if (!fs.existsSync(metadataFile)) {
|
|
||||||
return undefined;
|
|
||||||
}
|
|
||||||
const content = fs.readFileSync(metadataFile, {encoding: 'utf-8'}).trim();
|
|
||||||
if (content === 'null') {
|
|
||||||
return undefined;
|
|
||||||
}
|
|
||||||
return content;
|
|
||||||
}
|
|
||||||
|
|
||||||
export async function isAvailable(standalone?: boolean): Promise<boolean> {
|
|
||||||
const cmd = getCommand([], standalone);
|
|
||||||
return await exec
|
|
||||||
.getExecOutput(cmd.command, cmd.args, {
|
|
||||||
ignoreReturnCode: true,
|
|
||||||
silent: true
|
|
||||||
})
|
|
||||||
.then(res => {
|
|
||||||
if (res.stderr.length > 0 && res.exitCode != 0) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return res.exitCode == 0;
|
|
||||||
})
|
|
||||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
||||||
.catch(error => {
|
|
||||||
return false;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
export async function getVersion(standalone?: boolean): Promise<string> {
|
|
||||||
const cmd = getCommand(['version'], standalone);
|
|
||||||
return await exec
|
|
||||||
.getExecOutput(cmd.command, cmd.args, {
|
|
||||||
ignoreReturnCode: true,
|
|
||||||
silent: true
|
|
||||||
})
|
|
||||||
.then(res => {
|
|
||||||
if (res.stderr.length > 0 && res.exitCode != 0) {
|
|
||||||
throw new Error(res.stderr.trim());
|
|
||||||
}
|
|
||||||
return parseVersion(res.stdout.trim());
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
export function parseVersion(stdout: string): string {
|
|
||||||
const matches = /\sv?([0-9a-f]{7}|[0-9.]+)/.exec(stdout);
|
|
||||||
if (!matches) {
|
|
||||||
throw new Error(`Cannot parse buildx version`);
|
|
||||||
}
|
|
||||||
return matches[1];
|
|
||||||
}
|
|
||||||
|
|
||||||
export function satisfies(version: string, range: string): boolean {
|
|
||||||
return semver.satisfies(version, range) || /^[0-9a-f]{7}$/.exec(version) !== null;
|
|
||||||
}
|
|
||||||
|
|
||||||
export function getCommand(args: Array<string>, standalone?: boolean) {
|
|
||||||
return {
|
|
||||||
command: standalone ? 'buildx' : 'docker',
|
|
||||||
args: standalone ? args : ['buildx', ...args]
|
|
||||||
};
|
|
||||||
}
|
|
||||||
+51
-60
@@ -1,12 +1,12 @@
|
|||||||
import * as fs from 'fs';
|
|
||||||
import * as os from 'os';
|
|
||||||
import * as path from 'path';
|
|
||||||
import * as tmp from 'tmp';
|
|
||||||
import * as buildx from './buildx';
|
|
||||||
import * as core from '@actions/core';
|
import * as core from '@actions/core';
|
||||||
import {parse} from 'csv-parse/sync';
|
import * as handlebars from 'handlebars';
|
||||||
|
import {Bake} from '@docker/actions-toolkit/lib/buildx/bake';
|
||||||
let _tmpDir: string;
|
import {Context} from '@docker/actions-toolkit/lib/context';
|
||||||
|
import {Inputs as BuildxInputs} from '@docker/actions-toolkit/lib/buildx/inputs';
|
||||||
|
import {GitHub} from '@docker/actions-toolkit/lib/github';
|
||||||
|
import {Toolkit} from '@docker/actions-toolkit/lib/toolkit';
|
||||||
|
import {Util} from '@docker/actions-toolkit/lib/util';
|
||||||
|
import {BakeDefinition} from '@docker/actions-toolkit/lib/types/bake';
|
||||||
|
|
||||||
export interface Inputs {
|
export interface Inputs {
|
||||||
builder: string;
|
builder: string;
|
||||||
@@ -16,59 +16,74 @@ export interface Inputs {
|
|||||||
noCache: boolean;
|
noCache: boolean;
|
||||||
pull: boolean;
|
pull: boolean;
|
||||||
load: boolean;
|
load: boolean;
|
||||||
|
provenance: string;
|
||||||
push: boolean;
|
push: boolean;
|
||||||
|
sbom: string;
|
||||||
set: string[];
|
set: string[];
|
||||||
source: string;
|
source: string;
|
||||||
}
|
githubToken: string;
|
||||||
|
|
||||||
export function tmpDir(): string {
|
|
||||||
if (!_tmpDir) {
|
|
||||||
_tmpDir = fs.mkdtempSync(path.join(os.tmpdir(), 'docker-build-push-')).split(path.sep).join(path.posix.sep);
|
|
||||||
}
|
|
||||||
return _tmpDir;
|
|
||||||
}
|
|
||||||
|
|
||||||
export function tmpNameSync(options?: tmp.TmpNameOptions): string {
|
|
||||||
return tmp.tmpNameSync(options);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function getInputs(): Promise<Inputs> {
|
export async function getInputs(): Promise<Inputs> {
|
||||||
return {
|
return {
|
||||||
builder: core.getInput('builder'),
|
builder: core.getInput('builder'),
|
||||||
files: getInputList('files'),
|
files: Util.getInputList('files'),
|
||||||
workdir: core.getInput('workdir') || '.',
|
workdir: core.getInput('workdir') || '.',
|
||||||
targets: getInputList('targets'),
|
targets: Util.getInputList('targets'),
|
||||||
noCache: core.getBooleanInput('no-cache'),
|
noCache: core.getBooleanInput('no-cache'),
|
||||||
pull: core.getBooleanInput('pull'),
|
pull: core.getBooleanInput('pull'),
|
||||||
load: core.getBooleanInput('load'),
|
load: core.getBooleanInput('load'),
|
||||||
|
provenance: BuildxInputs.getProvenanceInput('provenance'),
|
||||||
push: core.getBooleanInput('push'),
|
push: core.getBooleanInput('push'),
|
||||||
set: getInputList('set', true),
|
sbom: core.getInput('sbom'),
|
||||||
source: core.getInput('source')
|
set: Util.getInputList('set', {ignoreComma: true, quote: false}),
|
||||||
|
source: getSourceInput('source'),
|
||||||
|
githubToken: core.getInput('github-token')
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function getArgs(inputs: Inputs, buildxVersion: string): Promise<Array<string>> {
|
export async function getArgs(inputs: Inputs, definition: BakeDefinition, toolkit: Toolkit): Promise<Array<string>> {
|
||||||
// prettier-ignore
|
// prettier-ignore
|
||||||
return [
|
return [
|
||||||
...await getBakeArgs(inputs, buildxVersion),
|
...await getBakeArgs(inputs, definition, toolkit),
|
||||||
...await getCommonArgs(inputs),
|
...await getCommonArgs(inputs),
|
||||||
...inputs.targets
|
...inputs.targets
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
async function getBakeArgs(inputs: Inputs, buildxVersion: string): Promise<Array<string>> {
|
async function getBakeArgs(inputs: Inputs, definition: BakeDefinition, toolkit: Toolkit): Promise<Array<string>> {
|
||||||
const args: Array<string> = ['bake'];
|
const args: Array<string> = ['bake'];
|
||||||
if (inputs.source) {
|
if (inputs.source) {
|
||||||
args.push(inputs.source);
|
args.push(inputs.source);
|
||||||
}
|
}
|
||||||
await asyncForEach(inputs.files, async file => {
|
await Util.asyncForEach(inputs.files, async file => {
|
||||||
args.push('--file', file);
|
args.push('--file', file);
|
||||||
});
|
});
|
||||||
await asyncForEach(inputs.set, async set => {
|
await Util.asyncForEach(inputs.set, async set => {
|
||||||
args.push('--set', set);
|
args.push('--set', set);
|
||||||
});
|
});
|
||||||
if (buildx.satisfies(buildxVersion, '>=0.6.0')) {
|
if (await toolkit.buildx.versionSatisfies('>=0.6.0')) {
|
||||||
args.push('--metadata-file', await buildx.getMetadataFile());
|
args.push('--metadata-file', BuildxInputs.getBuildMetadataFilePath());
|
||||||
|
}
|
||||||
|
if (await toolkit.buildx.versionSatisfies('>=0.10.0')) {
|
||||||
|
if (inputs.provenance) {
|
||||||
|
args.push('--provenance', inputs.provenance);
|
||||||
|
} else if ((await toolkit.buildkit.versionSatisfies(inputs.builder, '>=0.11.0')) && !Bake.hasDockerExporter(definition, inputs.load)) {
|
||||||
|
// if provenance not specified and BuildKit version compatible for
|
||||||
|
// attestation, set default provenance. Also needs to make sure user
|
||||||
|
// doesn't want to explicitly load the image to docker.
|
||||||
|
if (GitHub.context.payload.repository?.private ?? false) {
|
||||||
|
// if this is a private repository, we set the default provenance
|
||||||
|
// attributes being set in buildx: https://github.com/docker/buildx/blob/fb27e3f919dcbf614d7126b10c2bc2d0b1927eb6/build/build.go#L603
|
||||||
|
args.push('--provenance', BuildxInputs.resolveProvenanceAttrs(`mode=min,inline-only=true`));
|
||||||
|
} else {
|
||||||
|
// for a public repository, we set max provenance mode.
|
||||||
|
args.push('--provenance', BuildxInputs.resolveProvenanceAttrs(`mode=max`));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (inputs.sbom) {
|
||||||
|
args.push('--sbom', inputs.sbom);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return args;
|
return args;
|
||||||
}
|
}
|
||||||
@@ -93,36 +108,12 @@ async function getCommonArgs(inputs: Inputs): Promise<Array<string>> {
|
|||||||
return args;
|
return args;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getInputList(name: string, ignoreComma?: boolean): string[] {
|
function getSourceInput(name: string): string {
|
||||||
const res: Array<string> = [];
|
let source = handlebars.compile(core.getInput(name))({
|
||||||
|
defaultContext: Context.gitContext()
|
||||||
const items = core.getInput(name);
|
|
||||||
if (items == '') {
|
|
||||||
return res;
|
|
||||||
}
|
|
||||||
|
|
||||||
const records = parse(items, {
|
|
||||||
columns: false,
|
|
||||||
relaxColumnCount: true,
|
|
||||||
skipEmptyLines: true
|
|
||||||
});
|
});
|
||||||
|
if (source === '.') {
|
||||||
for (const record of records as Array<string[]>) {
|
source = '';
|
||||||
if (record.length == 1) {
|
|
||||||
res.push(record[0]);
|
|
||||||
continue;
|
|
||||||
} else if (!ignoreComma) {
|
|
||||||
res.push(...record);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
res.push(record.join(','));
|
|
||||||
}
|
}
|
||||||
|
return source;
|
||||||
return res.filter(item => item).map(pat => pat.trim());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export const asyncForEach = async (array, callback) => {
|
|
||||||
for (let index = 0; index < array.length; index++) {
|
|
||||||
await callback(array[index], index, array);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|||||||
@@ -1,19 +0,0 @@
|
|||||||
import * as exec from '@actions/exec';
|
|
||||||
|
|
||||||
export async function isAvailable(): Promise<boolean> {
|
|
||||||
return await exec
|
|
||||||
.getExecOutput('docker', undefined, {
|
|
||||||
ignoreReturnCode: true,
|
|
||||||
silent: true
|
|
||||||
})
|
|
||||||
.then(res => {
|
|
||||||
if (res.stderr.length > 0 && res.exitCode != 0) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return res.exitCode == 0;
|
|
||||||
})
|
|
||||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
||||||
.catch(error => {
|
|
||||||
return false;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
+120
-65
@@ -1,87 +1,142 @@
|
|||||||
import * as fs from 'fs';
|
import * as fs from 'fs';
|
||||||
import * as buildx from './buildx';
|
import * as path from 'path';
|
||||||
import * as context from './context';
|
|
||||||
import * as docker from './docker';
|
|
||||||
import * as stateHelper from './state-helper';
|
|
||||||
import * as core from '@actions/core';
|
import * as core from '@actions/core';
|
||||||
import * as exec from '@actions/exec';
|
import * as actionsToolkit from '@docker/actions-toolkit';
|
||||||
|
import {Inputs as BuildxInputs} from '@docker/actions-toolkit/lib/buildx/inputs';
|
||||||
|
import {Context} from '@docker/actions-toolkit/lib/context';
|
||||||
|
import {Docker} from '@docker/actions-toolkit/lib/docker/docker';
|
||||||
|
import {Exec} from '@docker/actions-toolkit/lib/exec';
|
||||||
|
import {GitHub} from '@docker/actions-toolkit/lib/github';
|
||||||
|
import {Toolkit} from '@docker/actions-toolkit/lib/toolkit';
|
||||||
|
import {BakeDefinition} from '@docker/actions-toolkit/lib/types/bake';
|
||||||
|
import {ConfigFile} from '@docker/actions-toolkit/lib/types/docker';
|
||||||
|
|
||||||
async function run(): Promise<void> {
|
import * as context from './context';
|
||||||
try {
|
import * as stateHelper from './state-helper';
|
||||||
|
|
||||||
|
actionsToolkit.run(
|
||||||
|
// main
|
||||||
|
async () => {
|
||||||
const inputs: context.Inputs = await context.getInputs();
|
const inputs: context.Inputs = await context.getInputs();
|
||||||
|
const toolkit = new Toolkit();
|
||||||
|
const gitAuthToken = process.env.BUILDX_BAKE_GIT_AUTH_TOKEN ?? inputs.githubToken;
|
||||||
|
|
||||||
// standalone if docker cli not available
|
await core.group(`GitHub Actions runtime token ACs`, async () => {
|
||||||
const standalone = !(await docker.isAvailable());
|
try {
|
||||||
|
await GitHub.printActionsRuntimeTokenACs();
|
||||||
|
} catch (e) {
|
||||||
|
core.warning(e.message);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
core.startGroup(`Docker info`);
|
await core.group(`Docker info`, async () => {
|
||||||
if (standalone) {
|
try {
|
||||||
core.info(`Docker info skipped in standalone mode`);
|
await Docker.printVersion();
|
||||||
} else {
|
await Docker.printInfo();
|
||||||
await exec.exec('docker', ['version'], {
|
} catch (e) {
|
||||||
failOnStdErr: false
|
core.info(e.message);
|
||||||
});
|
}
|
||||||
await exec.exec('docker', ['info'], {
|
});
|
||||||
failOnStdErr: false
|
|
||||||
});
|
|
||||||
}
|
|
||||||
core.endGroup();
|
|
||||||
|
|
||||||
if (!(await buildx.isAvailable(standalone))) {
|
await core.group(`Proxy configuration`, async () => {
|
||||||
|
let dockerConfig: ConfigFile | undefined;
|
||||||
|
let dockerConfigMalformed = false;
|
||||||
|
try {
|
||||||
|
dockerConfig = await Docker.configFile();
|
||||||
|
} catch (e) {
|
||||||
|
dockerConfigMalformed = true;
|
||||||
|
core.warning(`Unable to parse config file ${path.join(Docker.configDir, 'config.json')}: ${e}`);
|
||||||
|
}
|
||||||
|
if (dockerConfig && dockerConfig.proxies) {
|
||||||
|
for (const host in dockerConfig.proxies) {
|
||||||
|
let prefix = '';
|
||||||
|
if (Object.keys(dockerConfig.proxies).length > 1) {
|
||||||
|
prefix = ' ';
|
||||||
|
core.info(host);
|
||||||
|
}
|
||||||
|
for (const key in dockerConfig.proxies[host]) {
|
||||||
|
core.info(`${prefix}${key}: ${dockerConfig.proxies[host][key]}`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else if (!dockerConfigMalformed) {
|
||||||
|
core.info('No proxy configuration found');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
if (!(await toolkit.buildx.isAvailable())) {
|
||||||
core.setFailed(`Docker buildx is required. See https://github.com/docker/setup-buildx-action to set up buildx.`);
|
core.setFailed(`Docker buildx is required. See https://github.com/docker/setup-buildx-action to set up buildx.`);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
stateHelper.setTmpDir(context.tmpDir());
|
|
||||||
|
|
||||||
const buildxVersion = await buildx.getVersion(standalone);
|
stateHelper.setTmpDir(Context.tmpDir());
|
||||||
|
|
||||||
await core.group(`Buildx version`, async () => {
|
await core.group(`Buildx version`, async () => {
|
||||||
const versionCmd = buildx.getCommand(['version'], standalone);
|
await toolkit.buildx.printVersion();
|
||||||
await exec.exec(versionCmd.command, versionCmd.args, {
|
|
||||||
failOnStdErr: false
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
|
||||||
const args: string[] = await context.getArgs(inputs, buildxVersion);
|
let definition: BakeDefinition | undefined;
|
||||||
const buildCmd = buildx.getCommand(args, standalone);
|
await core.group(`Parsing raw definition`, async () => {
|
||||||
|
definition = await toolkit.bake.getDefinition(
|
||||||
core.startGroup(`Bake definition`);
|
{
|
||||||
await exec.exec(buildCmd.command, [...buildCmd.args, '--print'], {
|
files: inputs.files,
|
||||||
cwd: inputs.workdir
|
load: inputs.load,
|
||||||
});
|
noCache: inputs.noCache,
|
||||||
core.endGroup();
|
overrides: inputs.set,
|
||||||
|
provenance: inputs.provenance,
|
||||||
await exec
|
push: inputs.push,
|
||||||
.getExecOutput(buildCmd.command, buildCmd.args, {
|
sbom: inputs.sbom,
|
||||||
cwd: inputs.workdir,
|
source: inputs.source,
|
||||||
ignoreReturnCode: true
|
targets: inputs.targets,
|
||||||
})
|
githubToken: gitAuthToken
|
||||||
.then(res => {
|
},
|
||||||
if (res.stderr.length > 0 && res.exitCode != 0) {
|
{
|
||||||
throw new Error(`buildx bake failed with: ${res.stderr.match(/(.*)\s*$/)?.[0]?.trim() ?? 'unknown error'}`);
|
cwd: inputs.workdir
|
||||||
}
|
}
|
||||||
});
|
);
|
||||||
|
});
|
||||||
|
if (!definition) {
|
||||||
|
throw new Error('Bake definition not set');
|
||||||
|
}
|
||||||
|
|
||||||
const metadata = await buildx.getMetadata();
|
const args: string[] = await context.getArgs(inputs, definition, toolkit);
|
||||||
|
const buildCmd = await toolkit.buildx.getCommand(args);
|
||||||
|
const buildEnv = Object.assign({}, process.env, {
|
||||||
|
BUILDX_BAKE_GIT_AUTH_TOKEN: gitAuthToken
|
||||||
|
}) as {
|
||||||
|
[key: string]: string;
|
||||||
|
};
|
||||||
|
|
||||||
|
await core.group(`Bake definition`, async () => {
|
||||||
|
await Exec.exec(buildCmd.command, [...buildCmd.args, '--print'], {
|
||||||
|
cwd: inputs.workdir,
|
||||||
|
env: buildEnv
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
await Exec.getExecOutput(buildCmd.command, buildCmd.args, {
|
||||||
|
cwd: inputs.workdir,
|
||||||
|
env: buildEnv,
|
||||||
|
ignoreReturnCode: true
|
||||||
|
}).then(res => {
|
||||||
|
if (res.stderr.length > 0 && res.exitCode != 0) {
|
||||||
|
throw new Error(`buildx bake failed with: ${res.stderr.match(/(.*)\s*$/)?.[0]?.trim() ?? 'unknown error'}`);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
const metadata = await BuildxInputs.resolveBuildMetadata();
|
||||||
if (metadata) {
|
if (metadata) {
|
||||||
await core.group(`Metadata output`, async () => {
|
await core.group(`Metadata`, async () => {
|
||||||
core.info(metadata);
|
core.info(metadata);
|
||||||
core.setOutput('metadata', metadata);
|
core.setOutput('metadata', metadata);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
} catch (error) {
|
},
|
||||||
core.setFailed(error.message);
|
// post
|
||||||
|
async () => {
|
||||||
|
if (stateHelper.tmpDir.length > 0) {
|
||||||
|
await core.group(`Removing temp folder ${stateHelper.tmpDir}`, async () => {
|
||||||
|
fs.rmSync(stateHelper.tmpDir, {recursive: true});
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
);
|
||||||
|
|
||||||
async function cleanup(): Promise<void> {
|
|
||||||
if (stateHelper.tmpDir.length > 0) {
|
|
||||||
core.startGroup(`Removing temp folder ${stateHelper.tmpDir}`);
|
|
||||||
fs.rmdirSync(stateHelper.tmpDir, {recursive: true});
|
|
||||||
core.endGroup();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!stateHelper.IsPost) {
|
|
||||||
run();
|
|
||||||
} else {
|
|
||||||
cleanup();
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -1,12 +1,7 @@
|
|||||||
import * as core from '@actions/core';
|
import * as core from '@actions/core';
|
||||||
|
|
||||||
export const IsPost = !!process.env['STATE_isPost'];
|
|
||||||
export const tmpDir = process.env['STATE_tmpDir'] || '';
|
export const tmpDir = process.env['STATE_tmpDir'] || '';
|
||||||
|
|
||||||
export function setTmpDir(tmpDir: string) {
|
export function setTmpDir(tmpDir: string) {
|
||||||
core.saveState('tmpDir', tmpDir);
|
core.saveState('tmpDir', tmpDir);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!IsPost) {
|
|
||||||
core.saveState('isPost', 'true');
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -0,0 +1,61 @@
|
|||||||
|
# https://docs.github.com/en/actions/creating-actions/metadata-syntax-for-github-actions
|
||||||
|
name: 'List Bake targets'
|
||||||
|
description: 'Generate a list of Bake targets to help distributing builds in your workflow'
|
||||||
|
|
||||||
|
inputs:
|
||||||
|
workdir:
|
||||||
|
description: Working directory
|
||||||
|
default: '.'
|
||||||
|
required: false
|
||||||
|
files:
|
||||||
|
description: Comma separated list of Bake files
|
||||||
|
required: false
|
||||||
|
target:
|
||||||
|
description: Bake target
|
||||||
|
required: false
|
||||||
|
|
||||||
|
outputs:
|
||||||
|
targets:
|
||||||
|
description: List of targets
|
||||||
|
value: ${{ steps.generate.outputs.targets }}
|
||||||
|
|
||||||
|
runs:
|
||||||
|
using: composite
|
||||||
|
steps:
|
||||||
|
-
|
||||||
|
name: Generate
|
||||||
|
id: generate
|
||||||
|
uses: actions/github-script@v7
|
||||||
|
with:
|
||||||
|
script: |
|
||||||
|
let def;
|
||||||
|
const files = `${{ inputs.files }}` ? `${{ inputs.files }}`.split(',') : [];
|
||||||
|
const target = `${{ inputs.target }}`;
|
||||||
|
|
||||||
|
await core.group(`Validating definition`, async () => {
|
||||||
|
let args = ['buildx', 'bake'];
|
||||||
|
for (const file of files) {
|
||||||
|
args.push('--file', file);
|
||||||
|
}
|
||||||
|
if (target) {
|
||||||
|
args.push(target);
|
||||||
|
}
|
||||||
|
args.push('--print');
|
||||||
|
|
||||||
|
const res = await exec.getExecOutput('docker', args, {
|
||||||
|
ignoreReturnCode: true,
|
||||||
|
silent: true,
|
||||||
|
cwd: `${{ inputs.workdir }}`
|
||||||
|
});
|
||||||
|
if (res.stderr.length > 0 && res.exitCode != 0) {
|
||||||
|
throw new Error(res.stderr);
|
||||||
|
}
|
||||||
|
def = JSON.parse(res.stdout.trim());
|
||||||
|
core.info(JSON.stringify(def, null, 2));
|
||||||
|
});
|
||||||
|
|
||||||
|
await core.group(`Set output`, async () => {
|
||||||
|
const targets = Object.keys(def.target);
|
||||||
|
core.info(`targets: ${JSON.stringify(targets)}`);
|
||||||
|
core.setOutput('targets', JSON.stringify(targets));
|
||||||
|
});
|
||||||
@@ -37,3 +37,8 @@ target "app-plus" {
|
|||||||
IAMPLUS = "true"
|
IAMPLUS = "true"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
target "app-proxy" {
|
||||||
|
inherits = ["app"]
|
||||||
|
dockerfile = "proxy.Dockerfile"
|
||||||
|
}
|
||||||
|
|||||||
@@ -0,0 +1,19 @@
|
|||||||
|
# syntax=docker/dockerfile:1
|
||||||
|
|
||||||
|
FROM golang:alpine AS base
|
||||||
|
ENV CGO_ENABLED=0
|
||||||
|
RUN apk add --no-cache file git
|
||||||
|
WORKDIR /src
|
||||||
|
|
||||||
|
FROM base AS build
|
||||||
|
RUN --mount=type=bind,target=/src \
|
||||||
|
--mount=type=cache,target=/root/.cache/go-build \
|
||||||
|
go build -ldflags "-s -w" -o /usr/bin/app .
|
||||||
|
|
||||||
|
FROM scratch AS binary
|
||||||
|
COPY --from=build /usr/bin/app /bin/app
|
||||||
|
|
||||||
|
FROM alpine AS image
|
||||||
|
COPY --from=build /usr/bin/app /bin/app
|
||||||
|
EXPOSE 8080
|
||||||
|
ENTRYPOINT ["/bin/app"]
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
variable "DESTDIR" {
|
||||||
|
default = "/tmp/bake-build"
|
||||||
|
}
|
||||||
|
|
||||||
|
group "default" {
|
||||||
|
targets = ["binary"]
|
||||||
|
}
|
||||||
|
|
||||||
|
target "binary" {
|
||||||
|
target = "binary"
|
||||||
|
output = [DESTDIR]
|
||||||
|
}
|
||||||
|
|
||||||
|
target "image" {
|
||||||
|
target = "image"
|
||||||
|
tags = ["localhost:5000/name/app:latest"]
|
||||||
|
}
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
module github.com/docker/bake-action/test/go
|
||||||
|
|
||||||
|
go 1.18
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
"log"
|
||||||
|
"net/http"
|
||||||
|
)
|
||||||
|
|
||||||
|
func main() {
|
||||||
|
http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
|
||||||
|
fmt.Fprintf(w, "Hello, Go!")
|
||||||
|
})
|
||||||
|
log.Fatal(http.ListenAndServe(":8080", nil))
|
||||||
|
}
|
||||||
@@ -0,0 +1,31 @@
|
|||||||
|
group "validate" {
|
||||||
|
targets = ["lint", "validate-vendor", "validate-doctoc"]
|
||||||
|
}
|
||||||
|
|
||||||
|
target "lint" {
|
||||||
|
name = "lint-${buildtags.name}"
|
||||||
|
dockerfile = "./hack/dockerfiles/lint.Dockerfile"
|
||||||
|
target = buildtags.target
|
||||||
|
output = ["type=cacheonly"]
|
||||||
|
matrix = {
|
||||||
|
buildtags = [
|
||||||
|
{ name = "default", tags = "", target = "golangci-lint" },
|
||||||
|
{ name = "labs", tags = "dfrunsecurity dfparents", target = "golangci-lint" },
|
||||||
|
{ name = "nydus", tags = "nydus", target = "golangci-lint" },
|
||||||
|
{ name = "yaml", tags = "", target = "yamllint" },
|
||||||
|
{ name = "proto", tags = "", target = "protolint" },
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
target "validate-vendor" {
|
||||||
|
dockerfile = "./hack/dockerfiles/vendor.Dockerfile"
|
||||||
|
target = "validate"
|
||||||
|
output = ["type=cacheonly"]
|
||||||
|
}
|
||||||
|
|
||||||
|
target "validate-doctoc" {
|
||||||
|
dockerfile = "./hack/dockerfiles/doctoc.Dockerfile"
|
||||||
|
target = "validate-toc"
|
||||||
|
output = ["type=cacheonly"]
|
||||||
|
}
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
# syntax=docker/dockerfile:1
|
||||||
|
|
||||||
|
FROM busybox AS t1
|
||||||
|
RUN echo "Hello t1"
|
||||||
|
|
||||||
|
FROM busybox AS t2
|
||||||
|
RUN echo "Hello t2"
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
group "default" {
|
||||||
|
targets = ["t1", "t2"]
|
||||||
|
}
|
||||||
|
|
||||||
|
target "t1" {
|
||||||
|
target = "t1"
|
||||||
|
}
|
||||||
|
|
||||||
|
target "t2" {
|
||||||
|
target = "t2"
|
||||||
|
}
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
# syntax=docker/dockerfile:1
|
||||||
|
FROM alpine
|
||||||
|
RUN apk add --no-cache curl net-tools
|
||||||
|
ARG HTTP_PROXY
|
||||||
|
ARG HTTPS_PROXY
|
||||||
|
RUN printenv HTTP_PROXY
|
||||||
|
RUN printenv HTTPS_PROXY
|
||||||
|
RUN netstat -aptn
|
||||||
|
RUN curl --retry 5 --retry-all-errors --retry-delay 0 --connect-timeout 5 --proxy $HTTP_PROXY -v --insecure --head https://www.google.com
|
||||||
+6
-3
@@ -1,19 +1,22 @@
|
|||||||
{
|
{
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
|
"esModuleInterop": true,
|
||||||
"target": "es6",
|
"target": "es6",
|
||||||
"module": "commonjs",
|
"module": "commonjs",
|
||||||
|
"strict": true,
|
||||||
"newLine": "lf",
|
"newLine": "lf",
|
||||||
"outDir": "./lib",
|
"outDir": "./lib",
|
||||||
"rootDir": "./src",
|
"rootDir": "./src",
|
||||||
"esModuleInterop": true,
|
|
||||||
"forceConsistentCasingInFileNames": true,
|
"forceConsistentCasingInFileNames": true,
|
||||||
"strict": true,
|
|
||||||
"noImplicitAny": false,
|
"noImplicitAny": false,
|
||||||
|
"resolveJsonModule": true,
|
||||||
"useUnknownInCatchVariables": false,
|
"useUnknownInCatchVariables": false,
|
||||||
},
|
},
|
||||||
"exclude": [
|
"exclude": [
|
||||||
|
"./__mocks__/**/*",
|
||||||
|
"./__tests__/**/*",
|
||||||
|
"./lib/**/*",
|
||||||
"node_modules",
|
"node_modules",
|
||||||
"**/*.test.ts",
|
|
||||||
"jest.config.ts"
|
"jest.config.ts"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user