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

Allow registered vars to be populated across tasks #197

Merged
merged 4 commits into from
Apr 27, 2024

Conversation

umputun
Copy link
Owner

@umputun umputun commented Apr 27, 2024

see #196

This PR changes the scope of registered variables, making them available to all subsequent tasks. The only thing I still doubt is whether those vars should overwrite locally set variables (set by command) and act as immutable (can be set once). For now, I made them immutable, but may reconsider it if needed.

cc: @koolay

The runner now differentiates between all variables and registered variables from command execution. Registered variables are a subset of all variables that will be used for subsequent tasks. This additional feature aids in more specific tracking and utilization of key variables in more complex scripting scenarios. This is a preparation step to implement cross-task registered vars #196
This update adds the function 'UpdateRegisteredVars' to update environment variables with values from a list of registered variables passed on by the caller. This ensures registered variables can be used across tasks are updated promptly.
Expanded on the README by adding a section which explains the usage of registered variables. This section contains details on how registered variables can be used across multiple tasks within the same playbook, with an included example for clarity.
@coveralls
Copy link

Pull Request Test Coverage Report for Build 8862211412

Details

  • 36 of 56 (64.29%) changed or added relevant lines in 5 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage decreased (-0.4%) to 83.563%

Changes Missing Coverage Covered Lines Changed/Added Lines %
pkg/config/command.go 3 5 60.0%
pkg/runner/runner.go 24 26 92.31%
pkg/config/playbook.go 0 16 0.0%
Totals Coverage Status
Change from base Build 8789175277: -0.4%
Covered Lines: 2730
Relevant Lines: 3267

💛 - Coveralls

@umputun umputun merged commit ca4ade3 into master Apr 27, 2024
5 checks passed
@umputun umputun deleted the register-across-tasks branch April 27, 2024 19:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants