2

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?

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. Jul 27 '15 at 5:51
  • ok, check my updated answer. Jul 27 '15 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? Jul 27 '15 at 10:15
  • @AtulRajguru9 Thanks ... will test this within the next 24 hours and post update here Jul 27 '15 at 12:07
  • @KevinBoyle that would be good. Jul 29 '15 at 1:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.