This repository is based on work done in watson/ci-info and the contributors.
I will do my best to keep this library up to date and in sync with changes in watson/ci-info.
Get details about the current Continuous Integration environment.
go get github.com/gkampitakis/ciinfo
import (
"fmt"
"github.com/gkampitakis/ciinfo"
)
if ciinfo.IsCI {
fmt.Printf("The name of the CI server is: %s", ciinfo.Name)
} else {
fmt.Printf("This program is not running on a CI server")
}
ciinfo
can also be used as a CLI. You can install it with
go install github.com/gkampitakis/ciinfo/ciinfo@latest
Then ciinfo
command will be successful ( code 0 ) if running on CI else error ( code -1 ).
# will output isCI if running onCI
ciinfo && echo 'isCI'
ciinfo
also has
Usage of ciinfo:
-output string
you can output info [json, pretty].
-pr
check if shell is running on CI for a Pull Request.
Officially supported CI servers:
Name | Constant | isPR |
---|---|---|
Agola CI | ci.AGOLA |
β |
AWS CodeBuild | ciinfo.CODEBUILD |
π« |
AppVeyor | ciinfo.APPVEYOR |
β |
Azure Pipelines | ciinfo.AZURE_PIPELINES |
β |
Appcircle | ciinfo.APPCIRCLE |
π« |
Bamboo by Atlassian | ciinfo.BAMBOO |
π« |
Bitbucket Pipelines | ciinfo.BITBUCKET |
β |
Bitrise | ciinfo.BITRISE |
β |
Buddy | ciinfo.BUDDY |
β |
Buildkite | ciinfo.BUILDKITE |
β |
CircleCI | ciinfo.CIRCLE |
β |
Cirrus CI | ciinfo.CIRRUS |
β |
Codefresh | ciinfo.CODEFRESH |
β |
Codeship | ciinfo.CODESHIP |
π« |
Drone | ciinfo.DRONE |
β |
dsari | ciinfo.DSARI |
π« |
Earthly CI | ci.EARTHLY |
π« |
Expo Application Services | ciinfo.EAS |
π« |
Gerrit CI | ciinfo.GERRIT |
π« |
GitHub Actions | ciinfo.GITHUB_ACTIONS |
β |
GitLab CI | ciinfo.GITLAB |
β |
Gitea Actions | ci.GITEA_ACTIONS |
π« |
GoCD | ciinfo.GOCD |
π« |
Google Cloud Build | ciinfo.GOOGLE_CLOUD_BUILD |
π« |
Harness CI | ciinfo.HARNESS |
π« |
Heroku | ciinfo.HEROKU |
π« |
Hudson | ciinfo.HUDSON |
π« |
Jenkins CI | ciinfo.JENKINS |
β |
LayerCI | ciinfo.LAYERCI |
β |
Magnum CI | ciinfo.MAGNUM |
π« |
Netlify CI | ciinfo.NETLIFY |
β |
Nevercode | ciinfo.NEVERCODE |
β |
Prow | ci.PROW |
π« |
ReleaseHub | ciinfo.RELEASEHUB |
β |
Render | ciinfo.RENDER |
β |
Sail CI | ciinfo.SAIL |
β |
Screwdriver | ciinfo.SCREWDRIVER |
β |
Semaphore | ciinfo.SEMAPHORE |
β |
Sourcehut | ciinfo.SOURCEHUT |
π« |
Strider CD | ciinfo.STRIDER |
π« |
TaskCluster | ciinfo.TASKCLUSTER |
π« |
TeamCity by JetBrains | ciinfo.TEAMCITY |
π« |
Travis CI | ciinfo.TRAVIS |
β |
Vela | ci.VELA |
β |
Vercel | ciinfo.VERCEL |
β |
Visual Studio App Center | ciinfo.APPCENTER |
π« |
Woodpecker | ciinfo.WOODPECKER |
β |
Returns a string containing name of the CI server the code is running on.
If CI server is not detected, it returns empty string ""
.
Don't depend on the value of this string not to change for a specific
vendor. If you find your self writing ciinfo.Name === "Travis CI"
, you
most likely want to use ciinfo.IsVendor("TRAVIS")
instead.
Returns a boolean. Will be true
if the code is running on a CI server,
otherwise false
.
Some CI servers not listed here might still trigger the ciinfo.isCI
boolean to be set to true
if they use certain vendor neutral
environment variables. In those cases ciinfo.Name
will be ""
and no
vendor specific boolean will be set to true
.
Returns a boolean if PR detection is supported for the current CI server. Will
be true
if a PR is being tested, otherwise false
. If PR detection is
not supported for the current CI server, the value will be false
.
A vendor specific boolean constant is exposed for each support CI
vendor. A constant will be true
if the code is determined to run on
the given CI server, otherwise false
.
Examples of vendor constants are ciinfo.TRAVIS
or ciinfo.APPVEYOR
. For a
complete list, see the support table above.