Skip to content
This repository has been archived by the owner on Oct 2, 2023. It is now read-only.

Do not fail in case of empty image label values #2276

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

hisener
Copy link

@hisener hisener commented Sep 28, 2023

If I understand correctly, image label value may be an empty string. However, in that case, I got "index out of range" errors in two places. This PR uses startswith to avoid them.

	File "/private/var/tmp/_bazel_halil.sener/f6fb7d40b6b3160ce57e2d52769a8d36/external/io_bazel_rules_docker/container/image.bzl", line 976, column 76, in container_image
		files = sorted({v[1:]: None for v in kwargs["labels"].values() if v[0] == "@"}.keys())
Error: index out of range (index is 0, but sequence has 0 elements)
	File "/private/var/tmp/_bazel_halil.sener/f6fb7d40b6b3160ce57e2d52769a8d36/external/io_bazel_rules_docker/container/image.bzl", line 199, column 17, in _image_config
		if fname[0] == "@":
Error: index out of range (index is 0, but sequence has 0 elements)

PR Checklist

Please check if your PR fulfills the following requirements:

  • Tests for the changes have been added (for bug fixes / features)
  • Docs have been added / updated (for bug fixes / features)

PR Type

What kind of change does this PR introduce?

  • Bugfix
  • Feature
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • CI related changes
  • Documentation content changes
  • Other... Please describe:

What is the current behavior?

Issue Number: N/A

What is the new behavior?

Does this PR introduce a breaking change?

  • Yes
  • No

Other information

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant