mirror of
https://github.com/netbirdio/netbird.git
synced 2026-04-20 01:06:45 +00:00
Fix username validation and skip ci tests properly
This commit is contained in:
@@ -744,16 +744,17 @@ func getTestUsername(t *testing.T) string {
|
||||
|
||||
// isCI checks if we're running in a CI environment
|
||||
func isCI() bool {
|
||||
ciEnvVars := []string{
|
||||
"CI", "CONTINUOUS_INTEGRATION", "GITHUB_ACTIONS",
|
||||
"GITLAB_CI", "JENKINS_URL", "BUILDKITE", "CIRCLECI",
|
||||
// Check standard CI environment variables
|
||||
if os.Getenv("GITHUB_ACTIONS") == "true" || os.Getenv("CI") == "true" {
|
||||
return true
|
||||
}
|
||||
|
||||
for _, envVar := range ciEnvVars {
|
||||
if os.Getenv(envVar) != "" {
|
||||
return true
|
||||
}
|
||||
// Check for GitHub Actions runner hostname pattern (when running as SYSTEM)
|
||||
hostname, err := os.Hostname()
|
||||
if err == nil && strings.HasPrefix(hostname, "runner") {
|
||||
return true
|
||||
}
|
||||
|
||||
return false
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user