Remote triggering of job works fine in commandline but not through script

10 views
Skip to first unread message

Maneesh M P

unread,
Jan 16, 2015, 11:17:38 PM1/16/15
to jenkins...@googlegroups.com
I have the below script to iterate the the properties file and invoke a another job through REST API call. 

!/bin/bash
IFS=$'\n'
for file in `ls -1 *.config`; do
    for val in `cat $file`;do
        url+="\&"${val}
    done
    url=${url// /"%20"}

    echo curl -su  "abcl:32423423fssd" http://jenkins.com/job/abc/buildWithParameters?token=stop${url}     
            curl -su  "abcl:32423423fssd" http://jenkins.com/job/abc/buildWithParameters?token=stop${url}
       
    url=""
    sleep 1
done

This script when executes throws some garbage like below and doesn't work.

!DOCTYPE html><html><head>
    

    <title>Jenkins</title><link rel="stylesheet" type="text/css" href="/static/d27551cd/css/style.css" /><link rel="stylesheet" type="text/css" href="/static/d27551cd/css/color.css" /><link rel="shortcut icon" type="image/vnd.microsoft.icon" href="/static/d27551cd/favicon.ico" /><script>var isRunAsTest=false; var rootURL=""; var resURL="/static/d27551cd";</script><script src="/static/d27551cd/scripts/prototype.js" type="text/javascript"></script><script src="/static/d27551cd/scripts/b



But the line I am echoing, If i copy paste the line from console and execute in the command line, it works just fine and triggers the job.

Can anyone give me any pointer about what is happening here ?


Thanks,
Maneesh
Reply all
Reply to author
Forward
0 new messages