stateful / runme

DevOps Notebooks Built with Markdown
https://runme.dev
Apache License 2.0
1.11k stars 36 forks source link

Document-level options "category" #580

Closed ruzickap closed 3 months ago

ruzickap commented 4 months ago

Hello

The new feature introduced in https://github.com/stateful/runme/issues/369 - 'Document-level options "category"' doesn't work:

Example - let's have the following file:

Installation steps for Solution 2:

echo "[1] Install command in $PWD"
echo "[2] Install second command"
echo "Delete solution"
echo "Delete solution - second command"

It seems like the feature is buggy.

Thank you for looking at it...

sourishkrout commented 4 months ago

Could you please verify/repro @pastuxso when you get a chance? Thanks.

pastuxso commented 4 months ago

Hi @ruzickap, Thank you for reporting this issue. I'll review it and get back to you as soon as I have news.

pastuxso commented 4 months ago

Hey @ruzickap, I've identified the cause of the issue and I'll fix it. In the meantime, you can use a workaround by adding a name to the cells you want to include in the global category and removing them from the cell with the category. Here's an example:

---
shell: bash
cwd: /tmp
category: solution-2
---

Installation steps for Solution 2:

```sh {"name":"one"}
echo "[1] Install command in $PWD"
echo "[2] Install second command"
echo "Delete solution"
echo "Delete solution - second command"


Output:

![image](https://github.com/stateful/runme/assets/43882/0804effa-8287-436e-a28c-e885f5883626)

As you mentioned, the **--dry-run** argument only takes the first command. I'll work on it, too.
sourishkrout commented 4 months ago

@ruzickap apologies for the named vs unnamed oversight. We fixed the issue and added more test coverage. Thanks @pastuxso! This is going out with the next patch release in the next 24-48h.

pastuxso commented 3 months ago

@sourishkrout, that's excellent news. @ruzickap, I really appreciate your contribution and your patience on this.

sourishkrout commented 3 months ago

v3.3.3 should be going into homebrew momentarily as soon as https://github.com/Homebrew/homebrew-core/pull/173683 is merged.

ruzickap commented 3 months ago

Thank you @pastuxso.

It seems like 'Document-level option "category"' is working fine :-)

As you mentioned above the --dry-run is showing only the first command:

❯ runme run --all --skip-prompts --category solution-2 --dry-run
#!/opt/homebrew/bin/bash

// run in "/tmp"

set -e -o pipefail
echo "[1] Install command in $PWD"

Let me create new issue for that to properly track it...

Thank you...

sourishkrout commented 3 months ago

Thanks @ruzickap! We will keep you posted on #606 accordingly.