jenkinsci/job-dsl-plugin — pull request #72 by bealeaj1214 (2013-07-19 13:03:07+00:00)
Title: Update FileJobManagement to store param passed in from System properties and environment variables

- This enables command line testing of DSL jobs that use build parameters.

Below is a bash script that create a job dsl file named simple.job It is parameterized to use String build parameter named JOB_NAME_PARAM. The final line of the script sets an environment variable on the command line and invokes gradle wrapper to run the job from the command line

__SCRIPT_BELOW__
#!/bin/bash
OUTFILE=simple.job
(
cat <<'EOF'
def jobName="${JOB_NAME_PARAM}"
job {
name "${jobName}"
scm {
git('git://github.com/jgritman/aws-sdk-test.git')
}
triggers {
scm('*/15 * * * *')
}
steps {
maven('-e clean test')
}
}

EOF
) > $OUTFILE

JOB_NAME_PARAM="DSL-Tutorial-1-Test-param" ./gradlew :job-dsl-core:run -Pargs=$PWD/simple.job