In some ways that makes sense, but then how does validation work for *any* 
path?  Jenkins knows enough to return a value for project.getSomeWorkspace(), 
which implies choosing a build machine.

If Jenkins can provide access to the workspace, then it should also be able to 
resolve any environment variables that are active for that connection:  PATH, 
HOME, TERM, etc.

-- Matt

On Mar 22, 2013, at 9:57 PM, "domi" <[email protected]<mailto:[email protected]>> 
wrote:

Hi,
think about it, how would you expect this to work?
The env variables depend on (not only):
- the system of execution
- the user the process runs with
- parameters
- scripts
…
Most of these information is not available until the process really started, so 
therefore no there is no reliable way to do this during form validation.
/Domi

On 22.03.2013, at 21:43, [email protected]<mailto:[email protected]> wrote:

Hi everyone.  I have a build step descriptor with the following code:

        /**
         * Called automatically by Jenkins whenever the "projectFile"
         * field is modified by the user.
         * @param value the new path.
         */
        public FormValidation doCheckProjectFile(@AncestorInPath 
AbstractProject project, @QueryParameter String value) throws IOException {
            if (value == null || value.trim().isEmpty()) {
                return FormValidation.error("Project directory is required.");
            } else {
                // Make sure the directory exists.
                return FilePath.validateFileMask(project.getSomeWorkspace(), 
value);
            }
        }

This works as expected, until the user tries to input a path containing 
${WORKSPACE}, at which point the validation promptly fails.  I know I can 
expand environment variables during the actual build, using the build's EnvVars 
object, but I couldn't find any way to get an EnvVars instance from the 
validation method.

Is there a way to do this?  Any help would be appreciated.

-- Matt

--
You received this message because you are subscribed to the Google Groups 
"Jenkins Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to 
[email protected]<mailto:[email protected]>.
For more options, visit https://groups.google.com/groups/opt_out.




--
You received this message because you are subscribed to a topic in the Google 
Groups "Jenkins Developers" group.
To unsubscribe from this topic, visit 
https://groups.google.com/d/topic/jenkinsci-dev/PQ_LSyQ_7_c/unsubscribe?hl=en.
To unsubscribe from this group and all its topics, send an email to 
[email protected]<mailto:[email protected]>.
For more options, visit https://groups.google.com/groups/opt_out.


-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to