Jose Sa commented on Bug JENKINS-12629

I had that problem too, but managed to workaround it with groovysh redirecting from standard input. It must be a bug that "groovy" command doesn't not work wuth SSH CLI.

If you don't care about output returned you don't even need to filter it out, but here is an example how to bulk apply some changes to subversion update strategy on all jobs with e certain regular _expression_ pattern:

## List jobs
JOBS_PAT=".*_analysis"
cat <<_EOF_ >list-jobs.groovy
for (job in Hudson.instance.items.findAll{ it.name =~ /^${JOBS_PAT}$/ }) println job.name;
exit
_EOF_
jobs=$(jcli groovysh < list-jobs.groovy | tail -n +4 | head -n -2 | sed "s,^[^ ]*groovy[^ ]*,,")

## get jobs
mkdir -p old
for job in $jobs; do
    echo $job
    jcli get-job $job > old/$job.xml
done

## change jobs
mkdir -p new
for job in $jobs; do
    echo $job
    sed 's/workspaceUpdater class.*/workspaceUpdater class="hudson.scm.subversion.UpdateWithRevertUpdater"\>/' old/$job.xml > new/$job.xml
    diff old/$job.xml new/$job.xml
done

## update jobs
for job in $jobs; do
    echo $job
    jcli update-job $job < new/$job.xml
done
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators.
For more information on JIRA, see: http://www.atlassian.com/software/jira

--
You received this message because you are subscribed to the Google Groups "Jenkins Issues" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-issues+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Reply via email to