ci(bin-image): clean up env var handling
There are still messy special cases (e.g. DOCKER_GITCOMMIT vs VERSION),
but this makes things a little easier to follow, as we keep
GHA-specifics in the GHA files.
Signed-off-by: Bjorn Neergaard <bjorn.neergaard@docker.com>
(cherry picked from commit ad91fc1b00
)
Signed-off-by: Bjorn Neergaard <bjorn.neergaard@docker.com>
This commit is contained in:
parent
aaf84dd4cf
commit
5eef5a7f59
2 changed files with 4 additions and 16 deletions
4
.github/workflows/bin-image.yml
vendored
4
.github/workflows/bin-image.yml
vendored
|
@ -16,6 +16,8 @@ on:
|
|||
|
||||
env:
|
||||
MOBYBIN_REPO_SLUG: moby/moby-bin
|
||||
DOCKER_GITCOMMIT: ${{ github.sha }}
|
||||
VERSION: ${{ github.ref }}
|
||||
PLATFORM: Moby Engine
|
||||
PRODUCT: Moby
|
||||
DEFAULT_PRODUCT_LICENSE: Moby
|
||||
|
@ -113,8 +115,6 @@ jobs:
|
|||
name: Build
|
||||
id: bake
|
||||
uses: docker/bake-action@v3
|
||||
env:
|
||||
DOCKER_GITCOMMIT: ${{ github.sha }}
|
||||
with:
|
||||
files: |
|
||||
./docker-bake.hcl
|
||||
|
|
|
@ -47,18 +47,6 @@ variable "PACKAGER_NAME" {
|
|||
default = ""
|
||||
}
|
||||
|
||||
# GITHUB_REF is the actual ref that triggers the workflow and used as version
|
||||
# when tag is pushed: https://docs.github.com/en/actions/learn-github-actions/environment-variables#default-environment-variables
|
||||
variable "GITHUB_REF" {
|
||||
default = ""
|
||||
}
|
||||
|
||||
# GITHUB_SHA is the commit SHA that triggered the workflow and used as commit.
|
||||
# https://docs.github.com/en/actions/learn-github-actions/environment-variables#default-environment-variables
|
||||
variable "GITHUB_SHA" {
|
||||
default = ""
|
||||
}
|
||||
|
||||
# Special target: https://github.com/docker/metadata-action#bake-definition
|
||||
target "docker-metadata-action" {
|
||||
tags = ["moby-bin:local"]
|
||||
|
@ -81,8 +69,8 @@ target "_common" {
|
|||
DOCKER_STATIC = DOCKER_STATIC
|
||||
DOCKER_LDFLAGS = DOCKER_LDFLAGS
|
||||
DOCKER_BUILDTAGS = DOCKER_BUILDTAGS
|
||||
DOCKER_GITCOMMIT = DOCKER_GITCOMMIT != null ? DOCKER_GITCOMMIT : GITHUB_SHA
|
||||
VERSION = VERSION != "" ? VERSION : GITHUB_REF
|
||||
DOCKER_GITCOMMIT = DOCKER_GITCOMMIT
|
||||
VERSION = VERSION
|
||||
PLATFORM = PLATFORM
|
||||
PRODUCT = PRODUCT
|
||||
DEFAULT_PRODUCT_LICENSE = DEFAULT_PRODUCT_LICENSE
|
||||
|
|
Loading…
Add table
Reference in a new issue