bake: define DESTDIR

Keep the same output dir format in the bake definition
as the one used in make scripts.

Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
(cherry picked from commit 9bcf5bed05)
This commit is contained in:
CrazyMax 2022-12-26 17:45:50 +01:00
parent 171471b613
commit 3b90bb6ad3
No known key found for this signature in database
GPG key ID: 3248E46B6BB8C7F7
3 changed files with 17 additions and 10 deletions

View file

@ -13,7 +13,7 @@ on:
pull_request:
env:
BUNDLES_OUTPUT: ./bundles
DESTDIR: ./build
jobs:
validate-dco:
@ -40,7 +40,7 @@ jobs:
uses: actions/upload-artifact@v3
with:
name: binary
path: ${{ env.BUNDLES_OUTPUT }}
path: ${{ env.DESTDIR }}
if-no-files-found: error
retention-days: 1
@ -106,7 +106,7 @@ jobs:
env:
CONTEXT: "."
TEST_DOCKERD: "1"
TEST_DOCKERD_BINARY: "./build/moby/binary-daemon/dockerd"
TEST_DOCKERD_BINARY: "./build/moby/dockerd"
TESTPKGS: "./${{ matrix.pkg }}"
TESTFLAGS: "-v --parallel=1 --timeout=30m --run=//worker=dockerd$"
working-directory: buildkit

View file

@ -15,7 +15,7 @@ on:
pull_request:
env:
BUNDLES_OUTPUT: ./bundles
DESTDIR: ./build
jobs:
validate-dco:
@ -50,7 +50,7 @@ jobs:
uses: actions/upload-artifact@v3
with:
name: ${{ matrix.target }}
path: ${{ env.BUNDLES_OUTPUT }}
path: ${{ env.DESTDIR }}
if-no-files-found: error
retention-days: 7
@ -110,6 +110,6 @@ jobs:
uses: actions/upload-artifact@v3
with:
name: cross-${{ env.PLATFORM_PAIR }}
path: ${{ env.BUNDLES_OUTPUT }}
path: ${{ env.DESTDIR }}
if-no-files-found: error
retention-days: 7

View file

@ -1,10 +1,16 @@
variable "BUNDLES_OUTPUT" {
default = "./bundles"
}
variable "DOCKER_STATIC" {
default = "1"
}
# Defines the output folder
variable "DESTDIR" {
default = ""
}
function "bindir" {
params = [defaultdir]
result = DESTDIR != "" ? DESTDIR : "./bundles/${defaultdir}"
}
target "_common" {
args = {
BUILDKIT_CONTEXT_KEEP_GIT_DIR = 1
@ -37,11 +43,12 @@ target "_platforms" {
target "binary" {
inherits = ["_common"]
target = "binary"
output = [BUNDLES_OUTPUT]
output = [bindir(DOCKER_STATIC == "1" ? "binary" : "dynbinary")]
}
target "dynbinary" {
inherits = ["binary"]
output = [bindir("dynbinary")]
args = {
DOCKER_STATIC = "0"
}