Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Enhancement] Improve and clarify the help documentation for the command line tools #293

Open
Leemur89 opened this issue Aug 22, 2024 · 2 comments
Labels
documentation Improvements or additions to documentation enhancement New feature or request

Comments

@Leemur89
Copy link

Describe the bug
Hello,
When using the enabled parameter in my robot.toml, my profile is not enabled

To Reproduce
Steps to reproduce the behavior:
robot.toml:

[profiles.ci]
description = "CI pipelines"
enabled = true

Then using robotcode:

$ robotcode profiles list
  Active   Selected   Enabled   Precedence   Name   Description   
 ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
                                             ci     CI pipelines  

Expected behavior
Profile is enabled

Desktop (please complete the following information):
VS Code Version 1.89.1
RobotCode Version 0.85.0
OS: MacOS Ventura 13.3.1
Python Version 3.8.19
RobotFramework Version 7.0.1
robotframework-browser 18.7.0
robotframework-robocop 5.3.0
robotcode-runner 0.85.0

@Leemur89 Leemur89 added the bug Something isn't working label Aug 22, 2024
@Leemur89
Copy link
Author

ok after digging a bit inside the code I understood: it will only be enabled if we select it with the option -p
I find it a bit counter intuitive, I would have expected it to be selected when enabled is true, for instance from my ci:

robotcode profiles list

would show my ci profile as enabled

But actually I need:

robotcode -p ci profiles list

@d-biehl
Copy link
Member

d-biehl commented Aug 22, 2024

The functionality works as designed. A profile must be selected, and once it is selected, it is evaluated and potentially combined with other selected profiles.

To set specific profiles as default so that you don't have to specify them each time you start, you can use the default-profiles setting.

A profile is activated by default, but whether it is truly active in a particular configuration is determined – as you have already discovered – by either selecting the profile via -p or by defining it in the default-profiles entry in robot.toml. You can also use expressions to calculate whether a profile is activated or not, and you might set certain environment variables within a profile that are then evaluated, and so on.

Take this robot.toml as an example:

default-profiles = ["ci", "test", "prod", "devel"]

[profiles.ci]
enabled = { if = 'environ.get("CI", None) == "1"' }
inherits = ["headless"]

[profiles.ci.env]
IN_CI = "1"

[profiles.headless]
enabled = { if = 'environ.get("IN_CI", "0") == "1"' }
precedence = 100

[profiles.headless.extend-variables]
HEADLESS = "ON"

[profiles.prod]
enabled = { if = 'environ.get("CI_ENV", None) == "Prod"' }

[profiles.prod.extend-variables]
URL = "https://prod.example.com"

[profiles.devel.extend-variables]
URL = "https://devel.example.com"

[profiles.test]
enabled = { if = 'environ.get("CI_ENV", None) == "Test"' }

[profiles.test.extend-variables]
URL = "https://test.example.com"

In this file, we define several profiles that are enabled or disabled depending on certain environment variables. A special case is the ci profile, where we define an environment variable that is used in the headless profile.

This allows us to define complex configurations in robot.toml, while controlling what actually happens via environment variables, similar to how it is done in CI environments.

I know there is still a lot of documentation missing on this whole topic, but I am working on it. I'll leave this bug open for now, but I will turn it into an enhancement to improve the documentation, specifically for the command line tools.

@d-biehl d-biehl changed the title [BUG] robot.toml: enabled option does not seem to work [Enhancement] Improve and clarify the help documentation for the command line tools Aug 22, 2024
@d-biehl d-biehl added documentation Improvements or additions to documentation enhancement New feature or request and removed bug Something isn't working labels Aug 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants