code-intelligence.com/cifuzz@v0.40.0/pkg/cicheck/cicheck.go (about) 1 /* 2 List is adapted from https://github.com/npm/ci-detect 3 4 The ISC License 5 6 Copyright (c) npm, Inc. 7 8 Permission to use, copy, modify, and/or distribute this software for any 9 purpose with or without fee is hereby granted, provided that the above 10 copyright notice and this permission notice appear in all copies. 11 */ 12 13 package cicheck 14 15 import "os" 16 17 func CIName() string { 18 if os.Getenv("GERRIT_PROJECT") != "" { 19 return "gerrit" 20 } 21 if os.Getenv("SYSTEM_TEAMFOUNDATIONCOLLECTIONURI") != "" { 22 return "azure-pipelines" 23 } 24 if os.Getenv("BITRISE_IO") != "" { 25 return "bitrise" 26 } 27 if os.Getenv("BUDDY_WORKSPACE_ID") != "" { 28 return "buddy" 29 } 30 if os.Getenv("BUILDKITE") != "" { 31 return "buildkite" 32 } 33 if os.Getenv("CIRRUS_CI") != "" { 34 return "cirrus" 35 } 36 if os.Getenv("GITLAB_CI") != "" { 37 return "gitlab" 38 } 39 if os.Getenv("APPVEYOR") != "" { 40 return "appveyor" 41 } 42 if os.Getenv("CIRCLECI") != "" { 43 return "circle-ci" 44 } 45 if os.Getenv("SEMAPHORE") != "" { 46 return "semaphore" 47 } 48 if os.Getenv("DRONE") != "" { 49 return "drone" 50 } 51 if os.Getenv("DSARI") != "" { 52 return "dsari" 53 } 54 if os.Getenv("GITHUB_ACTIONS") != "" { 55 return "github-actions" 56 } 57 if os.Getenv("TDDIUM") != "" { 58 return "tddium" 59 } 60 if os.Getenv("SCREWDRIVER") != "" { 61 return "screwdriver" 62 } 63 if os.Getenv("STRIDER") != "" { 64 return "strider" 65 } 66 if os.Getenv("TASKCLUSTER_ROOT_URL") != "" { 67 return "taskcluster" 68 } 69 if os.Getenv("JENKINS_URL") != "" { 70 return "jenkins" 71 } 72 if os.Getenv("bamboo_planKey") != "" || os.Getenv("bamboo.buildKey") != "" { 73 return "bamboo" 74 } 75 if os.Getenv("GO_PIPELINE_NAME") != "" { 76 return "gocd" 77 } 78 if os.Getenv("HUDSON_URL") != "" { 79 return "hudson" 80 } 81 if os.Getenv("WERCKER") != "" { 82 return "wercker" 83 } 84 if os.Getenv("NETLIFY") != "" { 85 return "netlify" 86 } 87 if os.Getenv("NOW_GITHUB_DEPLOYMENT") != "" { 88 return "now-github" 89 } 90 if os.Getenv("GITLAB_DEPLOYMENT") != "" { 91 return "now-gitlab" 92 } 93 if os.Getenv("BITBUCKET_DEPLOYMENT") != "" { 94 return "now-bitbucket" 95 } 96 if os.Getenv("BITBUCKET_BUILD_NUMBER") != "" { 97 return "bitbucket-pipelines" 98 } 99 if os.Getenv("NOW_BUILDER") != "" { 100 return "now" 101 } 102 if os.Getenv("VERCEL_GITHUB_DEPLOYMENT") != "" { 103 return "vercel-github" 104 } 105 if os.Getenv("VERCEL_GITLAB_DEPLOYMENT") != "" { 106 return "vercel-gitlab" 107 } 108 if os.Getenv("VERCEL_BITBUCKET_DEPLOYMENT") != "" { 109 return "vercel-bitbucket" 110 } 111 if os.Getenv("VERCEL_URL") != "" { 112 return "vercel" 113 } 114 if os.Getenv("MAGNUM") != "" { 115 return "magnum" 116 } 117 if os.Getenv("NEVERCODE") != "" { 118 return "nevercode" 119 } 120 if os.Getenv("RENDER") != "" { 121 return "render" 122 } 123 if os.Getenv("SAIL_CI") != "" { 124 return "sail" 125 } 126 if os.Getenv("SHIPPABLE") != "" { 127 return "shippable" 128 } 129 if os.Getenv("TEAMCITY_VERSION") != "" { 130 return "teamcity" 131 } 132 if os.Getenv("CI_NAME") == "sourcehut" { 133 return "sourcehut" 134 } 135 if os.Getenv("CI_NAME") == "codeship" { 136 return "codeship" 137 } 138 if os.Getenv("CODEBUILD_SRC_DIR") != "" { 139 return "aws-codebuild" 140 } 141 if os.Getenv("CI") == "woodpecker" { 142 return "woodpecker" 143 } 144 145 // Adding more CI providers from https://github.com/watson/ci-info/blob/20fae89d2bdeb0e5dd70e6a9e8d2647764e6ff04/vendors.json 146 if os.Getenv("APPCENTER_BUILD_ID") != "" { 147 return "vs-app-center" 148 } 149 if os.Getenv("CI_XCODE_PROJECT") != "" { 150 return "xcode-cloud" 151 } 152 if os.Getenv("XCS") != "" { 153 return "xcode-server" 154 } 155 if os.Getenv("RELEASE_BUILD_ID") != "" { 156 return "releasehub" 157 } 158 if os.Getenv("HARNESS_BUILD_ID") != "" { 159 return "harness" 160 } 161 if os.Getenv("EAS_BUILD") != "" { 162 return "expo" 163 } 164 if os.Getenv("CM_BUILD_ID") != "" { 165 return "codemagic" 166 } 167 if os.Getenv("CF_BUILD_ID") != "" { 168 return "codefresh" 169 } 170 171 // test travis after the others, since several CI systems mimic it 172 if os.Getenv("TRAVIS") != "" { 173 return "travis-ci" 174 } 175 176 // Google Cloud Build - it sets almost nothing 177 if os.Getenv("BUILDER_OUTPUT") != "" { 178 return "google-cloud-build" 179 } 180 181 if os.Getenv("CI") != "" { 182 return "custom" 183 } 184 185 // Not a CI environment 186 return "" 187 } 188 189 func IsCIEnvironment() bool { 190 return CIName() != "" 191 }