@@ -39,13 +39,33 @@ import org.kohsuke.github.GHPermissionType
3939
4040import org.mbed.tls.jenkins.BranchInfo
4141
42- /* Indicates if CI is running on Open CI (hosted on https://mbedtls.trustedfirmware.org/) */
43- @Field final boolean is_open_ci_env = env. JENKINS_URL ==~ / \S +(mbedtls\. trustedfirmware\. org)\S +/
42+ enum CIEnv {
43+ TF_OPENCI_LEGACY (' TF OpenCI (legacy)' ),
44+ TF_OPENCI (' TF OpenCI' ),
45+ INTERNAL (' Internal CI' )
4446
45- /* Indicates if CI is running on the new CI (hosted on https://ci.trustedfirmware.org/) */
46- @Field final boolean is_new_ci_env = ! is_open_ci_env && (env. JENKINS_URL ==~ / \S +(trustedfirmware)\S +/ )
47+ final String name
48+ CIEnv (String name ) { this . name = name }
49+ }
50+
51+ /* * Determine the CI environment based on the Jenkins base URL. */
52+ static CIEnv ci_from_url (String jenkinsUrl ) {
53+ if (jenkinsUrl ==~ / \. arm\. com$/ ) {
54+ return CIEnv . INTERNAL
55+ }
56+ if (jenkinsUrl ==~ / \S *mbedtls\. trustedfirmware\. org\S */ ) {
57+ return CIEnv . TF_OPENCI_LEGACY
58+ }
59+ if (jenkinsUrl ==~ / \S *trustedfirmware\S */ ) {
60+ return CIEnv . TF_OPENCI
61+ }
62+ throw new AbortException (" Unknown CI environment for Jenkins URL: ${ jenkinsUrl} " )
63+ }
4764
48- @Field final String ci_name = is_open_ci_env ? ' TF OpenCI (legacy)' : is_new_ci_env ? ' TF OpenCI' : ' Internal CI'
65+ @Field final CIEnv ci_env = ci_from_url(env. JENKINS_URL )
66+ @Field final boolean is_open_ci_env = (ci_env == CIEnv . TF_OPENCI_LEGACY )
67+ @Field final boolean is_new_ci_env = (ci_env == CIEnv . TF_OPENCI )
68+ @Field final String ci_name = ci_env. name
4969
5070/*
5171 * This controls the timeout each job has. It does not count the time spent in
0 commit comments