66 "log"
77 "os/exec"
88 "regexp"
9- "strconv"
109 "time"
1110)
1211
@@ -17,13 +16,13 @@ func IsPipelineLink(url string) bool {
1716}
1817
1918// ExtractBuildID extracts the build ID from a pipeline URL
20- func ExtractBuildID (url string ) ( int , error ) {
19+ func ExtractBuildID (url string ) string {
2120 buildIDRegex := regexp .MustCompile (`buildId=(\d+)` )
2221 matches := buildIDRegex .FindStringSubmatch (url )
2322 if len (matches ) < 2 {
24- return 0 , fmt . Errorf ( "could not extract buildId from URL: %s" , url )
23+ return ""
2524 }
26- return strconv . Atoi ( matches [1 ])
25+ return matches [1 ]
2726}
2827
2928// AnalyzePipeline calls the azsdk CLI tool to analyze a pipeline
@@ -38,8 +37,15 @@ func AnalyzePipeline(pipelineURL string, query string, useAgent bool) (string, e
3837 log .Printf ("AnalyzePipeline completed in %v" , elapsed )
3938 }()
4039
40+ // Extract build ID from URL if it's a full URL
41+ buildID := ExtractBuildID (pipelineURL )
42+ if buildID == "" {
43+ return "" , fmt .Errorf ("invalid pipeline URL: %s" , pipelineURL )
44+ }
45+ log .Printf ("Extracted build ID %s from URL: %s" , buildID , pipelineURL )
46+
4147 // Build the command arguments
42- args := []string {"azp" , "analyze" , pipelineURL }
48+ args := []string {"azp" , "analyze" , buildID }
4349
4450 if query != "" {
4551 args = append (args , "--query" , query )
0 commit comments