# Vendor CLI docker container doesn't parse release notes correctly

**URL:** <https://community.replicated.com/t/vendor-cli-docker-container-doesnt-parse-release-notes-correctly/1142>\
**Category:** How do I?\
**Tags:** vendor\
**Created:** [March 2, 2023, 10:51am UTC](https://community.replicated.com/t/vendor-cli-docker-container-doesnt-parse-release-notes-correctly/1142 "2023-03-02T10:51:04Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Dom](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.replicated.com/dom/32/504_2.png) [@Dom](https://community.replicated.com/u/Dom)\
**Post date:** [March 2, 2023, 10:51am UTC](https://community.replicated.com/t/vendor-cli-docker-container-doesnt-parse-release-notes-correctly/1142/1 "2023-03-02T10:51:05Z")

</div>

Hey,

In our CI/CD we used to download the replicated CLI (via GitHub), but recently we hit tons of rate limiting from GitHub (too many downloads). As a result, we decided to start using vendor’s docker container `replicated/vendor-cli`.

However, we can’t get the release notes working properly, and just wanted to see if you could help us out / have seen this issue before?

For reference, this works perfectly fine:

```auto
mountOptions=" --mount type=bind,source=../infra/kots/staging,target=../infra/kots/staging"
docker run -it --rm \
    $mountOptions \
    replicated/vendor-cli release create --promote test-channel --version 0.0.1 --yaml-dir ../infra/kots/staging --release-notes "CLI release 'kots-release.sh' of 'main' triggered by name.surname" \
    --app "$REPLICATED_APP" \
    --token "$REPLICATED_API_TOKEN"

```

But this doesn’t:

```auto
command="release create --promote test-channel --version 0.0.1 --yaml-dir ../infra/kots/staging --release-notes \"CLI release 'kots-release.sh' of 'main' triggered by name.surname\""
mountOptions=" --mount type=bind,source=../infra/kots/staging,target=../infra/kots/staging"
docker run -it --rm \
    $mountOptions \
    replicated/vendor-cli $command \
    --app "$REPLICATED_APP" \
    --token "$REPLICATED_API_TOKEN"

```

I have tried tons of different ways of parsing a string (e.g. putting it into array, trying to escape with single quote instead of double quote, even putting a release notes into a file and mounting that file), but literally nothing seems to be working. It looks like replicated treats a space as a separate argument, even if it’s quoted.

Any ideas how can we get this working?

Thanks,  
Dom

---

<div class="post-metadata">

**Author:** ![Dom](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.replicated.com/dom/32/504_2.png) [@Dom](https://community.replicated.com/u/Dom)\
**Post date:** [March 2, 2023, 1:15pm UTC](https://community.replicated.com/t/vendor-cli-docker-container-doesnt-parse-release-notes-correctly/1142/2 "2023-03-02T13:15:47Z")

</div>

Ok, the below works. It’s a bit painful, as I assume the same issue would persist with any flag containing a string with spaces, but for now it’s a good workaround enough.

P.S: We are still looking forward for any advices / better ways of doing this.

```bash
command="release create --promote test-channel --version 0.0.1 --yaml-dir ../infra/kots/staging"
release_notes=--release-notes "CLI release 'kots-release.sh' of 'main' triggered by name.surname"
mountOptions=" --mount type=bind,source=../infra/kots/staging,target=../infra/kots/staging"
docker run -it --rm \
    $mountOptions \
    replicated/vendor-cli $command "${release_notes}" \
    --app "$REPLICATED_APP" \
    --token "$REPLICATED_API_TOKEN"

```

---

<div class="post-metadata">

**Author:** ![ianzink](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.replicated.com/ianzink/32/540_2.png) [@ianzink](https://community.replicated.com/u/ianzink)\
**Post date:** [March 2, 2023, 7:15pm UTC](https://community.replicated.com/t/vendor-cli-docker-container-doesnt-parse-release-notes-correctly/1142/3 "2023-03-02T19:15:32Z")

</div>

This has to do with the way the shell is setting the ARGV variables. I made this simple python program that just lists ARGV.

```python
#!/usr/bin/env python3

import sys
print(sys.argv)

```

I ran

```bash
./test-argv.py run -it --rm \
    $mountOptions \
    replicated/vendor-cli $command \
    --app "$REPLICATED_APP" \
    --token "$REPLICATED_API_TOKEN"
['./test-argv.py', 'run', '-it', '--rm', ' --mount type=bind,source=../infra/kots/staging,target=../infra/kots/staging', 'replicated/vendor-cli', 'release create --promote test-channel --version 0.0.1 --yaml-dir ../infra/kots/staging --release-notes "CLI release \'kots-release.sh\' of \'main\' triggered by name.surname"', '--app', '', '--token', '']

```

and

```bash
./test-argv.py run -it --rm \
    $mountOptions \
    replicated/vendor-cli release create --promote test-channel --version 0.0.1 --yaml-dir ../infra/kots/staging --release-notes "CLI release 'kots-release.sh' of 'main' triggered by name.surname" \
    --app "$REPLICATED_APP" \
    --token "$REPLICATED_API_TOKEN"
['./test-argv.py', 'run', '-it', '--rm', ' --mount type=bind,source=../infra/kots/staging,target=../infra/kots/staging', 'replicated/vendor-cli', 'release', 'create', '--promote', 'test-channel', '--version', '0.0.1', '--yaml-dir', '../infra/kots/staging', '--release-notes', "CLI release 'kots-release.sh' of 'main' triggered by name.surname", '--app', '', '--token', '']

```

As you can see by using an environment variable it’s changing the way that bash chooses to set the ARGV variables. I haven’t played around with it, but I think there is a way in bash to specify you want the shell variables expanded into ARGV. But really the way you came up with to control ARGV seems fine to me.

---

<div class="post-metadata">

**Author:** ![ianzink](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.replicated.com/ianzink/32/540_2.png) [@ianzink](https://community.replicated.com/u/ianzink)\
**Post date:** [March 3, 2023, 8:02pm UTC](https://community.replicated.com/t/vendor-cli-docker-container-doesnt-parse-release-notes-correctly/1142/4 "2023-03-03T20:02:01Z")

</div>

If you assign `command` using array syntax you can get the behavior you wanted originally

```auto
$ command=(release create --promote test-channel --version 0.0.1 --yaml-dir ../infra/kots/staging --release-notes "CLI release 'kots-release.sh' of 'main' triggered by name.surname")

$ ./test-argv.py run -it --rm \
    $mountOptions \
    replicated/vendor-cli $command \
    --app "$REPLICATED_APP" \
    --token "$REPLICATED_API_TOKEN"
['./test-argv.py', 'run', '-it', '--rm', ' --mount type=bind,source=../infra/kots/staging,target=../infra/kots/staging', 'replicated/vendor-cli', 'release', 'create', '--promote', 'test-channel', '--version', '0.0.1', '--yaml-dir', '../infra/kots/staging', '--release-notes', "CLI release 'kots-release.sh' of 'main' triggered by name.surname", '--app', '', '--token', '']

```

Let me know if it works for you (or if you just decide to stick with current version)

---

<div class="post-metadata">

**Author:** ![Mitch](https://avatars.discourse-cdn.com/v4/letter/m/dec6dc/32.png) [@Mitch](https://community.replicated.com/u/Mitch)\
**Post date:** [March 7, 2023, 7:40pm UTC](https://community.replicated.com/t/vendor-cli-docker-container-doesnt-parse-release-notes-correctly/1142/5 "2023-03-07T19:40:55Z")

</div>

Yes it would be nice if the CLI took a file here.

We avoid the problem by inserting our release notes into the `replicated-app.yaml` using a dumb template engine like envsubst:

```auto
...
spec:
  title: foo 
  releaseNotes: |
$release_notes
  additionalImages:
...

```

---

<div class="post-metadata">

**Author:** ![dex](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.replicated.com/dex/32/26_2.png) [@dex](https://community.replicated.com/u/dex)\
**Post date:** [March 7, 2023, 9:13pm UTC](https://community.replicated.com/t/vendor-cli-docker-container-doesnt-parse-release-notes-correctly/1142/6 "2023-03-07T21:13:29Z")

</div>

👏 YAML for the win - that was going to be my advice as well. Anything that can read in your release notes and write out valid YAML can work here. Any release note more than a line or two probably shouldn’t be passed on the CLI anyway.
