Snaps and output on jenkins


#1

Hi, I have recently tried to use a binary provided by snap (helm) on a jenkins job but I can’t find a way to force it to show me the output of that binary.

When I install that binary in other ways, I do get an output, and I’ve tried other binaries installed via snap (kubectl) and have the same issue.

I digged a bit into the source, and I think the cause for my issue is https://github.com/snapcore/snapd/blob/0fa40c5bf5f24ed0cbfc3bdb6814be7f78f7661b/cmd/snap/main.go#L345-L353 . Given that Jenkins doesn’t provide a tty, all interactivity (including stdout) is disabled. - Seems to be unrelated to my issue.

Is there any way to force “interactivity” for a specific snap via configuration? Am I wrong in assuming that this is the cause? Any pointers would be appreciated.


#2

that code is for snap’s progress bar, only. It has nothing to do with snapped apps.


#3

Hi, thanks for checking.

It seems to also be used for the /snap/bin symlinks. Following the code:


#4

yes, symlinks are equivalent to snap run, and that instantiates a client.Client, and so it gets passed the Interactive property which does depend on whether stdin is a tty. It isn’t used by run’s Execute. The client’s config’s Interactive property is only used to set X-Allow-Interaction header when talking to snapd, and that is related to policykit.

snap run, when invoked either explicitly or via symlink, will typically not talk to snapd at all; the header is not used at all; even if it does, in no way can that impact the binary that is then exec’ed.


#5

Ahh, clear. So indeed, this code should be unrelated to the issue I’m having. I’ll edit the original post to reflect that.