Code Monkey home page Code Monkey logo

yagocd's Introduction

gocd_logo Yet another GoCD python client

https://travis-ci.org/grundic/yagocd.svg?branch=master https://coveralls.io/repos/github/grundic/yagocd/badge.svg?branch=master https://readthedocs.org/projects/yagocd/badge/?version=latest

Introduction

This library is a high level python API wrapper upon ThoughtWorks GoCD REST API. From the official documentation:

Go Continuous Delivery is continuous integration/deployment server, which helps you automate and streamline the build-test-release cycle for worry-free.

Using it, you can access to internals of the Pipelines, check their statuses, download Artifacts and more. It is designed with maximum comfort and productivity from the user perspective, so it should be very easy to use it in your own project. More information is available at official documentation

Installation

$ pip install yagocd

Quick example

from yagocd import Yagocd

go = Yagocd(
    server='https://example.com',
    auth=('user', 'password'),
    options={
        'verify': False  # skip verification for SSL certificates.
    }
)

for pipeline in go.pipelines:   # Iterate over all pipelines
    for instance in pipeline:   # Iterate over each instance of some pipeline
        for stage in instance:  # Iterate over each stages of some pipeline instance
            for job in stage:   # Iterate over each job of some pipeline
                for root, folder, files in job.artifacts:  # Iterate over artifacts like `os.walk` manner
                    for artifact in files:
                        print(artifact.data.url)

                # print property of each job
                for key, value in job.properties.items():
                    print("{} => {}".format(key, value))

Different implementations of GoCD API

Here is list of similar projects, that implements GoCD API:

Licence

MIT

yagocd's People

Contributors

grundic avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

yagocd's Issues

Add support for `gocd.guest.user.auth.plugin`

Right now it's possible to login with guest like this:

from yagocd import Yagocd

go = Yagocd(server='https://build.gocd.io')

# login as guest
go._session.get('https://build.gocd.io/go/plugin/interact/gocd.guest.user.auth.plugin/index')

print(len(list(go.pipelines)))

Should be separate method, somewhere in Session and special parameter for controlling this.

ValueStreamMap: put dictionary instead of StageInstance

Resource.data should consists of primitive data types.
During parsing ValueStreamMap data there is StageInstance being created and appended to the list of stages.
This is wrong, as StageInstance should be returned by stage() method of PipelineInstance object.

GoCD server's version can not be parsed

GoCD's about page changed layout and is thus no longer parsable by the InfoManager class.
Which leads to an error when trying to connect to a GOCD-Server v19.5.0

Cannot trigger a pipeline with variables GoCD v18.3.0

Hi,

I cannot find any documentation on this. What I am look for is the correct syntax required to trigger pipelines with variables. I have tried a combination of the following, but continue to get:
yagocd.exception.RequestError: [500] Server Error: Server Error for url

'[{"name": "bla", "value": "something"}]'
'{"name": "bla", "value": "something"}'
'[{"bla": "something"}]'
'{"bla": "something"}'

Please note that scheduling a pipeline run works fine when variables is None
yagocd is also broken when scheduling pipelines with variables on 1.8.3 . See where it's broken:
https://api.gocd.org/18.1.0/#scheduling-pipelines
vs
https://api.gocd.org/18.3.0/#scheduling-pipelines
And then the yagocd code:
https://github.com/grundic/yagocd/blob/master/yagocd/resources/pipeline.py

API does not take options "variables" and "secure_variables", but instead "environment_variables" (as a list)

importing Yagocd causes SyntaxError

I just installed yagocd with pip and now I get this error tying to import the library:

Python 2.6.6 (r266:84292, Aug  9 2016, 06:11:56) 
[GCC 4.4.7 20120313 (Red Hat 4.4.7-17)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from yagocd import Yagocd
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python2.6/site-packages/yagocd/__init__.py", line 30, in <module>
    from yagocd.client import Yagocd
  File "/usr/lib/python2.6/site-packages/yagocd/client.py", line 33, in <module>
    from yagocd.resources.agent import AgentManager
  File "/usr/lib/python2.6/site-packages/yagocd/resources/agent.py", line 32, in <module>
    from yagocd.resources.job import JobInstance
  File "/usr/lib/python2.6/site-packages/yagocd/resources/job.py", line 30, in <module>
    from yagocd.resources.artifact import ArtifactManager
  File "/usr/lib/python2.6/site-packages/yagocd/resources/artifact.py", line 136
    parameters = {p: self._require_param(p, func_args) for p in self.PATH_PARAMETERS}
                                                         ^
SyntaxError: invalid syntax

Is yagocd not compatible with python 2.6.6 or am I doing something wrong?
This is the latest and version I can get with yum on my RHEL6 workstation:

Package python-devel-2.6.6-66.el6_8.x86_64 already installed and latest version
Nothing to do

Unable to schedule a pipeline at a given material revision

We have a pipeline with a single material, and we try to schedule it this way:

ourpipeline.schedule(materials=[{'fingerprint': '480432aaa123b49d8336b14e46f94e3ceffd38a6b96ded683c0e5ba2d2efbc63', 'revision': '00e3442b81d6b272083391d146bd9c5cdf6ce2f6'}])

But instead of triggering with the specified git revision, this always trigger with latest HEAD on the material branch. Is there a way to schedule with a specified revision?

yagocd throwing invalid syntax in Red Hat 4.4.7-11 with python 2.6.6

Hey i have installed yagocd using pip on my mac and linux. its working fine in mac but not on linux

error:

Python 2.6.6 (r266:84292, Jul 23 2015, 15:22:56)
[GCC 4.4.7 20120313 (Red Hat 4.4.7-11)] on linux2
Type "help", "copyright", "credits" or "license" for more information.

from yagocd import Yagocd
Traceback (most recent call last):
File "", line 1, in
File "/usr/lib/python2.6/site-packages/yagocd/init.py", line 30, in
from yagocd.client import Yagocd
File "/usr/lib/python2.6/site-packages/yagocd/client.py", line 33, in
from yagocd.resources.agent import AgentManager
File "/usr/lib/python2.6/site-packages/yagocd/resources/agent.py", line 32, in
from yagocd.resources.job import JobInstance
File "/usr/lib/python2.6/site-packages/yagocd/resources/job.py", line 30, in
from yagocd.resources.artifact import ArtifactManager
File "/usr/lib/python2.6/site-packages/yagocd/resources/artifact.py", line 136
parameters = {p: self._require_param(p, func_args) for p in self.PATH_PARAMETERS}
^
SyntaxError: invalid syntax

I think yagocd works for python 2.6.6 as well right?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.