Closed steffen-wilke closed 6 years ago
This can also be very useful for conditions. There could be an EnvironmentCondition
that checks whether an environment variable currently has a certain value. This would allow for something like:
<FailInstruction Message="MyPath is currently locked.">
<Conditions Type="And">
<EnvironmentCondition Variable="MY_PATH_LOCKED">1</EnvironmentCondition>
<ChangedPathCondition ChangedPathRegExPattern="/mypath/.*" />
</Conditions>
</FailInstruction>
I'm not sure that an EnvironmentCondition
would be of much use. RepoCop is called from the subversion server, which typically runs as a (Windows) service. Therefore the environment variables depend on the user that is running the service and I'm not sure if simply changing them when logged-in as that user will immediately make this process see the new environment settings. I have my doubts.
Why use ${MY_SCM_MAILS} as the syntax for environment variables?
I think for Windows it's usually %MY_SCM_MAILS% and Environment.ExpandEnvironmentVariables
could be used. That's the option I'm probably going to use.
I'm not sure that an EnvironmentCondition would be of much use.
I agree with the potential complications here. Maybe a even more general CommandLineCondition
might cover the requirement of having "more sophisticated" conditions. But that's a different topic.
Why use ${MY_SCM_MAILS} as the syntax for environment variables?
Sorry, I had the JenkinsFile syntax in mind when writing this. Of course, the default Windows syntax makes more sense here.
Should work now.
Currently, the
HookConfig
only allows for absolute path configurations. It would be useful to support environment variables to allow making the configuration more generic and independent on the machine it is executed on. This should be implemented for all file/folder configurations in the config, but is particularly useful for instructions that execute another script or refer to some file, e.g.:MailInstruction/BodyTemplateFile
CommandLineInstruction/FileName
Current State:
Target State: