2017 © Pedro Peláez
 

library ci-detector-standalone

Standalone CLI command to detect continuous integration server and provide unified access to properties of current build

image

ondram/ci-detector-standalone

Standalone CLI command to detect continuous integration server and provide unified access to properties of current build

  • Tuesday, March 6, 2018
  • by OndraM
  • Repository
  • 1 Watchers
  • 3 Stars
  • 3 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 6 Versions
  • 0 % Grown

The README.md

CI Detector standalone command

Latest Stable Version Build Status Coverage Status, (*1)

Standalone CLI command wrapper for ci-detector PHP library., (*2)

It is used to detect continuous integration environment and to provide a unified interface to read the build information. You can use the command to make your scripts (and especially CLI tools) portable for multiple build environments., (*3)

The detection is based on environment variables injected to the build environment by continuous integration server. However, these variables are named differently in each CI. This command is based on lightweight ci-detector PHP library, which provides adapter for each supported CI server., (*4)

If you need the detection inside PHP script (so you don't need the CLI command), you can just use directly the ci-detector library., (*5)

Releases are matched to the versions of the parent ci-detector library. See changelog there for the list of the latest changes., (*6)

Usage

$ ./ci-detector.phar # return status code 0 if CI detected, 1 otherwise
$ echo $? # to print status code of previous command
0

$ ./ci-detector.phar detect ci-name
Travis CI

$ ./ci-detector.phar detect build-number
11.3

$ ./ci-detector.phar detect build-url
https://travis-ci.org/OndraM/ci-detector-standalone/jobs/189809581

$ ./ci-detector.phar detect branch
feature/test

$ ./ci-detector.phar detect commit
f45e5809cefdbb819913f9357381f4d291fd49a9

$ ./ci-detector.phar detect repository-url # Not supported on Travis CI, will print empty string

$ ./ci-detector.phar detect is-pull-request
Yes

$ ./ci-detector.phar detect branch
main

See method reference for a documentation of each property., (*7)

Dump all available properties

dump command will show all properties detected in current environment by ci-detector:, (*8)

$ ./ci-detector.phar dump
+-----------------+---------------------------------------------------------------+
| Property name   | Current value                                                 |
+-----------------+---------------------------------------------------------------+
| ci-name         | Travis CI                                                     |
| build-number    | 164.1                                                         |
| build-url       | https://travis-ci.org/OndraM/ci-detector-standalone/jobs/1337 |
| commit          | 9b232f6813915ddb1f226de93366cb924c72e400                      |
| branch          | feature/dump-command                                          |
| target-branch   | main                                                          |
| repository-name | ondram/ci-detector                                            |
| repository-url  | ssh://git@gitserver:7999/project/repo.git                     |
| is-pull-request | Yes                                                           |
+-----------------+---------------------------------------------------------------+

This is basically a table with output of describe() method of CiInterface (see method reference)., (*9)

Installation

Install as a standalone PHAR file

CI Detector could be installed as a standalone executable PHAR file (ci-detector.phar). Download latest version from Releases page., (*10)

To run CI Detector use command ./ci-detector.phar in the directory where you saved the file (or php ci-detector.phar if the file itself is not executable)., (*11)

Install using Composer

$ composer require ondram/ci-detector-standalone

To run CI Detector use command vendor/bin/ci-detector., (*12)

If you need the detection inside PHP script (and you don't need the CLI command), you can just use directly the lightweight ci-detector library., (*13)

The Versions

06/03 2018

dev-master

9999999-dev

Standalone CLI command to detect continuous integration server and provide unified access to properties of current build

  Sources   Download

MIT

The Requires

 

The Development Requires

by Ondřej Machulda

command continuous integration adapter interface teamcity gitlab travis jenkins continuousphp bamboo circleci codeship appveyor drone

20/02 2018

3.1.0

3.1.0.0

Standalone CLI command to detect continuous integration server and provide unified access to properties of current build

  Sources   Download

MIT

The Requires

 

The Development Requires

by Ondřej Machulda

command continuous integration adapter interface teamcity gitlab travis jenkins continuousphp bamboo circleci codeship appveyor drone

20/02 2018

dev-feature/update-symfony

dev-feature/update-symfony

Standalone CLI command to detect continuous integration server and provide unified access to properties of current build

  Sources   Download

MIT

The Requires

 

The Development Requires

by Ondřej Machulda

command continuous integration adapter interface teamcity gitlab travis jenkins continuousphp bamboo circleci codeship appveyor drone

27/10 2017

3.0.0

3.0.0.0

Standalone CLI command to detect continuous integration server and provide unified access to properties of current build

  Sources   Download

MIT

The Requires

 

The Development Requires

by Ondřej Machulda

command continuous integration adapter interface teamcity gitlab travis jenkins bamboo circleci codeship appveyor

26/05 2017

2.1.0

2.1.0.0

Standalone CLI command to detect continuous integration server and provide unified access to properties of current build

  Sources   Download

MIT

The Requires

 

The Development Requires

by Ondřej Machulda

command continuous integration adapter interface teamcity gitlab travis jenkins bamboo circleci codeship appveyor

07/01 2017

1.0.0

1.0.0.0

Standalone CLI command to detect continuous integration server and provide unified access to properties of current build

  Sources   Download

MIT

The Requires

 

The Development Requires

by Ondřej Machulda

command continuous integration adapter interface teamcity gitlab travis jenkins bamboo circleci codeship