Jump to content


Communicating with Swarm

swarm continuous integration

  • Please log in to reply
5 replies to this topic

#1 irms

irms

    Newbie

  • Members
  • Pip
  • 3 posts

Posted 24 October 2013 - 01:54 PM

Hi,
I think we will need to set up a separate job for building our shelved changelists, so we need a way for the automated continuous_integration user to edit a specific review in swarm -- (approved/rejected) + comment.


Is there a way to communicate with Swarm from external interface?

#2 P4Geoff

P4Geoff

    Advanced Member

  • Members
  • PipPipPip
  • 217 posts

Posted 24 October 2013 - 04:31 PM

View Postirms, on 24 October 2013 - 01:54 PM, said:

I think we will need to set up a separate job for building our shelved changelists,

Could you expand on what you mean by this a bit more? I'd be curious.


View Postirms, on 24 October 2013 - 01:54 PM, said:

so we need a way for the automated continuous_integration user to edit a specific review in swarm -- (approved/rejected) + comment.

Have you looked at all at our automated tests integration?
http://www.perforce....highlight=tests

Basically, in your project configuration you specify a URL to be called whenever a review is created or updated.
Your script is handed details about the review and a success/fail callback URL.

By calling the success/fail callback your script is able to update the review to indicate if tests passed or failed and it can provide a link to details.

This _sounds_ like roughly what you're going for but I'd love to discuss how it varies or falls short.


View Postirms, on 24 October 2013 - 01:54 PM, said:

Is there a way to communicate with Swarm from external interface?

You can definitely interact with swarm externally.
We have some light documentation on the general process at:
http://www.perforce....ng/restful.html

If you open your network pane in Chrome and use the web ui to leave a comment, transition the review, etc. you can see what requests are required for those actions and clone the work via curl or a custom script.

We're actively looking at better formalizing (including version info for example) our remote API and greatly extending the documentation on it but I imagine that will be another couple releases to really come together.
Certainly usable in the meantime though.

-Geoff

#3 irms

irms

    Newbie

  • Members
  • Pip
  • 3 posts

Posted 25 October 2013 - 12:04 PM

Thanks for the information.

The continuous integration tool we are using doesn't support building shelved changelists, so we will have to build something to bridge this gap. We have a couple different options for how to do this, so I just want to make sure I've got all the tools available for whatever we end up doing.

Yeah, I hadn't understood that you would communicate back by using the pass or fail link. That might work out for us.

Thanks

#4 P4Geoff

P4Geoff

    Advanced Member

  • Members
  • PipPipPip
  • 217 posts

Posted 28 October 2013 - 11:30 PM

Happy to hear the feedback is assistive.

Do you mind sharing which CI tool you are using?

#5 irms

irms

    Newbie

  • Members
  • Pip
  • 3 posts

Posted 31 October 2013 - 01:40 PM

Hi,
We're using Pulse. I have got it working independently now like this: Shelved changelist with [review] triggers a script that triggers a Pulse build with a variable called P4SHELVE, which holds the cl#. Then, on the build machine, it unshelves the changelist before doing it's other jobs. It reverts it at the end.

Now I am going to look at how to connect it with Swarm. I don't have experience with web servers or using urls to catch commands, but I guess I will just learn.

#6 P4Geoff

P4Geoff

    Advanced Member

  • Members
  • PipPipPip
  • 217 posts

Posted 31 October 2013 - 04:21 PM

Sounds like good progress!

You can look at our example Jenkins integration script in our documentation:
http://www.perforce....test_suite.html

Doubtless your usage will vary but you can see how we call back to Swarm to let it know about success/failure:
        curl -d url=$BUILD_URL -o - $SWARM_FAILURE_URL


        curl -d url=$BUILD_URL -o - $SWARM_SUCCESS_URL

The failure/success url are passed to the initial script much like you are passing the P4SHELVE cl#.
The BUILD_URL is a URL that points back to the builds details in Jenkins. This allows the user to click the success/failure icon on a review and be taken to the result details. For your usage, this would be a link to the build details in Pulse of course.



Also tagged with one or more of these keywords: swarm, continuous integration

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users