Skip to content

Commit

Permalink
Change bisect launcher for error bisecting
Browse files Browse the repository at this point in the history
  • Loading branch information
MaXal committed Jan 8, 2025
1 parent 351dec7 commit 6eb291f
Show file tree
Hide file tree
Showing 3 changed files with 107 additions and 69 deletions.
109 changes: 58 additions & 51 deletions dashboard/new-dashboard/src/components/bisect/BisectLauncher.vue
Original file line number Diff line number Diff line change
Expand Up @@ -7,49 +7,63 @@
</template>
<template #content>
<div class="flex flex-col space-y-8 mb-4 mt-6">
<div class="flex">
<FloatLabel>
<InputText
id="changes"
v-model="model.firstCommit"
/>
<label for="changes">First commit</label>
</FloatLabel>
<FloatLabel>
<InputText
id="changes"
v-model="model.lastCommit"
/>
<label for="changes">Last commit</label>
</FloatLabel>
<div class="grid grid-cols-4 gap-4">
<div class="col-span-4 mb-2">
<FloatLabel class="w-full">
<InputText
id="errorMessage"
v-model="model.errorMessage"
class="w-full"
/>
<label for="errorMessage">Error message to look in log</label>
</FloatLabel>
</div>
<div class="col-span-2">
<FloatLabel class="w-full">
<InputText
id="firstCommit"
v-model="model.firstCommit"
class="w-full"
/>
<label for="firstCommit">First commit</label>
</FloatLabel>
</div>
<div class="col-span-2">
<FloatLabel class="w-full">
<InputText
id="lastCommit"
v-model="model.lastCommit"
class="w-full"
/>
<label for="lastCommit">Last commit</label>
</FloatLabel>
</div>
</div>
<Accordion :value="shouldExpandAccordion ? 0 : -1">
<AccordionPanel :value="0">
<AccordionHeader>Additional parameters</AccordionHeader>
<AccordionContent>
<div class="flex flex-col space-y-8 mb-4 mt-4">
<FloatLabel>
<InputText
id="test"
v-model="model.test"
/>
<label for="test">Test name</label>
</FloatLabel>
<FloatLabel>
<InputText
id="buildType"
v-model="model.buildType"
/>
<label for="buildType">Build type</label>
</FloatLabel>

<FloatLabel>
<InputText
id="className"
v-model="model.className"
/>
<label for="className">Class name</label>
</FloatLabel>
<div class="grid grid-cols-4 gap-4 mt-2">
<div class="col-span-4">
<FloatLabel class="w-full">
<InputText
id="buildType"
v-model="model.buildType"
class="w-full"
/>
<label for="buildType">Build type</label>
</FloatLabel>
</div>
<div class="col-span-4 mt-2">
<FloatLabel class="w-full">
<InputText
id="className"
v-model="model.className"
class="w-full"
/>
<label for="className">Class name</label>
</FloatLabel>
</div>
</div>
</AccordionContent>
</AccordionPanel>
Expand Down Expand Up @@ -87,14 +101,14 @@ const props = withDefaults(
defineProps<{
firstCommit?: string
lastCommit?: string
test?: string
errorMessage?: string
buildType?: string
className?: string
}>(),
{
firstCommit: "",
lastCommit: "",
test: "",
errorMessage: "",
buildType: "",
className: "",
}
Expand All @@ -103,20 +117,13 @@ const props = withDefaults(
const model = reactive({
firstCommit: props.firstCommit,
lastCommit: props.lastCommit,
test: props.test,
errorMessage: props.errorMessage,
buildType: props.buildType,
className: props.className,
})
const shouldExpandAccordion = computed(() => props.test == "" || props.buildType == "" || props.className == "")
const anyFieldIsEmpty = computed(
() =>
model.firstCommit.trim() == "" ||
model.lastCommit.trim() == "" ||
model.test.trim() == "" ||
model.buildType.trim() == "" ||
model.className.trim() == ""
)
const shouldExpandAccordion = computed(() => props.buildType == "" || props.className == "")
const anyFieldIsEmpty = computed(() => model.firstCommit.trim() == "" || model.lastCommit.trim() == "" || model.errorMessage.trim() == "" || model.buildType.trim() == "")
const error = ref<string | null>(null)
const loading = ref(false)
Expand All @@ -129,7 +136,7 @@ async function startBisect() {
try {
const weburl = await bisectClient.sendBisectRequest({
changes: model.firstCommit + "^.." + model.lastCommit,
test: model.test,
errorMessage: model.errorMessage,
buildType: model.buildType,
className: model.className,
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import { ServerConfigurator } from "../dataQuery"

interface BisectRequest {
changes: string
test: string
buildType: string
className: string
}
Expand All @@ -11,6 +10,11 @@ interface PerformanceBisectRequest extends BisectRequest {
targetValue: string
direction: string
metric: string
test: string
}

interface FunctionalBisectRequest extends BisectRequest {
errorMessage: string
}

export class BisectClient {
Expand All @@ -20,7 +24,7 @@ export class BisectClient {
this.serverConfigurator = serverConfigurator
}

async sendBisectRequest(request: PerformanceBisectRequest | BisectRequest): Promise<string> {
async sendBisectRequest(request: PerformanceBisectRequest | FunctionalBisectRequest): Promise<string> {
const url = `${this.serverConfigurator?.serverUrl}/api/meta/teamcity/startBisect`
const response = await fetch(url, {
method: "POST",
Expand Down
59 changes: 43 additions & 16 deletions pkg/server/meta/teamcity.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,41 @@ import (
)

type BisectRequest struct {
TargetValue string `json:"targetValue"`
Changes string `json:"changes"`
Direction string `json:"direction"`
Test string `json:"test"`
Metric string `json:"metric"`
BuildType string `json:"buildType"`
ClassName string `json:"className"`
TargetValue string `json:"targetValue"`
Changes string `json:"changes"`
Direction string `json:"direction"`
Test string `json:"test"`
Metric string `json:"metric"`
BuildType string `json:"buildType"`
ClassName string `json:"className"`
ErrorMessage string `json:"errorMessage"`
}

// https://youtrack.jetbrains.com/articles/IJPL-A-201/Bisecting-integration-tests-on-TC
func generateParamsForPerfRun(bisectReq BisectRequest) map[string]string {
return map[string]string{
"target.bisect.direction": bisectReq.Direction,
"target.bisected.metric": bisectReq.Metric,
"target.bisected.simple.class": bisectReq.ClassName,
"target.bisected.test": bisectReq.Test,
"target.configuration.id": bisectReq.BuildType,
"target.git.commits": bisectReq.Changes,
"target.value.before.changed.point": bisectReq.TargetValue,
"target.perf.messages.mode": "yes",
"target.is.bisect.run": "true",
}
}

// https://youtrack.jetbrains.com/articles/IJPL-A-201/Bisecting-integration-tests-on-TC
func generateParamsForFunctionalRun(bisectReq BisectRequest) map[string]string {
return map[string]string{
"target.bisected.simple.class": bisectReq.ClassName,
"target.configuration.id": bisectReq.BuildType,
"target.git.commits": bisectReq.Changes,
"env.BISECT_FUNCTIONAL_FAILURE_MESSAGE": bisectReq.ErrorMessage,
"target.perf.messages.mode": "no",
"target.is.bisect.run": "true",
}
}

func CreatePostStartBisect() http.HandlerFunc {
Expand All @@ -26,15 +54,14 @@ func CreatePostStartBisect() http.HandlerFunc {
return
}

weburlPtr, err := teamCityClient.startBuild(request.Context(), "ijplatform_master_BisectChangeset", map[string]string{
"target.bisect.direction": bisectReq.Direction,
"target.bisected.metric": bisectReq.Metric,
"target.bisected.simple.class": bisectReq.ClassName,
"target.bisected.test": bisectReq.Test,
"target.configuration.id": bisectReq.BuildType,
"target.git.commits": bisectReq.Changes,
"target.value.before.changed.point": bisectReq.TargetValue,
})
var buildParams map[string]string
if bisectReq.ErrorMessage != "" {
buildParams = generateParamsForFunctionalRun(bisectReq)
} else {
buildParams = generateParamsForPerfRun(bisectReq)
}

weburlPtr, err := teamCityClient.startBuild(request.Context(), "ijplatform_master_BisectChangeset", buildParams)
if err != nil {
http.Error(writer, "Failed to start bisect: "+err.Error(), http.StatusInternalServerError)
return
Expand Down

0 comments on commit 6eb291f

Please sign in to comment.