Skip to content

0.23.0 container_bundle crashes when called with empty images list #2010

@hanikesn

Description

@hanikesn

🐞 bug report

Affected Rule

The issue is caused by the rule: `incremental_load`

Is this a regression?

Yes, the previous version in which this bug was not present was: ....

Introduced via #1957, confirmed working 0.22

Description

Using `container_bundle` with an empty `images = {}` causes an error

🔬 Minimal Reproduction

load("@io_bazel_rules_docker//container:container.bzl", "container_bundle")

container_bundle(
    name = "bundle_to_push",
    images = {}
    tags = ["no-remote-cache"],
)

🔥 Exception or Error


Traceback (most recent call last):
        File "/home/hanikel/.cache/bazel/186c259db594aa2669550cf1f9e672c6/external/io_bazel_rules_docker/container/bundle.bzl", line 67, column 15, in _container_bundle_impl
                _incr_load(
        File "/home/hanikel/.cache/bazel/186c259db594aa2669550cf1f9e672c6/external/io_bazel_rules_docker/container/layer_tools.bzl", line 232, column 28, in incremental_load
                run_tag = images.keys()[0]
Error: index out of range (index is 0, but sequence has 0 elements)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions