Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-25935

Add __FILE__ token or something similar so script owners know the path to the current DSL file

    • Icon: Improvement Improvement
    • Resolution: Fixed
    • Icon: Minor Minor
    • job-dsl-plugin
    • None

      It would be very nice to be able to determine the path to the current DSL file. I would use this to automatically fill in some information for the build so the user doesn't need to specify paths.

          [JENKINS-25935] Add __FILE__ token or something similar so script owners know the path to the current DSL file

          Are you still interested in getting this done? Do you have a concrete example showing where this can be helpful?

          Daniel Spilker added a comment - Are you still interested in getting this done? Do you have a concrete example showing where this can be helpful?

          Alex Earl added a comment -

          Yes, it would be useful. The case where it is useful for me is I am using job dsl to generate jobs that build embedded C code. I need to cd into the directory that the code is in before running make. Right now, my users have to add the root path to their source to the DSL file, if I had a _FILE_ token, I could determine that on my own since the DSL files must reside in the same directory as the code (according to my stipulations)

          Alex Earl added a comment - Yes, it would be useful. The case where it is useful for me is I am using job dsl to generate jobs that build embedded C code. I need to cd into the directory that the code is in before running make. Right now, my users have to add the root path to their source to the DSL file, if I had a _ FILE _ token, I could determine that on my own since the DSL files must reside in the same directory as the code (according to my stipulations)

          Code changed in jenkins
          User: Daniel Spilker
          Path:
          docs/Home.md
          docs/Job-DSL-Commands.md
          job-dsl-core/src/main/groovy/javaposse/jobdsl/Run.groovy
          job-dsl-core/src/main/groovy/javaposse/jobdsl/dsl/DslScriptLoader.groovy
          job-dsl-core/src/main/groovy/javaposse/jobdsl/dsl/ScriptRequest.groovy
          job-dsl-core/src/test/groovy/javaposse/jobdsl/dsl/DslScriptLoaderSpec.groovy
          job-dsl-core/src/test/resources/file.dsl
          job-dsl-plugin/src/main/groovy/javaposse/jobdsl/plugin/ScriptRequestGenerator.groovy
          job-dsl-plugin/src/main/groovy/javaposse/jobdsl/plugin/WorkspaceProtocol.groovy
          job-dsl-plugin/src/test/groovy/javaposse/jobdsl/plugin/ScriptRequestGeneratorSpec.groovy
          http://jenkins-ci.org/commit/job-dsl-plugin/2d4dc31a4189e46c6bf45b713807a39a11555156
          Log:
          added _FILE_ script variable containing the script location

          [FIXES JENKINS-25935]

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Daniel Spilker Path: docs/Home.md docs/Job-DSL-Commands.md job-dsl-core/src/main/groovy/javaposse/jobdsl/Run.groovy job-dsl-core/src/main/groovy/javaposse/jobdsl/dsl/DslScriptLoader.groovy job-dsl-core/src/main/groovy/javaposse/jobdsl/dsl/ScriptRequest.groovy job-dsl-core/src/test/groovy/javaposse/jobdsl/dsl/DslScriptLoaderSpec.groovy job-dsl-core/src/test/resources/file.dsl job-dsl-plugin/src/main/groovy/javaposse/jobdsl/plugin/ScriptRequestGenerator.groovy job-dsl-plugin/src/main/groovy/javaposse/jobdsl/plugin/WorkspaceProtocol.groovy job-dsl-plugin/src/test/groovy/javaposse/jobdsl/plugin/ScriptRequestGeneratorSpec.groovy http://jenkins-ci.org/commit/job-dsl-plugin/2d4dc31a4189e46c6bf45b713807a39a11555156 Log: added _ FILE _ script variable containing the script location [FIXES JENKINS-25935]

          Code changed in jenkins
          User: Daniel Spilker
          Path:
          docs/Home.md
          docs/Job-DSL-Commands.md
          job-dsl-core/src/main/groovy/javaposse/jobdsl/Run.groovy
          job-dsl-core/src/main/groovy/javaposse/jobdsl/dsl/DslScriptLoader.groovy
          job-dsl-core/src/main/groovy/javaposse/jobdsl/dsl/ScriptRequest.groovy
          job-dsl-core/src/test/groovy/javaposse/jobdsl/dsl/DslScriptLoaderSpec.groovy
          job-dsl-core/src/test/resources/file.dsl
          job-dsl-plugin/src/main/groovy/javaposse/jobdsl/plugin/ScriptRequestGenerator.groovy
          job-dsl-plugin/src/main/groovy/javaposse/jobdsl/plugin/WorkspaceProtocol.groovy
          job-dsl-plugin/src/test/groovy/javaposse/jobdsl/plugin/ScriptRequestGeneratorSpec.groovy
          http://jenkins-ci.org/commit/job-dsl-plugin/6323f89040cc7d9361455ed271e6202aac7e5666
          Log:
          Merge pull request #797 from daspilker/JENKINS-25935

          JENKINS-25935 added _FILE_ script variable containing the script location

          Compare: https://github.com/jenkinsci/job-dsl-plugin/compare/aa849448b122...6323f89040cc

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Daniel Spilker Path: docs/Home.md docs/Job-DSL-Commands.md job-dsl-core/src/main/groovy/javaposse/jobdsl/Run.groovy job-dsl-core/src/main/groovy/javaposse/jobdsl/dsl/DslScriptLoader.groovy job-dsl-core/src/main/groovy/javaposse/jobdsl/dsl/ScriptRequest.groovy job-dsl-core/src/test/groovy/javaposse/jobdsl/dsl/DslScriptLoaderSpec.groovy job-dsl-core/src/test/resources/file.dsl job-dsl-plugin/src/main/groovy/javaposse/jobdsl/plugin/ScriptRequestGenerator.groovy job-dsl-plugin/src/main/groovy/javaposse/jobdsl/plugin/WorkspaceProtocol.groovy job-dsl-plugin/src/test/groovy/javaposse/jobdsl/plugin/ScriptRequestGeneratorSpec.groovy http://jenkins-ci.org/commit/job-dsl-plugin/6323f89040cc7d9361455ed271e6202aac7e5666 Log: Merge pull request #797 from daspilker/ JENKINS-25935 JENKINS-25935 added _ FILE _ script variable containing the script location Compare: https://github.com/jenkinsci/job-dsl-plugin/compare/aa849448b122...6323f89040cc

            daspilker Daniel Spilker
            slide_o_mix Alex Earl
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: