Skip to content

Commit

Permalink
Build bundles with track/risk channels (#1464)
Browse files Browse the repository at this point in the history
  • Loading branch information
addyess authored Dec 13, 2023
1 parent 8ab9a52 commit 650165a
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
7 changes: 6 additions & 1 deletion jobs/build-charms/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,11 @@ def build_bundles(
build_entity = BundleBuildEntity(build_env, bundle_name, bundle_opts)
entities.append(build_entity)

to_channels = [
f"{build_env.track}/{chan.lower()}" if (chan.lower() in RISKS) else chan
for chan in build_env.to_channels
]

for entity in entities:
entity.echo("Starting")
try:
Expand All @@ -198,7 +203,7 @@ def build_bundles(
entity.setup()

entity.echo(f"Details: {entity}")
for channel in build_env.to_channels:
for channel in to_channels:
entity.bundle_build(channel)

# Bundles are built easily, but it's pointless to push the bundle
Expand Down
7 changes: 4 additions & 3 deletions tests/unit/build_charms/test_charms.py
Original file line number Diff line number Diff line change
Expand Up @@ -735,6 +735,7 @@ def test_bundle_build_command(
mock_build_env.bundles_dir = mock_build_env.tmp_dir / "bundles"
mock_build_env.default_repo_dir = mock_build_env.repos_dir / "bundles-kubernetes"
mock_build_env.to_channels = ("edge", "0.15/edge")
mock_build_env.track = "latest"
mock_build_env.filter_by_tag = ["k8s"]
mock_build_env.force = False

Expand Down Expand Up @@ -771,7 +772,7 @@ def test_bundle_build_command(
[
call("Starting"),
call(f"Details: {entity}"),
call("Pushing built bundle for channel=edge (forced=False)."),
call("Pushing built bundle for channel=latest/edge (forced=False)."),
call("Pushing built bundle for channel=0.15/edge (forced=False)."),
call("Stopping"),
],
Expand All @@ -781,11 +782,11 @@ def test_bundle_build_command(
entity.setup.assert_called_once_with()

assert entity.bundle_build.mock_calls == [
call(channel) for channel in mock_build_env.to_channels
call(channel) for channel in ["latest/edge", "0.15/edge"]
]
assert entity.push.mock_calls == [call(artifact), call(artifact)]
assert entity.release.mock_calls == [
call(artifact, to_channels=[channel])
for channel in mock_build_env.to_channels
for channel in ["latest/edge", "0.15/edge"]
]
assert entity.reset_artifacts.mock_calls == [call(), call()]

0 comments on commit 650165a

Please sign in to comment.