Replies: 5 comments 10 replies
-
That being said, maybe I am just over engineering things :D |
Beta Was this translation helpful? Give feedback.
-
I think instead of "result" I would prefer "outcome" to express the expectaction of the shell resource |
Beta Was this translation helpful? Give feedback.
-
I like the idea of using different exit code to ensure different outcomes. It reminds me of the Terraform I can't remember exactly why I did the whole "output" stuff initially and I fear it was only "because it looked easy". Switching to an exit-code based behavior make sense to me:
WDYT?
and
Both feels like over-engineered compared to a shell instruction While experimenting code changes for #465, I stumbled upon this behavior of the shell provider. Updatecli has to I thought about a way to solve this differently: instead of asking the shell resource to determine which file was changed (e.g. the user 😅), what if updatecli could do it instead? But this ain't a free meal to implement compared to the exit code solution you mention here. |
Beta Was this translation helpful? Give feedback.
-
Thanks a lot for your feedback. The file checksum and file exist, are example where I envision have different kind of expected outcome to ultimately simply the scripting part. Where I have the following manifest
And I would like the shell target to detect if the package-lock.json was modified even if the file is not in a git repository
Would easily run on MacOSx/Windows/Linux assuming that everybody has npm installed |
Beta Was this translation helpful? Give feedback.
-
I agree with you and I think we are misunderstanding each others :D. One of the early check of the npm autodiscovery plugin is to see if there is package.json and a package-lock.json Case 1: No lock file Easiest scenario Case 2: Lock file present but npm is not installed We send a warning saying that we detected a package.json but we can't handle the lock file so we skip that package.json Case 3: Lock file is present and npm installed We use the json resource to retrieve the value from the npm dependency and then we run A similar behavior is possible for yarn. yarn relies on yarn.lock |
Beta Was this translation helpful? Give feedback.
-
I have been involved lately in different discussion about the shell resource. So I am putting here my thought looking for feedbacks.
At the moment, Updatecli shell resource return the following results
Source:
Condition:
Target:
While this behavior was a good idea to bootstrap the shell resource, I also need to regularly read to documentation each time I need to write a script for Updatecli
Now that the shell resource is used in many different scenarios, I start to have a better understanding of the problem
I can't find a solution that fit all my needs so I am wondering if it's not better to offer the ability to have different ways of mesure success
I propose to add a new key to define the kind of expected result
Using file checksum
=> If file checksum for listed files is the same before and after running the shell command then we return no changed
Checking command return code
=> Result is defined based on command return code
Checking if files exist
=> If some of the listed files are created before and after running the shell command then we return something changed.
If files are missing after a run then we assume an error
If the list of files already exist before the shell command then we skip
Current behavior
And the current mode for backward compatibility
Current mode
I guess we can still add result kind later based on the need.
The purpose of the result is to simplify so we don't have to handle the different results
Beta Was this translation helpful? Give feedback.
All reactions