Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix gitlab image dict crash #258

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion scuba/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -517,7 +517,7 @@ def from_dict(
return cls(
name=name,
script=script,
image=node.get("image"),
image=_get_str(node, "image"),
entrypoint=_get_entrypoint(node),
environment=_process_environment(
node.get("environment"), f"{name}.environment"
Expand Down
29 changes: 29 additions & 0 deletions tests/test_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,35 @@ def test_load_config_safe_external(self) -> None:
SCUBA_YML.write_text(f"image: !from_yaml {external_yml} danger")
self.__test_load_config_safe(external_yml)

def test_load_config_image_name(self) -> None:
"""
.gitlab-ci.yml supports a long-form `image` specification
with `name` and other sub-keys:
https://docs.gitlab.com/ee/ci/yaml/#image

Scuba doesn't currently support that, so make sure we handle
this error gracefully.

TODO(#230): Support this complex `image` format.
"""

GITLAB_YML.write_text(
"""
two:
stage: build
image:
name: dummian:8.2
"""
)
invalid_config(
config_text=f"""
aliases:
two:
image: !from_yaml {GITLAB_YML} two.image
script: rip
"""
)


class TestConfigHooks(ConfigTest):
def test_hooks_mixed(self) -> None:
Expand Down
Loading