Skip to content

Commit d07fc37

Browse files
committed
Support for outputs to pass version down
1 parent f909764 commit d07fc37

File tree

3 files changed

+48
-2
lines changed

3 files changed

+48
-2
lines changed

.github/workflows/_build.yml

Lines changed: 43 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,14 +32,45 @@ on:
3232
required: false
3333
type: string
3434
default: 'ghcr.io'
35+
build-args:
36+
description: "List of build-time variables"
37+
required: false
38+
type: string
3539
secrets:
3640
username:
3741
description: 'username at registry'
3842
required: true
3943
password:
4044
description: 'password at registry'
4145
required: true
42-
46+
outputs:
47+
version:
48+
description: 'Generated Docker image version'
49+
value: ${{ jobs.merge.outputs.version }}
50+
tags:
51+
description: 'Generated Docker tags'
52+
value: ${{ jobs.merge.outputs.tags }}
53+
labels:
54+
description: 'Generated Docker labels'
55+
value: ${{ jobs.merge.outputs.labels }}
56+
annotations:
57+
description: 'Generated annotations'
58+
value: ${{ jobs.merge.outputs.annotations }}
59+
json:
60+
description: 'JSON output of tags and labels'
61+
value: ${{ jobs.merge.outputs.json }}
62+
bake-file-tags:
63+
description: 'Bake definition file with tags'
64+
value: ${{ jobs.merge.outputs.bake-file-tags }}
65+
bake-file-labels:
66+
description: 'Bake definition file with labels'
67+
value: ${{ jobs.merge.outputs.bake-file-labels }}
68+
bake-file-annotations:
69+
description: 'Bake definiton file with annotations'
70+
value: ${{ jobs.merge.outputs.bake-file-annotations }}
71+
bake-file:
72+
description: 'Bake definition file with tags and labels'
73+
value: ${{ jobs.merge.outputs.bake-file }}
4374
env:
4475
REGISTRY_IMAGE: ${{inputs.registry }}/${{ inputs.image }}
4576

@@ -113,6 +144,7 @@ jobs:
113144
labels: ${{ steps.meta.outputs.labels }}
114145
outputs: type=image,name=${{ env.REGISTRY_IMAGE }},push-by-digest=true,name-canonical=true,push=true
115146
file: ${{ inputs.file }}
147+
build-args: ${{ inputs.build-args }}
116148
-
117149
name: Export digest
118150
run: |
@@ -133,6 +165,16 @@ jobs:
133165
needs:
134166
- build
135167
- prepare
168+
outputs:
169+
version: ${{ steps.meta.outputs.version }}
170+
tags: ${{ steps.meta.outputs.tags }}
171+
labels: ${{ steps.meta.outputs.labels }}
172+
annotations: ${{ steps.meta.outputs.annotations }}
173+
json: ${{ steps.meta.outputs.json }}
174+
bake-file-tags: ${{ steps.meta.outputs.bake-file-tags }}
175+
bake-file-labels: ${{ steps.meta.outputs.bake-file-labels }}
176+
bake-file-annotations: ${{ steps.meta.outputs.bake-file-annotations }}
177+
bake-file: ${{ steps.meta.outputs.bake-file }}
136178
steps:
137179
-
138180
name: Download digests

.github/workflows/ci.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ jobs:
2323
with:
2424
image: ${{ github.actor }}/runner-krunvm
2525
file: Dockerfile
26+
build-args: |
27+
VERSION=${{ needs.build-base.outputs.version }}
2628
secrets:
2729
username: ${{ github.actor }}
2830
password: ${{ secrets.GITHUB_TOKEN }}

Dockerfile

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
FROM ghcr.io/efrecon/runner-krunvm-base:main
1+
# syntax=docker/dockerfile:1
2+
ARG VERSION=main
3+
FROM ghcr.io/efrecon/runner-krunvm-base:${VERSION}
24

35
ARG INSTALL_VERSION=latest
46
ARG INSTALL_NAMESPACE=/opt/gh-runner-krunvm

0 commit comments

Comments
 (0)