3

We are using Jenkins and git to deploy and maintain code to our continuous integration Salesforce sandbox. We have team members working in different timezones and maintaining green build is a must.

I would like to have conditional command to deploy code only after successful validation of the build developer wants to deploy.

Can this be achieved through Jenkins and ant commands?

1 Answer 1

4

To validate components with the Force.com Migration Tool, set the checkOnly option to true in the deploy target. See Deploying Changes to a Salesforce Organization in the Force.com Migration Tool Guide.

checkOnly : Defaults to false. Set to true to check the validity of the deployed files without making any changes in the organization. This will not deploy any components or change the organization in any way.

To add conditional command in ant script you can set dependency using "Depends" attribute.

<target name="test.if.tomcat.is.running">
      <condition property="tomcat.running" value="true" else="false">
          <socket server="${tomcat.host}" port="${tomcat.port}"/> 
      </condition>
</target>

<target name="my.target.running"
    if="${tomcat.running}"
    depends="test.if.tomcat.is.running">
...
</target>

<target name="my.target.ifnotrunning"
    unless="${tomcat.running}"
    depends="test.if.tomcat.is.running">
   .....
</target>
6
  • Thanks for your reply. I want to use the result of this validation to do actual deployment. My question is how to check the result of validation and take action accordingly. Commented Jul 27, 2015 at 5:51
  • ok, check my updated answer. Commented Jul 27, 2015 at 6:47
  • hey @AmrIbrahim, I lead the team behind Gearset and we are starting to get to work implementing CI for our users. Would you be interested in having a 25 or 30 minute call so I can understand how CI fits into your process? Commented Jul 27, 2015 at 10:15
  • @AtulRajguru9 Thanks ... will test this within the next 24 hours and post update here Commented Jul 27, 2015 at 12:07
  • @KevinBoyle that would be good. Commented Jul 29, 2015 at 1:22

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .