argoproj-labs / hera

Hera is an Argo Python SDK. Hera aims to make construction and submission of various Argo Project resources easy and accessible to everyone! Hera abstracts away low-level setup details while still maintaining a consistent vocabulary with Argo. ⭐️ Remember to star!
https://hera.rtfd.io
Apache License 2.0
550 stars 105 forks source link

SecretEnv not working in Template #1080

Open roeizavida opened 2 months ago

roeizavida commented 2 months ago

Pre-bug-report checklist

1. This bug can be reproduced using pure Argo YAML

If yes, it is more likely to be an Argo bug unrelated to Hera. Please double check before submitting an issue to Hera.

2. This bug occurs in Hera when...

Bug report

Describe the bug When using SecretEnv in a Template, it is not expanded and the resulting entry in env only contains the name.

To Reproduce Full Hera code to reproduce the bug:

from hera.workflows import (
    Container,
    Env,
    SecretEnv,
    WorkflowTemplate,
)
from hera.workflows.models import Template

whalesay = Container(
    image="docker/whalesay:latest",
    command=["cowsay"],
    env=[
        Env(name="test", value="1"),
        SecretEnv(name="s1", secret_key="s1", secret_name="abc"),
    ],
)
templates = [Template(name="test", container=whalesay)]
wt = WorkflowTemplate(name="test", templates=templates)
print(wt.templates[0].container.env)

Results:

[EnvVar(name='test', value='1', value_from=None), EnvVar(name='s1', value=None, value_from=None)]

Expected behavior SecretEnv should be expanded into EnvVar that it's value_from property is populated.

Environment