rfussien / gitlab2rundeck-adapter
该包已被废弃,不再维护。没有建议的替代包。
一个小的gitlab到rundeck适配器
v1.1.3
2017-06-22 16:06 UTC
Requires
- php: >=5.4
- hassankhan/config: ^0.10
- psr/log: ~1.0
- symfony/yaml: ~3.1
Requires (Dev)
- monolog/monolog: ^1.20
- phpdocumentor/phpdocumentor: ^2.9
- phpunit/phpunit: ~5.1
README
此包允许在gitlab(ci)事件触发后运行rundeck作业。
要求
- 适用于PHP 5.6或更高版本
- rundeck api 12或更高版本
- gitlab(ci) 8.5或更高版本
注意:它与gitlab和gitlabCI的webhook都兼容。然而,当使用gitlab的webhook时,build_status被视为失败。因此,在这种情况下,在项目配置中指定"runOnFail: true"会有所帮助。
安装
通过Composer
$ composer require rfussien/gitlab2rundeck-adapter
用法
配置
创建两个yaml配置文件。一个是rundeck的,另一个是gitlab项目的
Rundeck配置
# rundeck api configuration # http{$ssl}://{$host}:{$port}/api/{api_version}/{jobID}/(run|executions) host: rundeck.local # REQUIRED token: CmBl3gDr8ua6uMXQS0pLSmGUDvHjdOl7 # REQUIRED port: 4440 # OPTIONAL (Default 4440) ssl: true # OPTIONAL (Default false) api_version: 13 # OPTIONAL (Default 13. Has to be >= 12) log_level: DEBUG # OPTIONAL ('DEBUG','VERBOSE','INFO','WARN','ERROR')
Gitlab项目配置
# gitlab(ci) configuration gitlab_url: http://gitlab projects: - project: name: repos/app1 # REQUIRED project name (w/o the base_url) jobId: 558d3c76-7768-4056-a10c-0842ecae0ca9 # REQUIRED Rundeck Job UUID ref: master # OPTIONAL default: master. Project branch runOnFail: true # OPTIONAL default: false. Run the job even if the tests failed runOnTagOnly: true # OPTIONAL default: false. Run the job only when a tag is done (useful for release deployment) jobArgs: { arg1: foo, arg2: bar } # OPTIONAL Rundeck Job arguments runJobAs: foo # OPTIONAL Run the job as the given user - project: name: repos/app2 jobId: 558d3c76-7768-4056-a10c-0842ecae0ca8 ref: master runOnFail: false [...]
运行适配器
$adapter = G2R\Adapter::factory( __DIR__ . '/rundeck.yml', __DIR__ . '/projects.yml', // Eventually, give it a logger that implements psr3 (Psr\Log\LoggerInterface) (new Monolog\Logger('g2r'))->pushHandler(new Monolog\Handler\StreamHandler('./g2r.log')) ); $adapter->run();
测试
$ composer test
贡献
有关详细信息,请参阅CONTRIBUTING和CONDUCT。
安全
如果您发现任何安全相关的问题,请通过:author_email发送电子邮件,而不是使用问题跟踪器。
许可
MIT许可(MIT)。有关更多信息,请参阅许可文件。