GithubHelp home page GithubHelp logo

teamcity-executor's Introduction

NAME

Teamcity::Executor - Executor of TeamCity build configurations

SYNOPSIS 1 - asynchronous usage

use Teamcity::Executor;
use IO::Async::Loop;
use Log::Any::Adapter;

Log::Any::Adapter->set(
    'Dispatch',
    outputs => [
        [
            'Screen',
            min_level => 'debug',
            stderr    => 1,
            newline   => 1
        ]
    ]
);

my $loop = IO::Async::Loop->new;
my $tc = Teamcity::Executor->new(
    credentials => {
        url  => 'https://teamcity.example.com',
        user => 'user',
        pass => 'password',
    },
    build_id_mapping => {
        hello_world => 'playground_HelloWorld',
        hello_name  => 'playground_HelloName',
    }
    poll_interval => 10,
    loop => $loop,
);

$tc->register_polling_timer();

my $future = $tc->run('hello_name', { name => 'TeamCity' })->then(
    sub {
        my ($build) = @_;
        print "Build succeeded\n";
        my $greeting = $tc->get_artifact_content($build, 'greeting.txt');
        print "Content of greeting.txt artifact: $greeting\n";
    },
    sub {
        print "Build failed\n";
        exit 1
    }
);

my $touch_future = $tc->touch('hello_name', { name => 'TeamCity' })->then(
    sub {
        my ($build) = @_;
        print "Touch build started\n";
        $loop->stop();
    },
    sub {
        print "Touch build failed to start\n";
        exit 1
    }
);

$loop->run();

SYNOPSIS 2 - synchronous usage

use Teamcity::Executor;
use Log::Any::Adapter;

Log::Any::Adapter->set(
    'Dispatch',
    outputs => [
        [
            'Screen',
            min_level => 'debug',
            stderr    => 1,
            newline   => 1
        ]
    ]
);

my $tc = Teamcity::Executor->new(
    credentials => {
        url  => 'https://teamcity.example.com',
        user => 'user',
        pass => 'password',
    },
    build_id_mapping => {
        hello_world => 'playground_HelloWorld',
        hello_name  => 'playground_HelloName',
    }
);

my $resp = $tc->touch_without_future('hello_name', {});

print "id: $resp->{id}\n";
print "webUrl: $resp->{webUrl}\n";

DESCRIPTION

Teamcity::Executor is a module for executing Teamcity build configurations. When you execute one, you'll receive a future of the build. Teamcity::Executor polls TeamCity and when it finds the build has ended, it resolves the future.

LICENSE

Copyright (C) Avast Software

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

AUTHOR

Miroslav Tynovsky [email protected]

teamcity-executor's People

Contributors

ondrej-hosak avatar luckamohelnikova avatar jasei avatar petr-k avatar valerijmedvid avatar tynovsky avatar

Watchers

 avatar

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.