carvel-dev / carvel-dev/ytt

Using bash Process Substitution silently fails...

Open
#355 5 comments 0 reactions 0 assignees View on GitHub
discussion enhancement
Dominant language
Go
Stars
1.9k
Forks
167
PR merge metrics
No merged PRs in 30d

Description

**Describe the problem/challenge you have**

# TL;DR

`ytt` works fine if I have all my data files as real files in the file system:

```bash
generateSecrets > secrets.yaml
ytt -f values.yaml -f secrets.yaml -f demo.yaml
# Must remember this!
rm secrets.yaml
```

But if I use bash Process Substitution ([short article](https://medium.com/factualopinions/process-substitution-in-bash-739096a2f66d)), then the `-f` parameter is silently ignored.

This should be equivalent to the above (without using a pesky temporary file), but actually behaves as if the `-f <(generateSecrets)` wasn't there:

```bash
ytt -f values.yaml -f <(generateSecrets) -f demo.yaml
```

Please allow me to use Process Substitution. Or at the very least report an error so I don't think it works. But please make it work... The reason is that the secrets could come from a e.g. a vault or some other protected resource, and it would be great to avoid having to store them in temporary files.

# Details

I have these files:

`values.yaml`:
```yaml
#@data/values
---
secret: change-me
```

`secrets.yaml`:
```yaml
#@data/values
---
secret: MySuperSecret
```

`demo.yaml`:
```yaml
#@ load("@ytt:data", "data")

foo: bar
the-secret: #@ data.values.secret
```

This produces the expected output:

```bash
$ ytt -f values.yaml -f secrets.yaml -f demo.yaml
foo: bar
the-secret: MySuperSecret
```

But this does not:
```bash
$ ytt -f values.yaml -f <(cat secrets.yaml) -f demo.yaml ; echo $?
foo: bar
the-secret: change-me
0
```

It silently behaves as if `-f <(cat secrets.yaml)` was not provided at all, but reports no error on `STDOUT`/`STDERR` or in `$?`.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.