Bad substitution error when running Plan in Bamboo
Asked by Scott Predmore:

I'm getting the following error when I try to run tests in Bamboo: /usr/bin/ant: 1: eval: Bad substitution

I've got Jira, Stash, and Bamboo all hooked up together. I also have Bamboo installed. I can do "ant -version" and it shows that ant is installed correctly on the server. I've ensured my ANT_HOME environment variable points to the right place. Ant is installed at "/usr/share/ant" and when I do "echo $ANT_HOME" it returns "/usr/share/ant". I've added "ANT_HOME/bin" to my PATH as well. One thing I have noticed is that the build log in Bamboo does not reflect what my environment variables say in the shell. Is this an issue, and if so how would I go about changing it? Stash is also hosting my repository, and all of the Application Links are pointing to the right place. One more thing to note. When I run the command "ls -al /usr/bin/ant", it returns "/usr/bin/ant -\> ../share/ant/bin/ant".

After this Bad Substitution error, there is another error in the build log.

Failing task since return code of \[/usr/bin/ant -[Djava.io](http://Djava.io).tmpdir=/opt/atlassian-bamboo-5.7.2/temp/PRED-UT-JOB1 -f build.xml deployEmptyCheckOnly -Dsfdc.username=MYEMAILWASHERE -Dsfdc.password=\*\*\*\*\*\*\*\*zqlYoVSy8ug9sZukIePrpB3DF -Dsfdc.serverurl=${bamboo.sfdc.dev.serverurl}\] was 2 while expected 0

I should also note that I am able to run a deployment from the shell, just not through the Bamboo front end.

These two errors may or may not be related. Does anyone know how to fix this error, or have come across this problem before? Any help is greatly appreciated. Thanks.


Answers:
author: rsperafico
body: Hello Scott,

Please, notice that based on the build log provided you have the following variable declared:

```
bamboo_sdfc_dev_serverurl='https://login.salesforce.com/'
```

However, in your Ant task, you are calling ${bamboo.sfdc.dev.serverurl}. Please, notice the following:

```
sdfc != sfdc
```

Could you please update your Ant task by calling the as:

```
${bamboo.sdfc.dev.serverurl}
```

It is just a mistype you and due to that the substitution is not working.

If you find this answer useful, I would kindly ask you to accept it so the same will be visible to others who might be facing the same issue you have inquired.

Thank you for your understanding.

---

Kind regards,  
Rafael P. Sperafico  
Atlassian Support

comments: author: Scott Predmore
body: Yup, it was a typo. Silly error. Thanks for your help, Rafael.


author: rsperafico
body: Hello Scott,

Thank you for your question.

Since you are running your build on a Linux environment, I would suggest you on running an Script task as per following:

```
set
```

This will display all the environment variables and global variables / plan variables you have defined in Bamboo.

---

Kind regards,  
Rafael P. Sperafico  
Atlassian Support

comments: author: Scott Predmore
body: Thank you for your quick reply, Rafael. I added a new Script task just before my Ant ask as you suggested. I set the Script Location as Inline, and set the Script body to "set" as you suggested. I ran the new job and it does display values of variables as you said it would. However, this doesn't really resolve my issue. I've put my log into pastebin and have linked it below. <http://pastebin.com/uDhTY3va> Thank you again for your help.


author: Scott Predmore
body: Thanks again for helping me out with this. Do you have any other ideas of what I could try? Or clarification on what's going on? Thanks.


Tags: ant

bitbucket-server

git

jira