hera icon indicating copy to clipboard operation
hera copied to clipboard

How to include credentials for GitArtifact?

Open bvidovic1 opened this issue 1 year ago • 1 comments

Hi,

I love the idea of hera-workflows and how easy is to create workflows.

Can somebody please point me on how to use credentials to authenticate when using GitArtifact as input artifact?

For example, in official argo workflow example there are usernameSecret and passwordSecret: https://github.com/argoproj/argo-workflows/blob/master/examples/input-artifact-git.yaml#L24

I was looking at example you shown for InputArtifact:

with Workflow("artifact", service=WorkflowService(host="https://my-argo-server.com", token="my-auth-token")) as w:
    w_t = Task("writer", writer, output_artifacts=[OutputArtifact("test", "/file")])
    c_t = Task(
        "consumer",
        consumer,
        input_artifacts=[InputArtifact("test", "/file", "writer", "test")],

and based on that created my task with GitArtifact:

input_artifact=[GitArtifact("test", "/src", "url_to_git_repo", "master")]

but I do not know how to add credentials in the line above.

I know I could mount secret as a volume and provide .netrc to perform cloning of repository, but that seems like an overkill if I can provide credentials for GitArtifact.

Thanks.

bvidovic1 avatar Jul 21 '22 09:07 bvidovic1

Thank you for the issue submission @bvidovic1! I am going to take a look at it soon

flaviuvadan avatar Jul 31 '22 21:07 flaviuvadan