From d50313a6174b3e037d36eaea1a59398d98dd5d5f Mon Sep 17 00:00:00 2001 From: Manan Gupta Date: Tue, 23 Jul 2024 13:55:13 +0530 Subject: [PATCH] feat: add the workflow generation changes to make the debug mode work in CI Signed-off-by: Manan Gupta --- .../workflows/cluster_endtoend_vtgate_transaction.yml | 2 +- test.go | 4 ++++ test/ci_workflow_gen.go | 10 ++++++++-- test/templates/cluster_endtoend_test.tpl | 2 +- 4 files changed, 14 insertions(+), 4 deletions(-) diff --git a/.github/workflows/cluster_endtoend_vtgate_transaction.yml b/.github/workflows/cluster_endtoend_vtgate_transaction.yml index 41a84f42d3f..85cf22efcc1 100644 --- a/.github/workflows/cluster_endtoend_vtgate_transaction.yml +++ b/.github/workflows/cluster_endtoend_vtgate_transaction.yml @@ -136,7 +136,7 @@ jobs: set -exo pipefail # run the tests however you normally do, then produce a JUnit XML file - eatmydata -- go run test.go -docker=false -follow -shard vtgate_transaction | tee -a output.txt | go-junit-report -set-exit-code > report.xml + eatmydata -- go run test.go -docker=false -follow -shard vtgate_transaction -build-tag=debug2PC | tee -a output.txt | go-junit-report -set-exit-code > report.xml - name: Print test output and Record test result in launchable if PR is not a draft if: steps.skip-workflow.outputs.skip-workflow == 'false' && steps.changes.outputs.end_to_end == 'true' && always() diff --git a/test.go b/test.go index 74438cbb504..360b231e889 100755 --- a/test.go +++ b/test.go @@ -98,6 +98,7 @@ var ( dryRun = flag.Bool("dry-run", false, "For each test to be run, it will output the test attributes, but NOT run the tests. Useful while debugging changes to test.go (this file)") remoteStats = flag.String("remote-stats", "", "url to send remote stats") buildVTAdmin = flag.Bool("build-vtadmin", false, "Enable or disable VTAdmin build during 'make build'") + buildTag = flag.String("build-tag", "", "Build tag to create a custom debug build") ) var ( @@ -433,6 +434,9 @@ func main() { if !*buildVTAdmin { command.Env = append(os.Environ(), "NOVTADMINBUILD=1") } + if *buildTag != "" { + command.Env = append(command.Env, fmt.Sprintf(`EXTRA_BUILD_TAGS=%s`, *buildTag)) + } if out, err := command.CombinedOutput(); err != nil { log.Fatalf("make build failed; exit code: %d, error: %v\n%s", command.ProcessState.ExitCode(), err, out) diff --git a/test/ci_workflow_gen.go b/test/ci_workflow_gen.go index 9ead7f07963..7ad71b84040 100644 --- a/test/ci_workflow_gen.go +++ b/test/ci_workflow_gen.go @@ -122,6 +122,10 @@ var ( "vttablet_prscomplex", } + buildTag = map[string]string{ + "vtgate_transaction": "debug2PC", + } + vitessTesterMap = map[string]string{ "vtgate": "./go/test/endtoend/vtgate/vitess_tester", } @@ -158,6 +162,7 @@ type unitTest struct { type clusterTest struct { Name, Shard, Platform string FileName string + BuildTag string MemoryCheck bool MakeTools, InstallXtraBackup bool Docker bool @@ -245,8 +250,9 @@ func generateClusterWorkflows(list []string, tpl string) { for _, cluster := range clusters { for _, mysqlVersion := range clusterMySQLVersions() { test := &clusterTest{ - Name: fmt.Sprintf("Cluster (%s)", cluster), - Shard: cluster, + Name: fmt.Sprintf("Cluster (%s)", cluster), + Shard: cluster, + BuildTag: buildTag[cluster], } cores16Clusters := canonnizeList(clusterRequiring16CoresMachines) for _, cores16Cluster := range cores16Clusters { diff --git a/test/templates/cluster_endtoend_test.tpl b/test/templates/cluster_endtoend_test.tpl index 46078cfcc0c..78a1a4616d0 100644 --- a/test/templates/cluster_endtoend_test.tpl +++ b/test/templates/cluster_endtoend_test.tpl @@ -207,7 +207,7 @@ jobs: {{end}} # run the tests however you normally do, then produce a JUnit XML file - eatmydata -- go run test.go -docker={{if .Docker}}true -flavor={{.Platform}}{{else}}false{{end}} -follow -shard {{.Shard}}{{if .PartialKeyspace}} -partial-keyspace=true {{end}} | tee -a output.txt | go-junit-report -set-exit-code > report.xml + eatmydata -- go run test.go -docker={{if .Docker}}true -flavor={{.Platform}}{{else}}false{{end}} -follow -shard {{.Shard}}{{if .PartialKeyspace}} -partial-keyspace=true {{end}}{{if .BuildTag}} -build-tag={{.BuildTag}} {{end}} | tee -a output.txt | go-junit-report -set-exit-code > report.xml - name: Print test output and Record test result in launchable if PR is not a draft if: steps.skip-workflow.outputs.skip-workflow == 'false' && steps.changes.outputs.end_to_end == 'true' && always()