GetJobPlatform returns the platform where the job is running as a JobPlatform.
()
| 32 | |
| 33 | // GetJobPlatform returns the platform where the job is running as a JobPlatform. |
| 34 | func GetJobPlatform() JobPlatform { |
| 35 | // https://docs.github.com/en/actions/writing-workflows/choosing-what-your-workflow-does/store-information-in-variables |
| 36 | if os.Getenv("GITHUB_ACTIONS") == "true" { |
| 37 | return GitHub |
| 38 | } |
| 39 | // https://docs.gitlab.com/ci/variables/predefined_variables/ |
| 40 | if os.Getenv("GITLAB_CI") == "true" { |
| 41 | return GitLab |
| 42 | } |
| 43 | // https://support.atlassian.com/bitbucket-cloud/docs/variables-and-secrets/ |
| 44 | if os.Getenv("BITBUCKET_BUILD_NUMBER") != "" { |
| 45 | return Bitbucket |
| 46 | } |
| 47 | // https://learn.microsoft.com/en-us/azure/devops/pipelines/release/variables?view=azure-devops |
| 48 | if os.Getenv("SYSTEM_TEAMFOUNDATIONSERVERURI") != "" { |
| 49 | return AzureDevOps |
| 50 | } |
| 51 | return LocalPlatform |
| 52 | } |