Launchpad API from travis-ci and git project imported in launchpad

Asked by Valentin Hamon

Hello,

I am trying to set up my github project for automatic code import from travis-ci.
My question is not about Travis-ci, but about launchpad.

I followed that tutorial :
https://docs.travis-ci.com/user/deployment/launchpad/

Thus, I generated an API access token and I use it in my travis configuration.

Travis usually just send a POST request to launchpad api :
https://github.com/travis-ci/dpl/blob/master/lib/dpl/provider/launchpad.rb

The POST request was :
https://api.launchpad.net/1.0/~armadito/armadito-av/release/+code-import'
{'ws.op' => 'requestImport'}

I got the following error message in response from that POST request :
 <lp.registry.model.personproduct.PersonProduct object at 0x2affd584b890>, name: u'release'

I know "release" is a git branch, also I tried multiple URLs, without success.
I also know that there is no branch associated with team "armadito", according to :
https://code.launchpad.net/~armadito

Launchpad project associated :
https://code.launchpad.net/~armadito/armadito-av/+git/main

Also, I am asking :
Is it possible to use API code-import with an imported git project into launchpad ? Or is it only for bazaar ?

And so, API expects a bazaar branch ?

Thanks in advance,

Valentin Hamon.

Question information

Language:
English Edit question
Status:
Solved
For:
Launchpad itself Edit question
Assignee:
No assignee Edit question
Solved by:
Valentin Hamon
Solved:
Last query:
Last reply:
Revision history for this message
Colin Watson (cjwatson) said :
#1

You just need to use the correct URL; the APIs match up well enough that things should otherwise work fine. Looking at the Travis-provided API, you should set:

  slug: ~armadito/armadito-av/+git/main

The Travis documentation was evidently written before Launchpad added Git-to-Git import support, and is therefore out of date for that case. When the import is targeting Git, the general form is `~user-name/project-name/+git/repository-name` rather than `~user-name/project-name/branch-name`.

Revision history for this message
Valentin Hamon (vhamon) said :
#2

Thanks a lot, it works fine.

I will create a pull request in order to update travis-ci documentation for launchpad.
Indeed, I found out an other wrong information for tokens encryptions.

Bye.