ciinfo

package module
v0.3.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 30, 2023 License: MIT Imports: 2 Imported by: 3

README ΒΆ

CI Info

Acknowledgement

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.

Tests

Installation

go get github.com/gkampitakis/ciinfo

Usage

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")
}

CLI Support

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.

Supported CI tools

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 βœ…

API

ciinfo.Name

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.

ciinfo.IsCI

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.

ciinfo.IsPR

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.

ciinfo.<VENDOR-CONSTANT>

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.

Documentation ΒΆ

Index ΒΆ

Constants ΒΆ

This section is empty.

Variables ΒΆ

View Source
var (
	Name string
	IsPr bool
	IsCI bool
)
View Source
var AGOLA = vendorsIsCI["AGOLA"]

CI is running on Agola CI

View Source
var APPCENTER = vendorsIsCI["APPCENTER"]

CI is running on Visual Studio App Center

View Source
var APPCIRCLE = vendorsIsCI["APPCIRCLE"]

CI is running on Appcircle

View Source
var APPVEYOR = vendorsIsCI["APPVEYOR"]

CI is running on AppVeyor

View Source
var AZURE_PIPELINES = vendorsIsCI["AZURE_PIPELINES"]

CI is running on Azure Pipelines

View Source
var BAMBOO = vendorsIsCI["BAMBOO"]

CI is running on Bamboo

View Source
var BITBUCKET = vendorsIsCI["BITBUCKET"]

CI is running on Bitbucket Pipelines

View Source
var BITRISE = vendorsIsCI["BITRISE"]

CI is running on Bitrise

View Source
var BUDDY = vendorsIsCI["BUDDY"]

CI is running on Buddy

View Source
var BUILDKITE = vendorsIsCI["BUILDKITE"]

CI is running on Buildkite

View Source
var CIRCLE = vendorsIsCI["CIRCLE"]

CI is running on CircleCI

View Source
var CIRRUS = vendorsIsCI["CIRRUS"]

CI is running on Cirrus CI

View Source
var CODEBUILD = vendorsIsCI["CODEBUILD"]

CI is running on AWS CodeBuild

View Source
var CODEFRESH = vendorsIsCI["CODEFRESH"]

CI is running on Codefresh

View Source
var CODEMAGIC = vendorsIsCI["CODEMAGIC"]

CI is running on Codemagic

View Source
var CODESHIP = vendorsIsCI["CODESHIP"]

CI is running on Codeship

View Source
var DRONE = vendorsIsCI["DRONE"]

CI is running on Drone

View Source
var DSARI = vendorsIsCI["DSARI"]

CI is running on dsari

View Source
var EARTHLY = vendorsIsCI["EARTHLY"]

CI is running on Earthly

View Source
var EAS = vendorsIsCI["EAS"]

CI is running on Expo Application Services

View Source
var GERRIT = vendorsIsCI["GERRIT"]

CI is running on Gerrit

View Source
var GITEA_ACTIONS = vendorsIsCI["GITEA_ACTIONS"]

CI is running on Gitea Actions

View Source
var GITHUB_ACTIONS = vendorsIsCI["GITHUB_ACTIONS"]

CI is running on GitHub Actions

View Source
var GITLAB = vendorsIsCI["GITLAB"]

CI is running on GitLab CI

View Source
var GOCD = vendorsIsCI["GOCD"]

CI is running on GoCD

View Source
var GOOGLE_CLOUD_BUILD = vendorsIsCI["GOOGLE_CLOUD_BUILD"]

CI is running on Google Cloud Build

View Source
var HARNESS = vendorsIsCI["HARNESS"]

CI is running on Harness CI

View Source
var HEROKU = vendorsIsCI["HEROKU"]

CI is running on Heroku

View Source
var HUDSON = vendorsIsCI["HUDSON"]

CI is running on Hudson

View Source
var JENKINS = vendorsIsCI["JENKINS"]

CI is running on Jenkins

View Source
var LAYERCI = vendorsIsCI["LAYERCI"]

CI is running on LayerCI

View Source
var MAGNUM = vendorsIsCI["MAGNUM"]

CI is running on Magnum CI

View Source
var NETLIFY = vendorsIsCI["NETLIFY"]

CI is running on Netlify CI

View Source
var NEVERCODE = vendorsIsCI["NEVERCODE"]

CI is running on Nevercode

View Source
var PROW = vendorsIsCI["PROW"]

CI is running on Prow

View Source
var RELEASEHUB = vendorsIsCI["RELEASEHUB"]

CI is running on ReleaseHub

View Source
var RENDER = vendorsIsCI["RENDER"]

CI is running on Render

View Source
var SAIL = vendorsIsCI["SAIL"]

CI is running on Sail CI

View Source
var SCREWDRIVER = vendorsIsCI["SCREWDRIVER"]

CI is running on Screwdriver

View Source
var SEMAPHORE = vendorsIsCI["SEMAPHORE"]

CI is running on Semaphore

View Source
var SOURCEHUT = vendorsIsCI["SOURCEHUT"]

CI is running on Sourcehut

View Source
var STRIDER = vendorsIsCI["STRIDER"]

CI is running on Strider CD

View Source
var TASKCLUSTER = vendorsIsCI["TASKCLUSTER"]

CI is running on TaskCluster

View Source
var TEAMCITY = vendorsIsCI["TEAMCITY"]

CI is running on TeamCity

View Source
var TRAVIS = vendorsIsCI["TRAVIS"]

CI is running on Travis CI

View Source
var VELA = vendorsIsCI["VELA"]

CI is running on Vela

View Source
var VERCEL = vendorsIsCI["VERCEL"]

CI is running on Vercel

View Source
var WOODPECKER = vendorsIsCI["WOODPECKER"]

CI is running on Woodpecker

View Source
var XCODE_CLOUD = vendorsIsCI["XCODE_CLOUD"]

CI is running on Xcode Cloud

View Source
var XCODE_SERVER = vendorsIsCI["XCODE_SERVER"]

CI is running on Xcode Server

Functions ΒΆ

func IsVendor ΒΆ

func IsVendor(vendor string) bool

Types ΒΆ

This section is empty.

Directories ΒΆ

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL