Skip to content

Commit f86eb6e

Browse files
emrzvMaXal
authored andcommitted
AT-3390 Support target.jps.compile in bisect launcher
1 parent 4d903a9 commit f86eb6e

File tree

6 files changed

+104
-0
lines changed

6 files changed

+104
-0
lines changed

dashboard/new-dashboard/src/components/bisect/BisectLauncher.vue

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,18 @@
107107
<label for="buildType">Build type</label>
108108
</FloatLabel>
109109
</div>
110+
<div class="flex items-center mb-4 mt-4">
111+
<Checkbox
112+
id="targetJpsCompile"
113+
v-model="model.targetJpsCompile"
114+
binary
115+
/>
116+
<label
117+
for="targetJpsCompile"
118+
class="ml-2"
119+
>JPS compilation
120+
</label>
121+
</div>
110122
</AccordionContent>
111123
</AccordionPanel>
112124
</Accordion>
@@ -161,6 +173,7 @@ const model = reactive({
161173
excludedCommits: "",
162174
buildId,
163175
className,
176+
targetJpsCompile: false,
164177
})
165178
166179
const mode = ref("Build")
@@ -189,6 +202,7 @@ async function startBisect() {
189202
.map((commit) => commit.trim())
190203
.filter((commit) => commit !== "")
191204
.join(","),
205+
jpsCompilation: model.targetJpsCompile ? "true" : "false",
192206
})
193207
window.open(weburl, "_blank")
194208
} catch (error_) {
@@ -205,6 +219,15 @@ onMounted(async () => {
205219
model.firstCommit = changes.firstCommit
206220
model.lastCommit = changes.lastCommit
207221
model.buildType = await bisectClient.fetchBuildType(buildId)
222+
223+
const buildInfo = await bisectClient.fetchBuildInfo(buildId)
224+
if (buildInfo !== null) {
225+
const branch = buildInfo.branchName
226+
const dateStr = buildInfo.startDate.slice(0, 8)
227+
const buildDate = new Date(`${dateStr.slice(0, 4)}-${dateStr.slice(4, 6)}-${dateStr.slice(6, 8)}`)
228+
const cutoffDate = new Date("2025-10-19")
229+
model.targetJpsCompile = branch === "master" && buildDate <= cutoffDate
230+
} else model.targetJpsCompile = false
208231
} catch (e) {
209232
error.value = e instanceof Error ? e.message : "Failed to fetch TC info"
210233
} finally {

dashboard/new-dashboard/src/components/common/sideBar/BisectClient.ts

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ interface BisectRequest {
88
requester: string
99
mode: string
1010
excludedCommits: string
11+
jpsCompilation: string
1112
}
1213

1314
interface PerformanceBisectRequest extends BisectRequest {
@@ -26,6 +27,13 @@ interface CommitRevisions {
2627
lastCommit: string
2728
}
2829

30+
interface BuildInfo {
31+
buildTypeId: string
32+
number: string
33+
branchName: string
34+
startDate: string
35+
}
36+
2937
export class BisectClient {
3038
private readonly serverConfigurator: ServerConfigurator | null
3139

@@ -79,4 +87,19 @@ export class BisectClient {
7987
return { firstCommit: "", lastCommit: "" }
8088
}
8189
}
90+
91+
async fetchBuildInfo(buildId: string): Promise<BuildInfo | null> {
92+
try {
93+
const response = await fetch(`${this.serverConfigurator?.serverUrl}/api/meta/teamcity/buildInfo?buildId=${encodeURIComponent(buildId)}`)
94+
if (!response.ok) {
95+
const errorText = await response.text()
96+
console.log(`Failed to fetch build info: ${response.status} - ${errorText}`)
97+
return null
98+
}
99+
return (await response.json()) as BuildInfo
100+
} catch (error) {
101+
console.log("Error fetching TeamCity build info:", error)
102+
return null
103+
}
104+
}
82105
}

dashboard/new-dashboard/src/components/common/sideBar/BisectDialog.vue

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,18 @@
116116
<label for="buildType">Build type</label>
117117
</FloatLabel>
118118
</div>
119+
<div class="flex items-center mb-4 mt-4">
120+
<Checkbox
121+
id="targetJpsCompile"
122+
v-model="targetJpsCompile"
123+
binary
124+
/>
125+
<label
126+
for="targetJpsCompile"
127+
class="ml-2"
128+
>JPS compilation</label
129+
>
130+
</div>
119131
</AccordionContent>
120132
</AccordionPanel>
121133
</Accordion>
@@ -190,6 +202,7 @@ const fullClassName = methodName.slice(0, Math.max(0, methodName.lastIndexOf("#"
190202
const className = fullClassName.slice(fullClassName.lastIndexOf(".") + 1)
191203
const targetValue: Ref<string | null> = ref(null)
192204
const excludedCommits = ref("")
205+
const targetJpsCompile = ref(data.branch === "master" && new Date(data.date) <= new Date("2025-10-19"))
193206
194207
const firstCommit = ref()
195208
const lastCommit = ref()
@@ -241,6 +254,7 @@ async function startBisect() {
241254
.map((commit) => commit.trim())
242255
.filter((commit) => commit !== "")
243256
.join(","),
257+
jpsCompilation: targetJpsCompile.value ? "true" : "false",
244258
})
245259
showDialog.value = false // Close dialog on success
246260
window.open(weburl, "_blank")

pkg/server/meta/teamcity.go

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ type BisectRequest struct {
1818
ClassName string `json:"className"`
1919
ErrorMessage string `json:"errorMessage"`
2020
ExcludedCommits string `json:"excludedCommits"`
21+
JpsCompilation string `json:"jpsCompilation"`
2122
}
2223

2324
// https://youtrack.jetbrains.com/articles/IJPL-A-201/Bisecting-integration-tests-on-TC
@@ -36,6 +37,7 @@ func generateParamsForPerfRun(bisectReq BisectRequest) map[string]string {
3637
"target.perf.messages.mode": "yes",
3738
"target.is.bisect.run": "true",
3839
"target.commits.to.exclude": bisectReq.ExcludedCommits,
40+
"target.jps.compile": bisectReq.JpsCompilation,
3941
}
4042
}
4143

@@ -52,6 +54,7 @@ func generateParamsForFunctionalRun(bisectReq BisectRequest) map[string]string {
5254
"target.perf.messages.mode": "no",
5355
"target.is.bisect.run": "true",
5456
"target.commits.to.exclude": bisectReq.ExcludedCommits,
57+
"target.jps.compile": bisectReq.JpsCompilation,
5558
}
5659
}
5760

@@ -124,6 +127,29 @@ func HandleGetTeamCityBuildCounter() http.HandlerFunc {
124127
}
125128
}
126129

130+
func HandleGetTeamCityBuildInfo() http.HandlerFunc {
131+
return func(w http.ResponseWriter, r *http.Request) {
132+
buildID := r.URL.Query().Get("buildId")
133+
if buildID == "" {
134+
http.Error(w, "buildId parameter is required", http.StatusBadRequest)
135+
return
136+
}
137+
138+
buildInfo, err := teamCityClient.getBuildInfo(r.Context(), buildID)
139+
if err != nil {
140+
http.Error(w, err.Error(), http.StatusInternalServerError)
141+
return
142+
}
143+
144+
w.Header().Set("Content-Type", "application/json")
145+
err = json.NewEncoder(w).Encode(buildInfo)
146+
if err != nil {
147+
http.Error(w, err.Error(), http.StatusInternalServerError)
148+
return
149+
}
150+
}
151+
}
152+
127153
func CreatePostStartBisect() http.HandlerFunc {
128154
return func(writer http.ResponseWriter, request *http.Request) {
129155
var bisectReq BisectRequest

pkg/server/meta/teamcityClient.go

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,8 @@ type BuildResponse struct {
169169
type BuildInfo struct {
170170
BuildTypeId string `json:"buildTypeId"`
171171
Number string `json:"number"`
172+
BranchName string `json:"branchName"`
173+
StartDate string `json:"startDate"`
172174
}
173175

174176
type Change struct {
@@ -214,6 +216,21 @@ type CommitRevisions struct {
214216
LastCommit string `json:"lastCommit"`
215217
}
216218

219+
func (client *TeamCityClient) getBuildInfo(ctx context.Context, buildID string) (*BuildInfo, error) {
220+
res, err := client.makeRequest(ctx, "/app/rest/builds/id:"+buildID, map[string]string{"Accept": "application/json"})
221+
if err != nil {
222+
return nil, err
223+
}
224+
defer res.Body.Close()
225+
226+
var build BuildInfo
227+
if err := json.NewDecoder(res.Body).Decode(&build); err != nil {
228+
return nil, fmt.Errorf("failed to decode build info response: %w", err)
229+
}
230+
231+
return &build, nil
232+
}
233+
217234
func (client *TeamCityClient) getChanges(ctx context.Context, buildID string) (*CommitRevisions, error) {
218235
res, err := client.makeRequest(ctx, "/app/rest/changes?locator=build:(id:"+buildID+")&count=10000", map[string]string{"Accept": "application/json"})
219236
if err != nil {

pkg/server/server.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,7 @@ func Serve(dbUrl string, natsUrl string) error {
110110
r.Get("/changes", meta.HandleGetTeamCityChanges())
111111
r.Get("/buildType", meta.HandleGetTeamCityBuildType())
112112
r.Get("/buildCounter", meta.HandleGetTeamCityBuildCounter())
113+
r.Get("/buildInfo", meta.HandleGetTeamCityBuildInfo())
113114
})
114115
})
115116

0 commit comments

Comments
 (0)