use build service api in your program

Download Use build service API in your program

If you can't read please download the document

Upload: suselab

Post on 12-Apr-2017

480 views

Category:

Software


2 download

TRANSCRIPT

SUSE_template Jan 2014 v2_ks

Use build service API in your program

Max Lin Software Engineer

[email protected]

What is build service api?

RESTful API of Open Build Service

https://api.opensuse.org/apidocs

open-build-service/docs/api/api/api.txt

open-build-service/src/api/config/routes.rb

Client side usage:osc : Command Line Interface to work with Open Build Service

osc api /route + arguments

Benefits

`osc command` is wrappedsee core.py in osc

`osc api` is returned the xml data

Not that easily to do post-processing from the output of osc command

The usage does not provided by osc command

`osc command` example

`osc api` example

`osc api` example(cont.)

# osc api -X POST -d "hello 2016" /comments/project/home:mlin7442

Returned:

Ok

For Perl

Wrapped your http request(eg. HTTP::Request) and send it to right place and grab the return data

Call `osc api` in system(), open()

Cares of authentication part or using public api route instead

For Python

Wrapped your http request(eg. httplib) and sent by urlopen()Make sure go with authorisation header or go with public api route then.

Easy way: use existing osc python apiimport osc.core

import osc.conf

http_{GET, PUT, POST, DELETE} available

Some existing functions, do not need to re-do the wheel!

makeurl() help you to get the specific result if no existing function can adopt your requirement

Real case

Changelog Checker - https://github.com/openSUSE/osc-plugin-factory/blob/master/check_tags_in_requests.py

GoalMake sure it has valid tag within submission, eg. bsc#, fate#, if not, decline then.

Accept the the submission had same revision was submitted to openSUSE Factory or merged already.

Accept new package submissions

Accept delete request and add_role request

Questions?

Join the conversation,contribute & have a lot of fun!www.opensuse.org

LicenseThis slide deck is licensed under the Creative Commons Attribution-ShareAlike 4.0 International license. It can be shared and adapted for any purpose (even commercially) as long as Attribution is given and any derivative work is distributed under the same license.

Details can be found at https://creativecommons.org/licenses/by-sa/4.0/

Credits

Template
Richard Brown [email protected]

Design & InspirationopenSUSE Design Teamhttp://opensuse.github.io/branding-guidelines/

Click to edit the title text format

Click to edit the title text format

Thank you.

Have a Lot of Fun, and Join Us At:
www.opensuse.org

Click to edit the outline text formatSecond Outline LevelThird Outline LevelFourth Outline LevelFifth Outline LevelSixth Outline LevelSeventh Outline Level

General DisclaimerThis document is not to be construed as a promise by any participating organisation to develop, deliver, or market a product. It is not a commitment to deliver any material, code, or functionality, and should not be relied upon in making purchasing decisions. openSUSE makes no representations or warranties with respect to the contents of this document, and specifically disclaims any express or implied warranties of merchantability or fitness for any particular purpose. The development, release, and timing of features or functionality described for openSUSE products remains at the sole discretion of openSUSE. Further, openSUSE reserves the right to revise this document and to make changes to its content, at any time, without obligation to notify any person or entity of such revisions or changes. All openSUSE marks referenced in this presentation are trademarks or registered trademarks of SUSE LLC, in the United States and other countries. All third-party trademarks are the property of their respective owners.

Click to edit the title text format

Click to edit the title text format