@@ -11,11 +11,15 @@ class HarnessEnvEnum(str, Enum):
1111 HARNESS_BUILD_ID = "HARNESS_BUILD_ID"
1212 CI_BUILD_LINK = "CI_BUILD_LINK"
1313 CI_BUILD_NUMBER = "CI_BUILD_NUMBER"
14+ CI_REMOTE_URL = "CI_REMOTE_URL"
1415 CI_REPO = "CI_REPO"
15- DRONE = "DRONE"
16+ CI_REPO_LINK = "CI_REPO_LINK"
17+ CI_REPO_REMOTE = "CI_REPO_REMOTE"
1618 DRONE_COMMIT_BRANCH = "DRONE_COMMIT_BRANCH"
1719 DRONE_COMMIT_SHA = "DRONE_COMMIT_SHA"
1820 DRONE_PULL_REQUEST = "DRONE_PULL_REQUEST"
21+ DRONE_GIT_HTTP_URL = "DRONE_GIT_HTTP_URL"
22+ DRONE_REMOTE_URL = "DRONE_REMOTE_URL"
1923
2024class TestHarnessCI (object ):
2125 @pytest .mark .parametrize (
@@ -93,8 +97,51 @@ def test_build_url(self, env_dict, expected, mocker):
9397 @pytest .mark .parametrize (
9498 "env_dict,expected" ,
9599 [
100+ < << << << HEAD :tests / ci_adapters / test_harnessci .py
96101 ({}, None ),
97102 ({HarnessEnvEnum .CI_REPO : "repo" }, "repo" ),
103+ == == == =
104+ ({}, None ),
105+ ({HarnessEnvEnum .CI_REPO : "owner/repo" }, "owner/repo" ),
106+ ({HarnessEnvEnum .CI_REPO : "repo" }, None ),
107+ (
108+ {
109+ HarnessEnvEnum .CI_REPO_REMOTE : "https://gitlab.com/mygroup/myrepo.git" ,
110+ },
111+ "mygroup/myrepo" ,
112+ ),
113+ (
114+ {
115+ HarnessEnvEnum .CI_REMOTE_URL : "https://github.com/from-remote-url/from-remote-url" ,
116+ },
117+ "from-remote-url/from-remote-url" ,
118+ ),
119+ (
120+ {
121+ HarnessEnvEnum .CI_REPO_LINK : "https://github.com/from-repo-link/from-repo-link" ,
122+ },
123+ "from-repo-link/from-repo-link" ,
124+ ),
125+ (
126+ {
127+ HarnessEnvEnum .DRONE_GIT_HTTP_URL : "https://github.com/myorg/myrepo.git" ,
128+ },
129+ "myorg/myrepo" ,
130+ ),
131+ (
132+ {
133+ HarnessEnvEnum .DRONE_REMOTE_URL : "git@github.com:acme/coverage.git" ,
134+ },
135+ "acme/coverage" ,
136+ ),
137+ (
138+ {
139+ HarnessEnvEnum .CI_REPO_REMOTE : "https://github.com/first/first.git" ,
140+ HarnessEnvEnum .DRONE_GIT_HTTP_URL : "https://github.com/second/second.git" ,
141+ },
142+ "first/first" ,
143+ ),
144+ >> >> >> > da0fd08 (fix : Fix harness ci slug parsing ):codecov - cli / tests / ci_adapters / test_harnessci .py
98145 ],
99146 )
100147 def test_slug (self , env_dict , expected , mocker ):
0 commit comments