Skip to content

Commit fe11468

Browse files
committed
Plumb dev-stream and dev-channel through all steps
The matrix step was the only place passing --dev-stream and --value to bakery. Every subsequent step (build, test, merge, readme) re-invokes BakeryConfig which calls load_dev_versions() independently. Without the same overrides, URL resolution can produce a different version, causing the --image-version filter to find no match. Add --dev-stream and --value to the bakery run dgoss, bakery ci merge, and bakery ci readme CLI commands. Pass DEV_STREAM and DEV_CHANNEL env vars through to all workflow steps in both bakery-build-native.yml and bakery-build.yml.
1 parent 3c1b33a commit fe11468

4 files changed

Lines changed: 107 additions & 60 deletions

File tree

.github/workflows/bakery-build-native.yml

Lines changed: 29 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -229,44 +229,43 @@ jobs:
229229
IMAGE_PLATFORM: ${{ matrix.img.platform }}
230230
DEV_VERSIONS: ${{ inputs.dev-versions }}
231231
MATRIX_VERSIONS: ${{ inputs.matrix-versions }}
232+
DEV_STREAM: ${{ inputs.dev-stream }}
233+
DEV_CHANNEL: ${{ inputs.dev-channel }}
232234
REGISTRY: ghcr.io/${{ github.repository_owner }}
233235
NORMALIZED_PLATFORM: ${{ steps.normalize-platform.outputs.platform }}
234236
CONTEXT: ${{ inputs.context }}
235237
# Cache-to is conditional on --push (handled by bakery internally)
236238
run: |
237-
bakery build \
238-
--strategy build --pull \
239-
--retry "$RETRY" \
240-
--image-name "^${IMAGE_NAME}$" \
241-
--image-version "$IMAGE_VERSION" \
242-
--image-platform "$IMAGE_PLATFORM" \
243-
--dev-versions "$DEV_VERSIONS" \
244-
--matrix-versions "$MATRIX_VERSIONS" \
245-
--cache-registry "$REGISTRY" \
246-
--temp-registry "$REGISTRY" \
247-
--metadata-file "./${IMAGE_NAME}-${IMAGE_VERSION}-${NORMALIZED_PLATFORM}-metadata.json" \
248-
--context "$CONTEXT" \
249-
--push
239+
ARGS=(--strategy build --pull --retry "$RETRY")
240+
ARGS+=(--image-name "^${IMAGE_NAME}$" --image-version "$IMAGE_VERSION" --image-platform "$IMAGE_PLATFORM")
241+
ARGS+=(--dev-versions "$DEV_VERSIONS" --matrix-versions "$MATRIX_VERSIONS")
242+
ARGS+=(--cache-registry "$REGISTRY" --temp-registry "$REGISTRY")
243+
ARGS+=(--metadata-file "./${IMAGE_NAME}-${IMAGE_VERSION}-${NORMALIZED_PLATFORM}-metadata.json")
244+
ARGS+=(--context "$CONTEXT" --push)
245+
[[ -n "$DEV_STREAM" ]] && ARGS+=(--dev-stream "$DEV_STREAM")
246+
[[ -n "$DEV_CHANNEL" ]] && ARGS+=(--value "channel=$DEV_CHANNEL")
247+
bakery build "${ARGS[@]}"
250248
- name: Test
251249
env:
252250
IMAGE_NAME: ${{ matrix.img.image }}
253251
IMAGE_VERSION: ${{ matrix.img.version }}
254252
IMAGE_PLATFORM: ${{ matrix.img.platform }}
255253
DEV_VERSIONS: ${{ inputs.dev-versions }}
256254
MATRIX_VERSIONS: ${{ inputs.matrix-versions }}
255+
DEV_STREAM: ${{ inputs.dev-stream }}
256+
DEV_CHANNEL: ${{ inputs.dev-channel }}
257257
NORMALIZED_PLATFORM: ${{ steps.normalize-platform.outputs.platform }}
258258
CONTEXT: ${{ inputs.context }}
259259
run: |
260+
ARGS=(--image-name "^${IMAGE_NAME}$" --image-version "$IMAGE_VERSION" --image-platform "$IMAGE_PLATFORM")
261+
ARGS+=(--dev-versions "$DEV_VERSIONS" --matrix-versions "$MATRIX_VERSIONS")
262+
ARGS+=(--metadata-file "./${IMAGE_NAME}-${IMAGE_VERSION}-${NORMALIZED_PLATFORM}-metadata.json")
263+
ARGS+=(--context "$CONTEXT")
264+
[[ -n "$DEV_STREAM" ]] && ARGS+=(--dev-stream "$DEV_STREAM")
265+
[[ -n "$DEV_CHANNEL" ]] && ARGS+=(--value "channel=$DEV_CHANNEL")
260266
GOSS_PATH=${GITHUB_WORKSPACE}/tools/goss \
261267
DGOSS_PATH=${GITHUB_WORKSPACE}/tools/dgoss \
262-
bakery run dgoss \
263-
--image-name "^${IMAGE_NAME}$" \
264-
--image-version "$IMAGE_VERSION" \
265-
--image-platform "$IMAGE_PLATFORM" \
266-
--dev-versions "$DEV_VERSIONS" \
267-
--matrix-versions "$MATRIX_VERSIONS" \
268-
--metadata-file "./${IMAGE_NAME}-${IMAGE_VERSION}-${NORMALIZED_PLATFORM}-metadata.json" \
269-
--context "$CONTEXT"
268+
bakery run dgoss "${ARGS[@]}"
270269
- name: Upload Metadata
271270
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
272271
with:
@@ -366,13 +365,12 @@ jobs:
366365
CONTEXT: ${{ inputs.context }}
367366
REGISTRY: ghcr.io/${{ github.repository_owner }}
368367
PUSH: ${{ inputs.push }}
368+
DEV_CHANNEL: ${{ inputs.dev-channel }}
369369
run: |
370-
if [ "$PUSH" = "true" ]; then PUSH_FLAG=""; else PUSH_FLAG="--dry-run"; fi
371-
bakery ci merge \
372-
--context "$CONTEXT" \
373-
--temp-registry "$REGISTRY" \
374-
$PUSH_FLAG \
375-
*-metadata.json
370+
ARGS=(--context "$CONTEXT" --temp-registry "$REGISTRY")
371+
[[ -n "$DEV_CHANNEL" ]] && ARGS+=(--value "channel=$DEV_CHANNEL")
372+
if [ "$PUSH" != "true" ]; then ARGS+=(--dry-run); fi
373+
bakery ci merge "${ARGS[@]}" *-metadata.json
376374
377375
readme:
378376
name: Push READMEs
@@ -399,8 +397,8 @@ jobs:
399397
CONTEXT: ${{ inputs.context }}
400398
DEV_VERSIONS: ${{ inputs.dev-versions }}
401399
MATRIX_VERSIONS: ${{ inputs.matrix-versions }}
400+
DEV_CHANNEL: ${{ inputs.dev-channel }}
402401
run: |
403-
bakery ci readme \
404-
--context "$CONTEXT" \
405-
--dev-versions "$DEV_VERSIONS" \
406-
--matrix-versions "$MATRIX_VERSIONS"
402+
ARGS=(--context "$CONTEXT" --dev-versions "$DEV_VERSIONS" --matrix-versions "$MATRIX_VERSIONS")
403+
[[ -n "$DEV_CHANNEL" ]] && ARGS+=(--value "channel=$DEV_CHANNEL")
404+
bakery ci readme "${ARGS[@]}"

.github/workflows/bakery-build.yml

Lines changed: 30 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -189,34 +189,37 @@ jobs:
189189
IMAGE_VERSION: ${{ matrix.img.version }}
190190
DEV_VERSIONS: ${{ inputs.dev-versions }}
191191
MATRIX_VERSIONS: ${{ inputs.matrix-versions }}
192+
DEV_STREAM: ${{ inputs.dev-stream }}
193+
DEV_CHANNEL: ${{ inputs.dev-channel }}
192194
REGISTRY: ghcr.io/${{ github.repository_owner }}
193195
CONTEXT: ${{ inputs.context }}
194196
run: |
195-
bakery build --load --pull \
196-
--retry "$RETRY" \
197-
--image-name "^${IMAGE_NAME}$" \
198-
--image-version "$IMAGE_VERSION" \
199-
--dev-versions "$DEV_VERSIONS" \
200-
--matrix-versions "$MATRIX_VERSIONS" \
201-
--cache-registry "$REGISTRY" \
202-
--context "$CONTEXT"
197+
ARGS=(--load --pull --retry "$RETRY")
198+
ARGS+=(--image-name "^${IMAGE_NAME}$" --image-version "$IMAGE_VERSION")
199+
ARGS+=(--dev-versions "$DEV_VERSIONS" --matrix-versions "$MATRIX_VERSIONS")
200+
ARGS+=(--cache-registry "$REGISTRY" --context "$CONTEXT")
201+
[[ -n "$DEV_STREAM" ]] && ARGS+=(--dev-stream "$DEV_STREAM")
202+
[[ -n "$DEV_CHANNEL" ]] && ARGS+=(--value "channel=$DEV_CHANNEL")
203+
bakery build "${ARGS[@]}"
203204
204205
- name: Test
205206
env:
206207
IMAGE_NAME: ${{ matrix.img.image }}
207208
IMAGE_VERSION: ${{ matrix.img.version }}
208209
DEV_VERSIONS: ${{ inputs.dev-versions }}
209210
MATRIX_VERSIONS: ${{ inputs.matrix-versions }}
211+
DEV_STREAM: ${{ inputs.dev-stream }}
212+
DEV_CHANNEL: ${{ inputs.dev-channel }}
210213
CONTEXT: ${{ inputs.context }}
211214
run: |
215+
ARGS=(--image-name "^${IMAGE_NAME}$" --image-version "$IMAGE_VERSION")
216+
ARGS+=(--dev-versions "$DEV_VERSIONS" --matrix-versions "$MATRIX_VERSIONS")
217+
ARGS+=(--context "$CONTEXT")
218+
[[ -n "$DEV_STREAM" ]] && ARGS+=(--dev-stream "$DEV_STREAM")
219+
[[ -n "$DEV_CHANNEL" ]] && ARGS+=(--value "channel=$DEV_CHANNEL")
212220
GOSS_PATH=${GITHUB_WORKSPACE}/tools/goss \
213221
DGOSS_PATH=${GITHUB_WORKSPACE}/tools/dgoss \
214-
bakery run dgoss \
215-
--image-name "^${IMAGE_NAME}$" \
216-
--image-version "$IMAGE_VERSION" \
217-
--dev-versions "$DEV_VERSIONS" \
218-
--matrix-versions "$MATRIX_VERSIONS" \
219-
--context "$CONTEXT"
222+
bakery run dgoss "${ARGS[@]}"
220223
221224
- name: Push
222225
# Since this is a reusable workflow, we need to be very explicit about
@@ -230,15 +233,17 @@ jobs:
230233
IMAGE_VERSION: ${{ matrix.img.version }}
231234
DEV_VERSIONS: ${{ inputs.dev-versions }}
232235
MATRIX_VERSIONS: ${{ inputs.matrix-versions }}
236+
DEV_STREAM: ${{ inputs.dev-stream }}
237+
DEV_CHANNEL: ${{ inputs.dev-channel }}
233238
CONTEXT: ${{ inputs.context }}
234239
run: |
235-
bakery build --push --pull \
236-
--retry "$RETRY" \
237-
--image-name "^${IMAGE_NAME}$" \
238-
--image-version "$IMAGE_VERSION" \
239-
--dev-versions "$DEV_VERSIONS" \
240-
--matrix-versions "$MATRIX_VERSIONS" \
241-
--context "$CONTEXT"
240+
ARGS=(--push --pull --retry "$RETRY")
241+
ARGS+=(--image-name "^${IMAGE_NAME}$" --image-version "$IMAGE_VERSION")
242+
ARGS+=(--dev-versions "$DEV_VERSIONS" --matrix-versions "$MATRIX_VERSIONS")
243+
ARGS+=(--context "$CONTEXT")
244+
[[ -n "$DEV_STREAM" ]] && ARGS+=(--dev-stream "$DEV_STREAM")
245+
[[ -n "$DEV_CHANNEL" ]] && ARGS+=(--value "channel=$DEV_CHANNEL")
246+
bakery build "${ARGS[@]}"
242247
243248
readme:
244249
name: Push READMEs
@@ -265,8 +270,8 @@ jobs:
265270
CONTEXT: ${{ inputs.context }}
266271
DEV_VERSIONS: ${{ inputs.dev-versions }}
267272
MATRIX_VERSIONS: ${{ inputs.matrix-versions }}
273+
DEV_CHANNEL: ${{ inputs.dev-channel }}
268274
run: |
269-
bakery ci readme \
270-
--context "$CONTEXT" \
271-
--dev-versions "$DEV_VERSIONS" \
272-
--matrix-versions "$MATRIX_VERSIONS"
275+
ARGS=(--context "$CONTEXT" --dev-versions "$DEV_VERSIONS" --matrix-versions "$MATRIX_VERSIONS")
276+
[[ -n "$DEV_CHANNEL" ]] && ARGS+=(--value "channel=$DEV_CHANNEL")
277+
bakery ci readme "${ARGS[@]}"

posit-bakery/posit_bakery/cli/ci.py

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,12 @@ def merge(
161161
rich_help_panel="Build Configuration & Outputs",
162162
),
163163
] = None,
164+
value: Annotated[
165+
Optional[list[str]],
166+
typer.Option(
167+
help="Override a devVersion value (key=value). Can be specified multiple times.",
168+
),
169+
] = None,
164170
dry_run: Annotated[
165171
bool, typer.Option(help="If set, the merged images will not be pushed to the registry.")
166172
] = False,
@@ -181,7 +187,13 @@ def merge(
181187
}
182188
```
183189
"""
190+
value_map, errors = _make_value_map(value)
191+
if errors:
192+
for e in errors:
193+
log.error(e)
194+
raise typer.Exit(code=1)
184195
settings = BakerySettings(
196+
filter=BakeryConfigFilter(values=value_map) if value_map else None,
185197
dev_versions=DevVersionInclusionEnum.INCLUDE,
186198
matrix_versions=MatrixVersionInclusionEnum.INCLUDE,
187199
clean_temporary=False,
@@ -264,6 +276,12 @@ def readme(
264276
rich_help_panel=RichHelpPanelEnum.FILTERS,
265277
),
266278
] = MatrixVersionInclusionEnum.INCLUDE,
279+
value: Annotated[
280+
Optional[list[str]],
281+
typer.Option(
282+
help="Override a devVersion value (key=value). Can be specified multiple times.",
283+
),
284+
] = None,
267285
) -> None:
268286
"""Push image READMEs to Docker Hub.
269287
@@ -275,7 +293,13 @@ def readme(
275293
variables to be set with a Personal Access Token (PAT). Organization Access Tokens
276294
cannot update repository descriptions.
277295
"""
296+
value_map, errors = _make_value_map(value)
297+
if errors:
298+
for e in errors:
299+
log.error(e)
300+
raise typer.Exit(code=1)
278301
settings = BakerySettings(
302+
filter=BakeryConfigFilter(values=value_map) if value_map else None,
279303
dev_versions=dev_versions,
280304
matrix_versions=matrix_versions,
281305
)

posit-bakery/posit_bakery/cli/run.py

Lines changed: 24 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
import typer
99

10-
from posit_bakery.cli.common import with_verbosity_flags
10+
from posit_bakery.cli.common import _make_value_map, with_verbosity_flags
1111
from posit_bakery.config import BakeryConfig
1212
from posit_bakery.config.config import BakeryConfigFilter, BakerySettings
1313
from posit_bakery.const import DevVersionInclusionEnum, MatrixVersionInclusionEnum
@@ -97,6 +97,20 @@ def dgoss(
9797
rich_help_panel=RichHelpPanelEnum.FILTERS,
9898
),
9999
] = MatrixVersionInclusionEnum.EXCLUDE,
100+
dev_stream: Annotated[
101+
Optional[str],
102+
typer.Option(
103+
help="Filter development versions to a specific release stream (e.g. 'daily', 'preview').",
104+
rich_help_panel=RichHelpPanelEnum.FILTERS,
105+
),
106+
] = None,
107+
value: Annotated[
108+
Optional[list[str]],
109+
typer.Option(
110+
help="Override a devVersion value (key=value). Can be specified multiple times.",
111+
rich_help_panel=RichHelpPanelEnum.FILTERS,
112+
),
113+
] = None,
100114
metadata_file: Annotated[
101115
Optional[Path],
102116
typer.Option(
@@ -130,9 +144,13 @@ def dgoss(
130144
DeprecationWarning,
131145
stacklevel=2,
132146
)
133-
stderr_console.print(
134-
"[yellow]Warning: 'bakery run dgoss' is deprecated. Use 'bakery dgoss run' instead.[/yellow]"
135-
)
147+
stderr_console.print("[yellow]Warning: 'bakery run dgoss' is deprecated. Use 'bakery dgoss run' instead.[/yellow]")
148+
149+
value_map, errors = _make_value_map(value)
150+
if errors:
151+
for e in errors:
152+
log.error(e)
153+
raise typer.Exit(code=1)
136154

137155
# Autoselect host architecture platform if not specified.
138156
image_platform = image_platform or SETTINGS.architecture
@@ -145,6 +163,8 @@ def dgoss(
145163
image_variant=image_variant,
146164
image_os=image_os,
147165
image_platform=[image_platform],
166+
dev_stream=dev_stream,
167+
values=value_map,
148168
),
149169
dev_versions=dev_versions,
150170
matrix_versions=matrix_versions,

0 commit comments

Comments
 (0)