From 48fd5ffd963580c80cb10f47ad15dc85f416df78 Mon Sep 17 00:00:00 2001 From: Tom Martensen Date: Fri, 13 Nov 2026 12:34:27 +0100 Subject: [PATCH 01/29] list-conforma-*: add --scenario flag for acs-conforma-prod-like Both commands accept --scenario (default acs-conforma-dev, alternatively acs-conforma-prod-like, only supported for the stackrox repository). The dev scenario keeps the pipelines-as-code discovery on the tag's commit. The prod-like scenario finds the custom snapshot for the tag, derives the versioned scenario name from the snapshot's application label and lists the conforma pipeline runs attached to the snapshot; the violations command applies the existing per-run logic to those runs. Unknown scenario values and prod-like for non-stackrox repositories error out. Co-Authored-By: Claude Code --- cmd/relacs/konflux/list_conforma_runs.go | 14 +- .../konflux/list_conforma_violations.go | 14 +- pkg/config/config.go | 6 +- pkg/konflux/conforma.go | 17 ++- pkg/konflux/conforma_runs.go | 55 +++++++- tests/konflux/conforma_violations_test.go | 122 +++++++++++++++++- 6 files changed, 208 insertions(+), 20 deletions(-) diff --git a/cmd/relacs/konflux/list_conforma_runs.go b/cmd/relacs/konflux/list_conforma_runs.go index 5e18245..bbcaf59 100644 --- a/cmd/relacs/konflux/list_conforma_runs.go +++ b/cmd/relacs/konflux/list_conforma_runs.go @@ -60,16 +60,19 @@ var listConformaRunsCmd = &cobra.Command{ Short: "List the conforma pipeline runs triggered by a given Git tag", Long: `List the conforma pipeline run results for a specific Git tag. -Only conforma runs triggered directly on the tag's commit (via -pipelines-as-code) are considered; the conforma run for the custom -snapshot is not included.`, - RunE: common.RunCommand(runListConformaRuns), +By default (scenario acs-conforma-dev), only conforma runs triggered +directly on the tag's commit (via pipelines-as-code) are considered. +With --scenario acs-conforma-prod-like (only supported for the +stackrox repository), the conforma runs attached to the tag's custom +snapshot are listed instead.`, + RunE: common.RunCommand(runListConformaRuns), } func init() { listConformaRunsCmd.Flags().String("org", config.GitHubOrganization, "GitHub organization (optional)") listConformaRunsCmd.Flags().String("repo", config.MainGitHubRepository, "GitHub repository (optional)") listConformaRunsCmd.Flags().String("tag", "", "Git tag (required)") + listConformaRunsCmd.Flags().String("scenario", konflux.ConformaScenarioDev, "Conforma scenario: "+konflux.ConformaScenarioDev+" or "+konflux.ConformaScenarioProdLike+" (the latter is only supported for the stackrox repository)") //nolint:errcheck listConformaRunsCmd.MarkFlagRequired("tag") @@ -80,8 +83,9 @@ func runListConformaRuns(cmd *cobra.Command, args []string, c *client.Client) (a org, _ := cmd.Flags().GetString("org") repo, _ := cmd.Flags().GetString("repo") tag, _ := cmd.Flags().GetString("tag") + scenario, _ := cmd.Flags().GetString("scenario") - entries, err := konflux.ListConformaRuns(ctx, c, org, repo, tag) + entries, err := konflux.ListConformaRuns(ctx, c, org, repo, tag, scenario) if err != nil { return nil, fmt.Errorf("failed to list conforma runs: %w", err) } diff --git a/cmd/relacs/konflux/list_conforma_violations.go b/cmd/relacs/konflux/list_conforma_violations.go index e017232..42e739d 100644 --- a/cmd/relacs/konflux/list_conforma_violations.go +++ b/cmd/relacs/konflux/list_conforma_violations.go @@ -51,16 +51,19 @@ var listConformaViolationsCmd = &cobra.Command{ Short: "List the Conforma violations for a given Git tag", Long: `Retrieve the Conforma violations reported by the conforma pipeline runs for a given Git tag. -Only conforma runs triggered directly on the tag's commit (via -pipelines-as-code) are considered; the conforma run for the custom -snapshot is not included.`, - RunE: common.RunCommand(runListConformaViolations), +By default (scenario acs-conforma-dev), only conforma runs triggered +directly on the tag's commit (via pipelines-as-code) are considered. +With --scenario acs-conforma-prod-like (only supported for the +stackrox repository), the violations of the conforma runs attached +to the tag's custom snapshot are listed instead.`, + RunE: common.RunCommand(runListConformaViolations), } func init() { listConformaViolationsCmd.Flags().String("org", config.GitHubOrganization, "GitHub organization (optional)") listConformaViolationsCmd.Flags().String("repo", config.MainGitHubRepository, "GitHub repository (optional)") listConformaViolationsCmd.Flags().String("tag", "", "Git tag (required)") + listConformaViolationsCmd.Flags().String("scenario", konflux.ConformaScenarioDev, "Conforma scenario: "+konflux.ConformaScenarioDev+" or "+konflux.ConformaScenarioProdLike+" (the latter is only supported for the stackrox repository)") //nolint:errcheck listConformaViolationsCmd.MarkFlagRequired("tag") @@ -72,8 +75,9 @@ func runListConformaViolations(cmd *cobra.Command, args []string, c *client.Clie org, _ := cmd.Flags().GetString("org") repo, _ := cmd.Flags().GetString("repo") tag, _ := cmd.Flags().GetString("tag") + scenario, _ := cmd.Flags().GetString("scenario") - result, err := konflux.ListConformaViolations(ctx, c, org, repo, tag) + result, err := konflux.ListConformaViolations(ctx, c, org, repo, tag, scenario) if err != nil { return nil, fmt.Errorf("failed to list conforma violations: %w", err) } diff --git a/pkg/config/config.go b/pkg/config/config.go index 453c643..698e41f 100644 --- a/pkg/config/config.go +++ b/pkg/config/config.go @@ -6,8 +6,10 @@ const ( KonfluxTenant = "rh-acs-tenant" KonfluxApplicationPrefix = "acs" KonfluxHost = "konflux-ui.apps.stone-prd-rh01.pg1f.p1.openshiftapps.com" - KubearchiveAPIURL = "https://kubearchive-api-server-product-kubearchive.apps.stone-prd-rh01.pg1f.p1.openshiftapps.com" - ImageTagSuffix = "fast" + KubearchiveAPIURL = "https://kubearchive-api-server-product-kubearchive.apps.stone-prd-rh01.pg1f.p1.openshiftapps.com" + ConformaDevScenarioPrefix = "acs-conforma-dev" + ConformaProdLikeScenarioName = "acs-conforma-prod-like" + ImageTagSuffix = "fast" IssueSource = "redhat.atlassian.net" JiraBaseURL = "https://redhat.atlassian.net" JiraProjectKey = "ROX" diff --git a/pkg/konflux/conforma.go b/pkg/konflux/conforma.go index 959874b..9141b64 100644 --- a/pkg/konflux/conforma.go +++ b/pkg/konflux/conforma.go @@ -41,15 +41,22 @@ type ConformaViolations struct { } // ListConformaViolations returns the violations reported by the conforma -// pipeline runs for the given tag. Runs that are still in progress are listed -// in InProgressRuns, and runs whose report could not be retrieved (e.g. they -// failed before the report step ran) in SkippedRuns. -func ListConformaViolations(ctx context.Context, c *client.Client, org, repo, tag string) (ConformaViolations, error) { - pipelineRuns, err := getConformaPipelineRuns(ctx, c, org, repo, tag) +// pipeline runs for the given tag and scenario. Runs that are still in +// progress are listed in InProgressRuns, and runs whose report could not be +// retrieved (e.g. they failed before the report step ran) in SkippedRuns. +func ListConformaViolations(ctx context.Context, c *client.Client, org, repo, tag, scenario string) (ConformaViolations, error) { + pipelineRuns, err := conformaPipelineRunsForScenario(ctx, c, org, repo, tag, scenario) if err != nil { return ConformaViolations{}, fmt.Errorf("failed to get conforma pipeline runs: %w", err) } + return violationsFromPipelineRuns(ctx, c, pipelineRuns, tag) +} + +// violationsFromPipelineRuns lists the violations reported by the given +// conforma pipeline runs, reading the report of the most recent run per +// component and scenario. +func violationsFromPipelineRuns(ctx context.Context, c *client.Client, pipelineRuns []kflx.PipelineRun, tag string) (ConformaViolations, error) { conformaRuns := latestPipelineRunPerComponentAndScenario(pipelineRuns) if len(conformaRuns) == 0 { return ConformaViolations{}, fmt.Errorf("no conforma pipeline runs found for tag %s", tag) diff --git a/pkg/konflux/conforma_runs.go b/pkg/konflux/conforma_runs.go index c05ee2b..7b3c0fa 100644 --- a/pkg/konflux/conforma_runs.go +++ b/pkg/konflux/conforma_runs.go @@ -8,10 +8,17 @@ import ( "github.com/stackrox/relacs/pkg/client" kflx "github.com/stackrox/relacs/pkg/client/konflux" + "github.com/stackrox/relacs/pkg/config" "github.com/stackrox/relacs/pkg/github" "github.com/stackrox/relacs/pkg/utils" ) +// Conforma scenarios selectable via the --scenario flag. +const ( + ConformaScenarioDev = config.ConformaDevScenarioPrefix + ConformaScenarioProdLike = config.ConformaProdLikeScenarioName +) + type ConformaRunEntry struct { Name string `json:"name" yaml:"name"` Component string `json:"component" yaml:"component"` @@ -20,8 +27,8 @@ type ConformaRunEntry struct { URL string `json:"url" yaml:"url"` } -func ListConformaRuns(ctx context.Context, c *client.Client, org, repo, tag string) ([]ConformaRunEntry, error) { - pipelineRuns, err := getConformaPipelineRuns(ctx, c, org, repo, tag) +func ListConformaRuns(ctx context.Context, c *client.Client, org, repo, tag, scenario string) ([]ConformaRunEntry, error) { + pipelineRuns, err := conformaPipelineRunsForScenario(ctx, c, org, repo, tag, scenario) if err != nil { return nil, err } @@ -38,6 +45,50 @@ func ListConformaRuns(ctx context.Context, c *client.Client, org, repo, tag stri return entries, nil } +// conformaPipelineRunsForScenario returns the conforma pipeline runs for the +// given tag and scenario. The dev scenario discovers runs triggered by +// pipelines-as-code on the tag's commit; the prod-like scenario returns the +// runs attached to the tag's custom snapshot and is only supported for the +// main repository. +func conformaPipelineRunsForScenario(ctx context.Context, c *client.Client, org, repo, tag, scenario string) ([]kflx.PipelineRun, error) { + switch scenario { + case ConformaScenarioDev: + return getConformaPipelineRuns(ctx, c, org, repo, tag) + case ConformaScenarioProdLike: + if repo != config.MainGitHubRepository { + return nil, fmt.Errorf("the %s scenario is only supported for the %s repository", ConformaScenarioProdLike, config.MainGitHubRepository) + } + return getProdLikeConformaRuns(ctx, c, org, repo, tag) + default: + return nil, fmt.Errorf("unknown conforma scenario %q, must be %s or %s", scenario, ConformaScenarioDev, ConformaScenarioProdLike) + } +} + +// getProdLikeConformaRuns returns the acs-conforma-prod-like pipeline runs +// attached to the custom snapshot for the given tag. +func getProdLikeConformaRuns(ctx context.Context, c *client.Client, org, repo, tag string) ([]kflx.PipelineRun, error) { + snapshot, err := GetCustomSnapshot(ctx, c, config.KonfluxApplicationPrefix, org, repo, tag) + if err != nil { + return nil, fmt.Errorf("failed to get custom snapshot: %w", err) + } + + application := snapshot.Metadata.Labels["appstudio.openshift.io/application"] + scenarioName, err := utils.Application{Name: application}.GetResourceWithVersion(config.ConformaProdLikeScenarioName) + if err != nil { + return nil, fmt.Errorf("failed to get conforma scenario name: %w", err) + } + + labels := []string{ + "appstudio.openshift.io/snapshot=" + snapshot.Metadata.Name, + "test.appstudio.openshift.io/scenario=" + scenarioName, + } + pipelineRuns, err := c.GetKonflux().GetPipelineRuns(ctx, labels) + if err != nil { + return nil, fmt.Errorf("failed to get pipeline runs: %w", err) + } + return pipelineRuns, nil +} + func getConformaPipelineRuns(ctx context.Context, c *client.Client, org, repo, tag string) ([]kflx.PipelineRun, error) { commitObj, err := github.GetCommitForTag(ctx, c, org, repo, tag) if err != nil { diff --git a/tests/konflux/conforma_violations_test.go b/tests/konflux/conforma_violations_test.go index b707e6d..67a04d1 100644 --- a/tests/konflux/conforma_violations_test.go +++ b/tests/konflux/conforma_violations_test.go @@ -104,7 +104,127 @@ func (s *ConformaViolationsTestSuite) mockConformaReportUnavailable(runName stri func (s *ConformaViolationsTestSuite) listConformaViolations() (relacskonflux.ConformaViolations, error) { testClient, err := helpers.SetupTestClient() s.Require().NoError(err) - return relacskonflux.ListConformaViolations(s.ctx, testClient, config.GitHubOrganization, config.MainGitHubRepository, conformaTestTag) + return relacskonflux.ListConformaViolations(s.ctx, testClient, config.GitHubOrganization, config.MainGitHubRepository, conformaTestTag, relacskonflux.ConformaScenarioDev) +} + +// mockProdLikeCustomSnapshot mocks the custom snapshot for the test tag and +// returns its name. The snapshot's application label is versioned, from which +// the versioned prod-like scenario name is derived. +func (s *ConformaViolationsTestSuite) mockProdLikeCustomSnapshot() string { + helpers.MockLightweightTag(config.GitHubOrganization, config.MainGitHubRepository, conformaTestTag, conformaTestSHA) + + labels := strings.Join([]string{ + "pac.test.appstudio.openshift.io/url-org=" + config.GitHubOrganization, + "pac.test.appstudio.openshift.io/url-repository=" + config.MainGitHubRepository, + "pac.test.appstudio.openshift.io/sha=" + conformaTestSHA, + "acs-style-snapshot=true", + "acs-product-version=" + conformaTestTag, + "appstudio.openshift.io/application=acs-4-10", + }, ",") + + helpers.MockK8sSnapshots(labels, map[string]interface{}{ + "items": []map[string]interface{}{ + { + "metadata": map[string]interface{}{ + "name": "acs-4-10-custom-snapshot", + "uid": "uid-snapshot", + "creationTimestamp": "2025-01-01T00:00:00Z", + "labels": map[string]interface{}{ + "appstudio.openshift.io/application": "acs-4-10", + }, + }, + }, + }, + }) + helpers.MockQueryResourcesEmpty(config.KubearchiveAPIURL, "appstudio.redhat.com", "v1alpha1", "snapshots", config.KonfluxTenant) + return "acs-4-10-custom-snapshot" +} + +// mockProdLikeConformaRuns mocks the prod-like conforma pipeline runs attached +// to the given custom snapshot. +func (s *ConformaViolationsTestSuite) mockProdLikeConformaRuns(snapshotName string, runs ...map[string]interface{}) { + labels := strings.Join([]string{ + "appstudio.openshift.io/snapshot=" + snapshotName, + "test.appstudio.openshift.io/scenario=acs-conforma-prod-like-4-10", + }, ",") + + helpers.MockK8sPipelineRuns(labels, map[string]interface{}{ + "items": runs, + }) + helpers.MockQueryResourcesEmpty(config.KubearchiveAPIURL, "tekton.dev", "v1", "pipelineruns", config.KonfluxTenant) +} + +func (s *ConformaViolationsTestSuite) prodLikeConformaPipelineRun(name, uid, component string, conditions []map[string]interface{}) map[string]interface{} { + return map[string]interface{}{ + "metadata": map[string]interface{}{ + "name": name, + "uid": uid, + "creationTimestamp": "2025-01-01T00:00:00Z", + "labels": map[string]interface{}{ + "appstudio.openshift.io/component": component, + "test.appstudio.openshift.io/scenario": "acs-conforma-prod-like-4-10", + }, + }, + "status": map[string]interface{}{ + "conditions": conditions, + }, + } +} + +func (s *ConformaViolationsTestSuite) listConformaViolationsForScenario(repo, scenario string) (relacskonflux.ConformaViolations, error) { + testClient, err := helpers.SetupTestClient() + s.Require().NoError(err) + return relacskonflux.ListConformaViolations(s.ctx, testClient, config.GitHubOrganization, repo, conformaTestTag, scenario) +} + +func (s *ConformaViolationsTestSuite) TestListConformaViolations_ProdLike() { + snapshotName := s.mockProdLikeCustomSnapshot() + run := s.prodLikeConformaPipelineRun("acs-conforma-prod-like-4-10-abc12", "uid-prod-like", "main-4-10", s.succeededConditions()) + s.mockProdLikeConformaRuns(snapshotName, run) + s.mockConformaReport("acs-conforma-prod-like-4-10-abc12") + + result, err := s.listConformaViolationsForScenario(config.MainGitHubRepository, relacskonflux.ConformaScenarioProdLike) + + s.Require().NoError(err) + s.Len(result.Violations.Violations, 1) + s.Equal("violation one", result.Violations.Violations[0].Violation) + s.Empty(result.SkippedRuns) + s.Empty(result.InProgressRuns) + s.True(gock.IsDone()) +} + +func (s *ConformaViolationsTestSuite) TestListConformaViolations_ProdLikeNonMainRepo() { + _, err := s.listConformaViolationsForScenario("collector", relacskonflux.ConformaScenarioProdLike) + + s.Require().Error(err) + s.Contains(err.Error(), "only supported for the stackrox repository") + s.True(gock.IsDone()) +} + +func (s *ConformaViolationsTestSuite) TestListConformaViolations_UnknownScenario() { + _, err := s.listConformaViolationsForScenario(config.MainGitHubRepository, "acs-conforma-other") + + s.Require().Error(err) + s.Contains(err.Error(), "unknown conforma scenario") + s.True(gock.IsDone()) +} + +func (s *ConformaViolationsTestSuite) TestListConformaRuns_ProdLike() { + snapshotName := s.mockProdLikeCustomSnapshot() + run := s.prodLikeConformaPipelineRun("acs-conforma-prod-like-4-10-abc12", "uid-prod-like", "main-4-10", s.succeededConditions()) + s.mockProdLikeConformaRuns(snapshotName, run) + + testClient, err := helpers.SetupTestClient() + s.Require().NoError(err) + entries, err := relacskonflux.ListConformaRuns(s.ctx, testClient, config.GitHubOrganization, config.MainGitHubRepository, conformaTestTag, relacskonflux.ConformaScenarioProdLike) + + s.Require().NoError(err) + s.Require().Len(entries, 1) + s.Equal("acs-conforma-prod-like-4-10-abc12", entries[0].Name) + s.Equal("main-4-10", entries[0].Component) + s.Equal("acs-conforma-prod-like-4-10", entries[0].Scenario) + s.Equal("Succeeded", entries[0].Status) + s.True(gock.IsDone()) } func (s *ConformaViolationsTestSuite) TestListConformaViolations_InProgress() { From 80a0887eca1808b8caef861967ee52e6d0b0dff7 Mon Sep 17 00:00:00 2001 From: Tom Martensen Date: Tue, 3 Nov 2026 11:37:15 +0100 Subject: [PATCH 02/29] add relacs serve command with tag page Adds a local HTTP server (relacs serve) that presents release information as web pages. The tag page at /tag?tag= shows pipeline runs, artifacts, conforma violations, and the operator index image fetched live from Konflux. Co-Authored-By: Claude Opus 4.6 --- cmd/relacs/main.go | 2 + cmd/relacs/serve/cmd.go | 95 +++++++ cmd/relacs/serve/handlers.go | 43 +++ cmd/relacs/serve/templates/base.html | 17 ++ cmd/relacs/serve/templates/home.html | 26 ++ cmd/relacs/serve/templates/static/style.css | 108 ++++++++ cmd/relacs/serve/templates/tag.html | 189 +++++++++++++ pkg/serve/tag.go | 288 ++++++++++++++++++++ 8 files changed, 768 insertions(+) create mode 100644 cmd/relacs/serve/cmd.go create mode 100644 cmd/relacs/serve/handlers.go create mode 100644 cmd/relacs/serve/templates/base.html create mode 100644 cmd/relacs/serve/templates/home.html create mode 100644 cmd/relacs/serve/templates/static/style.css create mode 100644 cmd/relacs/serve/templates/tag.html create mode 100644 pkg/serve/tag.go diff --git a/cmd/relacs/main.go b/cmd/relacs/main.go index 5c9763a..5986e0c 100644 --- a/cmd/relacs/main.go +++ b/cmd/relacs/main.go @@ -10,6 +10,7 @@ import ( "github.com/spf13/cobra" "github.com/stackrox/relacs/cmd/relacs/github" "github.com/stackrox/relacs/cmd/relacs/konflux" + "github.com/stackrox/relacs/cmd/relacs/serve" "github.com/stackrox/relacs/cmd/relacs/version" "github.com/stackrox/relacs/pkg/versioncheck" ) @@ -46,6 +47,7 @@ func main() { rootCmd.AddCommand(version.VersionCmd) rootCmd.AddCommand(github.GitHubCmd) rootCmd.AddCommand(konflux.KonfluxCmd) + rootCmd.AddCommand(serve.ServeCmd) // Execute root command ctx, stop := signal.NotifyContext(context.Background(), os.Interrupt, syscall.SIGTERM) diff --git a/cmd/relacs/serve/cmd.go b/cmd/relacs/serve/cmd.go new file mode 100644 index 0000000..5537595 --- /dev/null +++ b/cmd/relacs/serve/cmd.go @@ -0,0 +1,95 @@ +package serve + +import ( + "context" + "embed" + "fmt" + "html/template" + "io/fs" + "log" + "net" + "net/http" + "time" + + "github.com/spf13/cobra" + "github.com/stackrox/relacs/pkg/client" +) + +//go:embed templates/* +var templateFS embed.FS + +var ( + homeTmpl *template.Template + tagTmpl *template.Template +) + +var port string + +var ServeCmd = &cobra.Command{ + Use: "serve", + Short: "Start a local web server showing release information", + Long: `Starts a local HTTP server that serves release information as web pages`, + RunE: runServe, +} + +func init() { + ServeCmd.Flags().StringVar(&port, "port", "8080", "Port to listen on") +} + +func parsePageTemplate(files ...string) (*template.Template, error) { + return template.ParseFS(templateFS, files...) +} + +func runServe(cmd *cobra.Command, args []string) error { + var err error + homeTmpl, err = parsePageTemplate("templates/base.html", "templates/home.html") + if err != nil { + return fmt.Errorf("failed to parse home template: %w", err) + } + tagTmpl, err = parsePageTemplate("templates/base.html", "templates/tag.html") + if err != nil { + return fmt.Errorf("failed to parse tag template: %w", err) + } + + c, err := client.NewClient() + if err != nil { + return fmt.Errorf("failed to create client: %w", err) + } + + staticFS, err := fs.Sub(templateFS, "templates/static") + if err != nil { + return fmt.Errorf("failed to create static file system: %w", err) + } + + mux := http.NewServeMux() + mux.Handle("GET /static/", http.StripPrefix("/static/", http.FileServer(http.FS(staticFS)))) + mux.HandleFunc("GET /{$}", handleHome()) + mux.HandleFunc("GET /tag", handleTag(c)) + + addr := net.JoinHostPort("localhost", port) + server := &http.Server{ + Addr: addr, + Handler: mux, + ReadHeaderTimeout: 10 * time.Second, + } + + ctx := cmd.Context() + shutdownDone := make(chan struct{}) + go func() { + defer close(shutdownDone) + <-ctx.Done() + shutdownCtx, cancel := context.WithTimeout(context.Background(), 30*time.Second) + defer cancel() + if err := server.Shutdown(shutdownCtx); err != nil { + log.Printf("Server shutdown error: %v", err) + } + }() + + log.Printf("Server listening on http://%s", addr) + err = server.ListenAndServe() + if err == http.ErrServerClosed { + <-shutdownDone + return nil + } + return err +} diff --git a/cmd/relacs/serve/handlers.go b/cmd/relacs/serve/handlers.go new file mode 100644 index 0000000..736df0d --- /dev/null +++ b/cmd/relacs/serve/handlers.go @@ -0,0 +1,43 @@ +package serve + +import ( + "bytes" + "html/template" + "log" + "net/http" + + "github.com/stackrox/relacs/pkg/client" + "github.com/stackrox/relacs/pkg/serve" +) + +func renderTemplate(w http.ResponseWriter, tmpl *template.Template, data any) { + var buf bytes.Buffer + // Start rendering from the outermost template; it pulls in child-defined blocks. + if err := tmpl.ExecuteTemplate(&buf, "base.html", data); err != nil { + http.Error(w, err.Error(), http.StatusInternalServerError) + return + } + _, err := buf.WriteTo(w) + if err != nil { + log.Printf("Failed to write template to response: %v", err) + } +} + +func handleHome() http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + renderTemplate(w, homeTmpl, nil) + } +} + +func handleTag(c *client.Client) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + tag := r.URL.Query().Get("tag") + if tag == "" { + http.Error(w, "Missing required query parameter: tag", http.StatusBadRequest) + return + } + + data := serve.FetchTagData(r.Context(), c, tag) + renderTemplate(w, tagTmpl, data) + } +} diff --git a/cmd/relacs/serve/templates/base.html b/cmd/relacs/serve/templates/base.html new file mode 100644 index 0000000..0274a7c --- /dev/null +++ b/cmd/relacs/serve/templates/base.html @@ -0,0 +1,17 @@ + + + + + + relacs{{block "title" .}}{{end}} + + + + +
+ {{block "content" .}}{{end}} +
+ + diff --git a/cmd/relacs/serve/templates/home.html b/cmd/relacs/serve/templates/home.html new file mode 100644 index 0000000..d25f8b7 --- /dev/null +++ b/cmd/relacs/serve/templates/home.html @@ -0,0 +1,26 @@ +{{template "base.html" .}} + +{{define "title"}} - Home{{end}} + +{{define "content"}} +

Tags

+ +
+

Tag

+

+ View pipeline status, artifacts, and Conforma results for a specific tag. +

+
+
+
+ + +
+
+ + +
+
+
+
+{{end}} diff --git a/cmd/relacs/serve/templates/static/style.css b/cmd/relacs/serve/templates/static/style.css new file mode 100644 index 0000000..c958c28 --- /dev/null +++ b/cmd/relacs/serve/templates/static/style.css @@ -0,0 +1,108 @@ +:root { + --color-bg: #f5f5f5; + --color-surface: #ffffff; + --color-text: #1a1a1a; + --color-text-secondary: #555; + --color-border: #ddd; + --color-passed: #16a34a; + --color-passed-bg: #dcfce7; + --color-failed: #dc2626; + --color-failed-bg: #fee2e2; + --color-warning: #ca8a04; + --color-warning-bg: #fef9c3; + --color-link: #2563eb; + --color-nav: #1e293b; +} +* { margin: 0; padding: 0; box-sizing: border-box; } +body { + font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; + background: var(--color-bg); + color: var(--color-text); + line-height: 1.5; +} +nav { + background: var(--color-nav); + color: #fff; + padding: 0.75rem 1.5rem; + display: flex; + align-items: center; + gap: 1.5rem; +} +nav a { color: #fff; text-decoration: none; font-weight: 600; font-size: 1.1rem; } +nav a:hover { opacity: 0.85; } +.container { max-width: 1200px; margin: 0 auto; padding: 1.5rem; } +a { color: var(--color-link); text-decoration: none; } +a:hover { text-decoration: underline; } +.card { + background: var(--color-surface); + border: 1px solid var(--color-border); + border-radius: 8px; + padding: 1.25rem; + margin-bottom: 1rem; +} +.card h2 { margin-bottom: 0.75rem; font-size: 1.1rem; } +.badge { + display: inline-block; + padding: 0.25rem 0.75rem; + border-radius: 9999px; + font-size: 0.85rem; + font-weight: 600; +} +.badge-passed { background: var(--color-passed-bg); color: var(--color-passed); } +.badge-failed { background: var(--color-failed-bg); color: var(--color-failed); } +.badge-warning { background: var(--color-warning-bg); color: var(--color-warning); } +.badge-mock { background: #e0e7ff; color: #4338ca; font-style: italic; } +.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; } +.kv { margin-bottom: 0.5rem; } +.kv dt { font-size: 0.8rem; color: var(--color-text-secondary); text-transform: uppercase; letter-spacing: 0.05em; } +.kv dd { font-size: 0.95rem; word-break: break-all; } +table { width: 100%; border-collapse: collapse; font-size: 0.9rem; } +th, td { text-align: left; padding: 0.5rem 0.75rem; border-bottom: 1px solid var(--color-border); } +th { background: var(--color-bg); font-weight: 600; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--color-text-secondary); } +.group-header { + display: flex; + align-items: center; + gap: 0.5rem; + padding: 0.75rem 0; + font-weight: 600; + border-bottom: 1px solid var(--color-border); + cursor: pointer; +} +.group-header:hover { opacity: 0.8; } +.section-header { + display: flex; + align-items: center; + gap: 0.5rem; + font-size: 1.1rem; + font-weight: 600; + cursor: pointer; +} +.section-header:hover { opacity: 0.8; } +details summary { list-style: none; } +details summary::-webkit-details-marker { display: none; } +details[open] > summary .chevron { transform: rotate(90deg); } +.chevron { transition: transform 0.15s; display: inline-block; } +.errors { background: var(--color-failed-bg); border: 1px solid var(--color-failed); border-radius: 8px; padding: 1rem; margin-bottom: 1rem; } +.errors li { margin-left: 1.25rem; color: var(--color-failed); } +input[type="text"], input[type="number"] { + padding: 0.5rem 0.75rem; + border: 1px solid var(--color-border); + border-radius: 6px; + font-size: 0.95rem; + width: 100%; +} +button { + padding: 0.5rem 1.25rem; + background: var(--color-link); + color: #fff; + border: none; + border-radius: 6px; + font-size: 0.95rem; + cursor: pointer; + font-weight: 500; +} +button:hover { opacity: 0.9; } +.form-row { display: flex; gap: 0.75rem; align-items: end; } +.form-group { display: flex; flex-direction: column; gap: 0.25rem; } +.form-group label { font-size: 0.85rem; font-weight: 500; color: var(--color-text-secondary); } +@media (max-width: 768px) { .grid-2 { grid-template-columns: 1fr; } } diff --git a/cmd/relacs/serve/templates/tag.html b/cmd/relacs/serve/templates/tag.html new file mode 100644 index 0000000..96a7783 --- /dev/null +++ b/cmd/relacs/serve/templates/tag.html @@ -0,0 +1,189 @@ +{{template "base.html" .}} + +{{define "title"}} - Tag: {{.Tag}}{{end}} + +{{define "content"}} +

Tag: {{.Tag}}

+ +{{if .Errors}} +
+ Errors occurred while fetching data: +
    + {{range .Errors}}
  • {{.}}
  • {{end}} +
+
+{{end}} + +
+
+

Status

+
+ {{if eq .OverallStatus "passed"}} + Passed + {{else if eq .OverallStatus "failed"}} + Failed + {{else}} + Warning + {{end}} +
+
+
Pipelines
+
+ {{if .PipelinesError}} + Error fetching data + {{else if .AllPipelinesPassed}} + All passed + {{else}} + Some failed + {{end}} +
+
+
+
Conforma violations
+
+ {{if .ViolationsError}} + Error fetching data + {{else if .HasViolations}} + {{len .Violations}} violation(s) + {{else}} + None + {{end}} +
+
+
+ +
+

Artifacts

+
+
GitHub Commit
+
{{if .CommitSHA}}{{slice .CommitSHA 0 12}}{{else}}unavailable{{end}}
+
+
+
Custom Snapshot
+
{{if .SnapshotName}}{{.SnapshotName}}{{else}}unavailable{{end}}
+
+
+
Operator Bundle Image
+
{{if .OperatorBundleImage}}{{.OperatorBundleImage}}{{else}}unavailable{{end}}
+
+
+
Operator Index Image
+
{{if .OperatorIndexImage}}{{.OperatorIndexImage}}{{else}}unavailable{{end}}
+
+
+
+ +
+ + ▶ + Pipeline Runs + {{if .PipelinesError}} + error + {{else if .AllPipelinesPassed}} + passed + {{else}} + failed + {{end}} + + {{if not .PipelineGroups}} +

No pipeline runs found.

+ {{else}} + {{range .PipelineGroups}} +
+ + ▶ + {{.Name}} + {{if .AllPassed}} + passed + {{else}} + failed + {{end}} + ({{len .PipelineRuns}}) + + + + + + + + + + + + + {{range .PipelineRuns}} + + + + + + + + {{end}} + +
NameCreatedEvent TypeStatusReason
{{.Name}}{{.CreationTimestamp.Format "2006-01-02 15:04:05"}}{{.EventType}} + {{if .Succeeded}} + Succeeded + {{else}} + Failed + {{end}} + {{.Reason}}
+
+ {{end}} + {{end}} +
+ +
+ + ▶ + Conforma Violations + {{if .ViolationsError}} + error + {{else if .HasViolations}} + {{len .Violations}} violation(s) + {{else}} + none + {{end}} + + {{if .ViolationsError}} +

Failed to fetch conforma violations. See errors above.

+ {{else if not .Violations}} +

No violations found.

+ {{else}} +
+ + +
+ + + + + + + + + {{range .Violations}} + + + + + {{end}} + +
ImageViolation
{{.Image}}{{.Violation}}
+ + {{end}} +
+{{end}} diff --git a/pkg/serve/tag.go b/pkg/serve/tag.go new file mode 100644 index 0000000..091a1b4 --- /dev/null +++ b/pkg/serve/tag.go @@ -0,0 +1,288 @@ +package serve + +import ( + "context" + "fmt" + "sort" + "sync" + "time" + + "github.com/stackrox/relacs/pkg/client" + kflx "github.com/stackrox/relacs/pkg/client/konflux" + "github.com/stackrox/relacs/pkg/config" + "github.com/stackrox/relacs/pkg/github" + "github.com/stackrox/relacs/pkg/konflux" + "github.com/stackrox/relacs/pkg/utils" +) + +type PipelineGroup struct { + Name string + PipelineRuns []PipelineRunInfo + AllPassed bool +} + +type PipelineRunInfo struct { + Name string + CreationTimestamp time.Time + EventType string + Succeeded bool + Reason string + URL string +} + +type Violation struct { + Image string + Violation string +} + +type TagData struct { + Tag string + + OverallStatus string // "passed", "failed", "warning" + AllPipelinesPassed bool + HasViolations bool + + CommitSHA string + CommitURL string + SnapshotName string + SnapshotURL string + OperatorBundleImage string + OperatorIndexImage string + + PipelineGroups []PipelineGroup + PipelinesError bool + Violations []Violation + ViolationsError bool + ViolationImages []string + Errors []string +} + +func computeTagOverallStatus(data *TagData) { + data.AllPipelinesPassed = len(data.PipelineGroups) > 0 + for _, g := range data.PipelineGroups { + if !g.AllPassed { + data.AllPipelinesPassed = false + break + } + } + data.HasViolations = len(data.Violations) > 0 + + if data.PipelinesError || data.ViolationsError || !data.AllPipelinesPassed { + data.OverallStatus = "failed" + } else if data.HasViolations { + data.OverallStatus = "warning" + } else { + data.OverallStatus = "passed" + } +} + +func uniqueViolationImages(violations []Violation) []string { + seen := map[string]bool{} + var images []string + for _, v := range violations { + if !seen[v.Image] { + seen[v.Image] = true + images = append(images, v.Image) + } + } + sort.Strings(images) + return images +} + +// ComputeGroupStatus sets AllPassed on each group based on the most recently +// created PipelineRun. Runs within each group are sorted newest-first. +func ComputeGroupStatus(groups []PipelineGroup) { + for i := range groups { + runs := groups[i].PipelineRuns + sort.Slice(runs, func(a, b int) bool { + return runs[a].CreationTimestamp.After(runs[b].CreationTimestamp) + }) + groups[i].PipelineRuns = runs + if len(runs) > 0 { + groups[i].AllPassed = runs[0].Succeeded + } + } +} + +func convertPipelineRun(plr kflx.PipelineRun) (PipelineRunInfo, error) { + var condition kflx.PipelineRunCondition + for _, c := range plr.Status.Conditions { + if c.Type == "Succeeded" { + condition = c + break + } + } + if condition.Type == "" { + return PipelineRunInfo{}, fmt.Errorf("no Succeeded condition found for pipeline run %s", plr.Metadata.Name) + } + return PipelineRunInfo{ + Name: plr.Metadata.Name, + CreationTimestamp: *plr.Metadata.CreationTimestamp, + EventType: plr.Metadata.Labels["pipelinesascode.tekton.dev/event-type"], + Succeeded: condition.Status == "True", + Reason: condition.Reason, + URL: utils.Application{Name: plr.Metadata.Labels["appstudio.openshift.io/application"]}.GetPipelineRunURL(plr.Metadata.Name), + }, nil +} + +func groupPipelineRuns(plrs []kflx.PipelineRun) ([]PipelineGroup, error) { + groupMap := map[string][]PipelineRunInfo{} + var groupOrder []string + + for _, plr := range plrs { + info, err := convertPipelineRun(plr) + if err != nil { + return nil, err + } + name := plr.Metadata.Labels["pipelinesascode.tekton.dev/original-prname"] + if name == "" { + name = plr.Metadata.Name + } + if _, exists := groupMap[name]; !exists { + groupOrder = append(groupOrder, name) + } + groupMap[name] = append(groupMap[name], info) + } + + sort.Strings(groupOrder) + groups := make([]PipelineGroup, 0, len(groupOrder)) + for _, name := range groupOrder { + groups = append(groups, PipelineGroup{ + Name: name, + PipelineRuns: groupMap[name], + }) + } + return groups, nil +} + +func convertViolations(v konflux.Violations) []Violation { + out := make([]Violation, len(v.Violations)) + for i, viol := range v.Violations { + out[i] = Violation{Image: viol.Image, Violation: viol.Violation} + } + return out +} + +func FetchTagData(ctx context.Context, c *client.Client, tag string) TagData { + org := config.GitHubOrganization + repo := config.MainGitHubRepository + appPrefix := config.KonfluxApplicationPrefix + + data := TagData{ + Tag: tag, + } + + var ( + mu sync.Mutex + wg sync.WaitGroup + commit github.CommitInfo + snap kflx.Snapshot + plrs []kflx.PipelineRun + viols konflux.Violations + indexImg konflux.OperatorIndexImage + ) + + addError := func(msg string) { + mu.Lock() + data.Errors = append(data.Errors, msg) + mu.Unlock() + } + + wg.Add(4) + + go func() { + defer wg.Done() + var err error + commit, err = github.GetCommitForTag(ctx, c, org, repo, tag) + if err != nil { + addError(fmt.Sprintf("Failed to get commit for tag: %v", err)) + } + }() + + go func() { + defer wg.Done() + var err error + indexImg, err = konflux.GetOperatorIndexImage(ctx, c, org, repo, tag) + if err != nil { + addError(fmt.Sprintf("Failed to get operator index image: %v", err)) + } + }() + + go func() { + defer wg.Done() + var err error + plrs, err = konflux.ListPipelineRunsForTag(ctx, c, org, repo, tag) + if err != nil { + addError(fmt.Sprintf("Failed to list pipeline runs: %v", err)) + mu.Lock() + data.PipelinesError = true + mu.Unlock() + } + }() + + go func() { + defer wg.Done() + var err error + snap, err = konflux.GetCustomSnapshot(ctx, c, appPrefix, org, repo, tag) + if err != nil { + addError(fmt.Sprintf("Failed to get custom snapshot: %v", err)) + mu.Lock() + data.ViolationsError = true + mu.Unlock() + return + } + + var violErr error + viols, violErr = konflux.ListConformaViolations(ctx, c, appPrefix, org, repo, tag) + if violErr != nil { + addError(fmt.Sprintf("Failed to list conforma violations: %v", violErr)) + mu.Lock() + data.ViolationsError = true + mu.Unlock() + } + }() + + wg.Wait() + + if indexImg.ImageURL != "" { + data.OperatorIndexImage = indexImg.ImageURL + "@" + indexImg.ImageDigest + } + + if commit.SHA != "" { + data.CommitSHA = commit.SHA + data.CommitURL = fmt.Sprintf("https://github.com/%s/%s/commit/%s", org, repo, commit.SHA) + } + + if snap.Metadata.Name != "" { + data.SnapshotName = snap.Metadata.Name + snapshotURL, err := snap.GetURL() + if err == nil { + data.SnapshotURL = snapshotURL + } + + bundleImage, err := snap.GetOperatorBundleImage(tag) + if err != nil { + addError(fmt.Sprintf("Failed to get operator bundle image: %v", err)) + } else { + data.OperatorBundleImage = bundleImage + } + } + + if plrs != nil { + groups, err := groupPipelineRuns(plrs) + if err != nil { + addError(fmt.Sprintf("Failed to process pipeline runs: %v", err)) + data.PipelinesError = true + } else { + ComputeGroupStatus(groups) + data.PipelineGroups = groups + } + } + + data.Violations = convertViolations(viols) + data.ViolationImages = uniqueViolationImages(data.Violations) + + computeTagOverallStatus(&data) + + return data +} From 4b4a6ecc8dfd706f59fa4da1552714368b2b7e70 Mon Sep 17 00:00:00 2001 From: Tom Martensen Date: Tue, 3 Nov 2026 12:08:06 +0100 Subject: [PATCH 03/29] return error if no pipelinerun groups are found --- pkg/serve/tag.go | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/pkg/serve/tag.go b/pkg/serve/tag.go index 091a1b4..eca3909 100644 --- a/pkg/serve/tag.go +++ b/pkg/serve/tag.go @@ -269,13 +269,18 @@ func FetchTagData(ctx context.Context, c *client.Client, tag string) TagData { } if plrs != nil { - groups, err := groupPipelineRuns(plrs) - if err != nil { - addError(fmt.Sprintf("Failed to process pipeline runs: %v", err)) + if len(plrs) == 0 { + addError("No pipeline runs found for tag") data.PipelinesError = true } else { - ComputeGroupStatus(groups) - data.PipelineGroups = groups + groups, err := groupPipelineRuns(plrs) + if err != nil { + addError(fmt.Sprintf("Failed to process pipeline runs: %v", err)) + data.PipelinesError = true + } else { + ComputeGroupStatus(groups) + data.PipelineGroups = groups + } } } From 30b84982261b9ad34f04ef32c448aa6c2369ef2f Mon Sep 17 00:00:00 2001 From: Tom Martensen Date: Thu, 12 Nov 2026 16:26:11 +0100 Subject: [PATCH 04/29] add repository selector to relacs serve Adds a repository dropdown (collector, fact, scanner, stackrox) to the homepage with stackrox as default. The tag page adapts per repo: custom snapshot, operator bundle/index images, and conforma violations are only shown for stackrox. Other repos get manual instructions for reviewing conforma violations via Konflux UI. Co-Authored-By: Claude Opus 4.6 (1M context) --- cmd/relacs/serve/handlers.go | 7 +- cmd/relacs/serve/templates/home.html | 9 +++ cmd/relacs/serve/templates/static/style.css | 4 +- cmd/relacs/serve/templates/tag.html | 21 +++++- pkg/serve/tag.go | 74 +++++++++++---------- 5 files changed, 77 insertions(+), 38 deletions(-) diff --git a/cmd/relacs/serve/handlers.go b/cmd/relacs/serve/handlers.go index 736df0d..56e074e 100644 --- a/cmd/relacs/serve/handlers.go +++ b/cmd/relacs/serve/handlers.go @@ -7,6 +7,7 @@ import ( "net/http" "github.com/stackrox/relacs/pkg/client" + "github.com/stackrox/relacs/pkg/config" "github.com/stackrox/relacs/pkg/serve" ) @@ -36,8 +37,12 @@ func handleTag(c *client.Client) http.HandlerFunc { http.Error(w, "Missing required query parameter: tag", http.StatusBadRequest) return } + repo := r.URL.Query().Get("repo") + if repo == "" { + repo = config.MainGitHubRepository + } - data := serve.FetchTagData(r.Context(), c, tag) + data := serve.FetchTagData(r.Context(), c, repo, tag) renderTemplate(w, tagTmpl, data) } } diff --git a/cmd/relacs/serve/templates/home.html b/cmd/relacs/serve/templates/home.html index d25f8b7..f99d1f2 100644 --- a/cmd/relacs/serve/templates/home.html +++ b/cmd/relacs/serve/templates/home.html @@ -12,6 +12,15 @@

Tag

+
+ + +
diff --git a/cmd/relacs/serve/templates/static/style.css b/cmd/relacs/serve/templates/static/style.css index c958c28..996ebf9 100644 --- a/cmd/relacs/serve/templates/static/style.css +++ b/cmd/relacs/serve/templates/static/style.css @@ -84,12 +84,14 @@ details[open] > summary .chevron { transform: rotate(90deg); } .chevron { transition: transform 0.15s; display: inline-block; } .errors { background: var(--color-failed-bg); border: 1px solid var(--color-failed); border-radius: 8px; padding: 1rem; margin-bottom: 1rem; } .errors li { margin-left: 1.25rem; color: var(--color-failed); } -input[type="text"], input[type="number"] { +input[type="text"], input[type="number"], select { padding: 0.5rem 0.75rem; border: 1px solid var(--color-border); border-radius: 6px; font-size: 0.95rem; width: 100%; + font-family: inherit; + background: var(--color-surface); } button { padding: 0.5rem 1.25rem; diff --git a/cmd/relacs/serve/templates/tag.html b/cmd/relacs/serve/templates/tag.html index 96a7783..07aabf8 100644 --- a/cmd/relacs/serve/templates/tag.html +++ b/cmd/relacs/serve/templates/tag.html @@ -1,9 +1,9 @@ {{template "base.html" .}} -{{define "title"}} - Tag: {{.Tag}}{{end}} +{{define "title"}} - {{.Repo}}: {{.Tag}}{{end}} {{define "content"}} -

Tag: {{.Tag}}

+

{{.Repo}}: {{.Tag}}

{{if .Errors}}
@@ -38,6 +38,7 @@

Status

{{end}} + {{if eq .Repo "stackrox"}}
Conforma violations
@@ -50,6 +51,7 @@

Status

{{end}}
+ {{end}}
@@ -58,6 +60,7 @@

Artifacts

GitHub Commit
{{if .CommitSHA}}{{slice .CommitSHA 0 12}}{{else}}unavailable{{end}}
+ {{if eq .Repo "stackrox"}}
Custom Snapshot
{{if .SnapshotName}}{{.SnapshotName}}{{else}}unavailable{{end}}
@@ -70,6 +73,7 @@

Artifacts

Operator Index Image
{{if .OperatorIndexImage}}{{.OperatorIndexImage}}{{else}}unavailable{{end}}
+ {{end}}
@@ -133,6 +137,7 @@

Artifacts

{{end}} +{{if eq .Repo "stackrox"}}
▶ @@ -186,4 +191,16 @@

Artifacts

{{end}}
+{{else}} +
+

Conforma Violations

+

Not yet supported for this repository. To review Conforma violations manually:

+
    +
  1. Follow a link to a PipelineRun above
  2. +
  3. Click on the linked Snapshot
  4. +
  5. Click on PipelineRuns
  6. +
  7. Click on acs-dev-conforma-..., then Violations
  8. +
+
+{{end}} {{end}} diff --git a/pkg/serve/tag.go b/pkg/serve/tag.go index eca3909..dcdb42c 100644 --- a/pkg/serve/tag.go +++ b/pkg/serve/tag.go @@ -36,7 +36,8 @@ type Violation struct { } type TagData struct { - Tag string + Tag string + Repo string OverallStatus string // "passed", "failed", "warning" AllPipelinesPassed bool @@ -163,13 +164,14 @@ func convertViolations(v konflux.Violations) []Violation { return out } -func FetchTagData(ctx context.Context, c *client.Client, tag string) TagData { +func FetchTagData(ctx context.Context, c *client.Client, repo, tag string) TagData { org := config.GitHubOrganization - repo := config.MainGitHubRepository appPrefix := config.KonfluxApplicationPrefix + isMainRepo := repo == config.MainGitHubRepository data := TagData{ - Tag: tag, + Tag: tag, + Repo: repo, } var ( @@ -188,7 +190,7 @@ func FetchTagData(ctx context.Context, c *client.Client, tag string) TagData { mu.Unlock() } - wg.Add(4) + wg.Add(2) go func() { defer wg.Done() @@ -199,15 +201,6 @@ func FetchTagData(ctx context.Context, c *client.Client, tag string) TagData { } }() - go func() { - defer wg.Done() - var err error - indexImg, err = konflux.GetOperatorIndexImage(ctx, c, org, repo, tag) - if err != nil { - addError(fmt.Sprintf("Failed to get operator index image: %v", err)) - } - }() - go func() { defer wg.Done() var err error @@ -220,27 +213,40 @@ func FetchTagData(ctx context.Context, c *client.Client, tag string) TagData { } }() - go func() { - defer wg.Done() - var err error - snap, err = konflux.GetCustomSnapshot(ctx, c, appPrefix, org, repo, tag) - if err != nil { - addError(fmt.Sprintf("Failed to get custom snapshot: %v", err)) - mu.Lock() - data.ViolationsError = true - mu.Unlock() - return - } + if isMainRepo { + wg.Add(2) - var violErr error - viols, violErr = konflux.ListConformaViolations(ctx, c, appPrefix, org, repo, tag) - if violErr != nil { - addError(fmt.Sprintf("Failed to list conforma violations: %v", violErr)) - mu.Lock() - data.ViolationsError = true - mu.Unlock() - } - }() + go func() { + defer wg.Done() + var err error + indexImg, err = konflux.GetOperatorIndexImage(ctx, c, org, repo, tag) + if err != nil { + addError(fmt.Sprintf("Failed to get operator index image: %v", err)) + } + }() + + go func() { + defer wg.Done() + var err error + snap, err = konflux.GetCustomSnapshot(ctx, c, appPrefix, org, repo, tag) + if err != nil { + addError(fmt.Sprintf("Failed to get custom snapshot: %v", err)) + mu.Lock() + data.ViolationsError = true + mu.Unlock() + return + } + + var violErr error + viols, violErr = konflux.ListConformaViolations(ctx, c, appPrefix, org, repo, tag) + if violErr != nil { + addError(fmt.Sprintf("Failed to list conforma violations: %v", violErr)) + mu.Lock() + data.ViolationsError = true + mu.Unlock() + } + }() + } wg.Wait() From bf8544d2990de874988ab88f95377977f968b432 Mon Sep 17 00:00:00 2001 From: Tom Martensen Date: Fri, 13 Nov 2026 11:47:18 +0100 Subject: [PATCH 05/29] serve: adapt to the new ListConformaViolations signature The conforma violations no longer depend on the custom snapshot, so a snapshot fetch failure no longer masks the violations section on the tag page. ListConformaViolations returns a ConformaViolations result now; use its Violations for the page. Co-Authored-By: Claude Code --- pkg/serve/tag.go | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/pkg/serve/tag.go b/pkg/serve/tag.go index dcdb42c..d36b754 100644 --- a/pkg/serve/tag.go +++ b/pkg/serve/tag.go @@ -231,20 +231,17 @@ func FetchTagData(ctx context.Context, c *client.Client, repo, tag string) TagDa snap, err = konflux.GetCustomSnapshot(ctx, c, appPrefix, org, repo, tag) if err != nil { addError(fmt.Sprintf("Failed to get custom snapshot: %v", err)) - mu.Lock() - data.ViolationsError = true - mu.Unlock() - return } - var violErr error - viols, violErr = konflux.ListConformaViolations(ctx, c, appPrefix, org, repo, tag) + result, violErr := konflux.ListConformaViolations(ctx, c, org, repo, tag) if violErr != nil { addError(fmt.Sprintf("Failed to list conforma violations: %v", violErr)) mu.Lock() data.ViolationsError = true mu.Unlock() + return } + viols = result.Violations }() } From 948550fd5b30243532a347115d2077d9234fe931 Mon Sep 17 00:00:00 2001 From: Tom Martensen Date: Fri, 13 Nov 2026 11:58:03 +0100 Subject: [PATCH 06/29] serve: group conforma violations by component version with arch filter Group the Conforma Violations widget by the "-- " prefix of the image names (e.g. "operator-5-0" for "operator-5-0-sha256:-ppc64le"). Groups are collapsible and collapsed by default. Each group has a "Filter by architecture" dropdown that shows only the violations of the selected architecture; it defaults to the first architecture and has no "all" option. Images without an arch suffix are labeled "multi-arch". Co-Authored-By: Claude Code --- cmd/relacs/serve/templates/tag.html | 73 ++++++++++++++--------- pkg/serve/tag.go | 87 +++++++++++++++++++++++---- pkg/serve/tag_test.go | 92 +++++++++++++++++++++++++++++ 3 files changed, 213 insertions(+), 39 deletions(-) create mode 100644 pkg/serve/tag_test.go diff --git a/cmd/relacs/serve/templates/tag.html b/cmd/relacs/serve/templates/tag.html index 07aabf8..07003fd 100644 --- a/cmd/relacs/serve/templates/tag.html +++ b/cmd/relacs/serve/templates/tag.html @@ -155,39 +155,54 @@

Artifacts

{{else if not .Violations}}

No violations found.

{{else}} -
- - -
- - - - - - - - - {{range .Violations}} - - - - - {{end}} - -
ImageViolation
{{.Image}}{{.Violation}}
+ {{range $i, $group := .ViolationGroups}} +
+ + ▶ + {{$group.Name}} + {{len $group.Violations}} violation(s) + ({{len $group.Archs}} architecture(s)) + +
+ + +
+ + + + + + + + + {{range $group.Violations}} + + + + + {{end}} + +
ImageViolation
{{.Image}}{{.Violation}}
+
+ {{end}} {{end}} diff --git a/pkg/serve/tag.go b/pkg/serve/tag.go index d36b754..1dc8564 100644 --- a/pkg/serve/tag.go +++ b/pkg/serve/tag.go @@ -4,6 +4,8 @@ import ( "context" "fmt" "sort" + "strconv" + "strings" "sync" "time" @@ -32,9 +34,18 @@ type PipelineRunInfo struct { type Violation struct { Image string + Arch string Violation string } +// ViolationGroup groups the conforma violations for one component version, +// e.g. all violations reported for images matching "scanner-4-10*". +type ViolationGroup struct { + Name string + Archs []string + Violations []Violation +} + type TagData struct { Tag string Repo string @@ -53,8 +64,8 @@ type TagData struct { PipelineGroups []PipelineGroup PipelinesError bool Violations []Violation + ViolationGroups []ViolationGroup ViolationsError bool - ViolationImages []string Errors []string } @@ -77,17 +88,73 @@ func computeTagOverallStatus(data *TagData) { } } -func uniqueViolationImages(violations []Violation) []string { - seen := map[string]bool{} - var images []string +// violationImageGroup extracts the "--" prefix of an +// image name, e.g. "scanner-4-10" from "scanner-4-10-s390x". Components may +// themselves contain hyphens ("scanner-db-4-10"). Images without a numeric +// major-minor version form their own group. +func violationImageGroup(image string) string { + parts := strings.Split(image, "-") + for i := 1; i < len(parts)-1; i++ { + if isNumeric(parts[i]) && isNumeric(parts[i+1]) { + return strings.Join(parts[:i+2], "-") + } + } + return image +} + +// violationImageArch extracts the architecture of an image relative to its +// group prefix. Image names look like +// "operator-5-0-sha256:-ppc64le", so the remainder after the group is +// "[-]": the digest contains no hyphens, and the arch may +// ("x86-64"). Images without an arch suffix are the multi-arch image. +func violationImageArch(image, group string) string { + remainder := strings.TrimPrefix(strings.TrimPrefix(image, group), "-") + _, arch, found := strings.Cut(remainder, "-") + if !found || arch == "" { + return "multi-arch" + } + return arch +} + +func isNumeric(s string) bool { + _, err := strconv.Atoi(s) + return err == nil +} + +// groupViolations groups violations by their image's component version prefix +// and annotates each violation with its image's architecture. Groups are +// sorted by name, and each group lists its distinct architectures sorted. +func groupViolations(violations []Violation) []ViolationGroup { + groupMap := map[string][]Violation{} + var groupOrder []string for _, v := range violations { - if !seen[v.Image] { - seen[v.Image] = true - images = append(images, v.Image) + name := violationImageGroup(v.Image) + if _, exists := groupMap[name]; !exists { + groupOrder = append(groupOrder, name) + } + groupMap[name] = append(groupMap[name], v) + } + sort.Strings(groupOrder) + + groups := make([]ViolationGroup, 0, len(groupOrder)) + for _, name := range groupOrder { + seen := map[string]bool{} + var archs []string + for i := range groupMap[name] { + groupMap[name][i].Arch = violationImageArch(groupMap[name][i].Image, name) + if !seen[groupMap[name][i].Arch] { + seen[groupMap[name][i].Arch] = true + archs = append(archs, groupMap[name][i].Arch) + } } + sort.Strings(archs) + groups = append(groups, ViolationGroup{ + Name: name, + Archs: archs, + Violations: groupMap[name], + }) } - sort.Strings(images) - return images + return groups } // ComputeGroupStatus sets AllPassed on each group based on the most recently @@ -288,7 +355,7 @@ func FetchTagData(ctx context.Context, c *client.Client, repo, tag string) TagDa } data.Violations = convertViolations(viols) - data.ViolationImages = uniqueViolationImages(data.Violations) + data.ViolationGroups = groupViolations(data.Violations) computeTagOverallStatus(&data) diff --git a/pkg/serve/tag_test.go b/pkg/serve/tag_test.go new file mode 100644 index 0000000..ab98a4b --- /dev/null +++ b/pkg/serve/tag_test.go @@ -0,0 +1,92 @@ +package serve + +import ( + "reflect" + "testing" +) + +func TestViolationImageGroup(t *testing.T) { + tests := []struct { + image string + expected string + }{ + // Image names look like + // "---sha256:-". + {image: "operator-5-0-sha256:f0c5ee9a4de4d26e02d84154e2cd2856f133661e44c5e9dfb1867c75cd8069c5-ppc64le", expected: "operator-5-0"}, + {image: "main-4-10-sha256:f0c5ee9a4de4d26e02d84154e2cd2856f133661e44c5e9dfb1867c75cd8069c5-x86-64", expected: "main-4-10"}, + // Components may themselves contain hyphens. + {image: "scanner-db-4-10-sha256:f0c5ee9a4de4d26e02d84154e2cd2856f133661e44c5e9dfb1867c75cd8069c5-s390x", expected: "scanner-db-4-10"}, + // Images without a numeric major-minor version form their own group. + {image: "main", expected: "main"}, + } + + for _, test := range tests { + t.Run(test.expected, func(t *testing.T) { + if got := violationImageGroup(test.image); got != test.expected { + t.Errorf("violationImageGroup(%q) = %q, expected %q", test.image, got, test.expected) + } + }) + } +} + +func TestViolationImageArch(t *testing.T) { + tests := []struct { + image string + group string + expected string + }{ + {image: "operator-5-0-sha256:f0c5ee9a4de4d26e02d84154e2cd2856f133661e44c5e9dfb1867c75cd8069c5-ppc64le", group: "operator-5-0", expected: "ppc64le"}, + // Arch names may contain hyphens themselves. + {image: "operator-5-0-sha256:f0c5ee9a4de4d26e02d84154e2cd2856f133661e44c5e9dfb1867c75cd8069c5-x86-64", group: "operator-5-0", expected: "x86-64"}, + // Images without an arch suffix are the multi-arch image. + {image: "operator-5-0-sha256:f0c5ee9a4de4d26e02d84154e2cd2856f133661e44c5e9dfb1867c75cd8069c5", group: "operator-5-0", expected: "multi-arch"}, + } + + for _, test := range tests { + t.Run(test.expected, func(t *testing.T) { + if got := violationImageArch(test.image, test.group); got != test.expected { + t.Errorf("violationImageArch(%q, %q) = %q, expected %q", test.image, test.group, got, test.expected) + } + }) + } +} + +func TestGroupViolations(t *testing.T) { + violations := []Violation{ + {Image: "scanner-4-10-sha256:f0c5ee9a4de4d26e02d84154e2cd2856f133661e44c5e9dfb1867c75cd8069c5-s390x", Violation: "violation one"}, + {Image: "main-4-10-sha256:f0c5ee9a4de4d26e02d84154e2cd2856f133661e44c5e9dfb1867c75cd8069c5", Violation: "violation two"}, + {Image: "scanner-4-10-sha256:f0c5ee9a4de4d26e02d84154e2cd2856f133661e44c5e9dfb1867c75cd8069c5", Violation: "violation three"}, + {Image: "main-4-10-sha256:f0c5ee9a4de4d26e02d84154e2cd2856f133661e44c5e9dfb1867c75cd8069c5", Violation: "violation four"}, + } + + groups := groupViolations(violations) + + expected := []ViolationGroup{ + { + Name: "main-4-10", + Archs: []string{"multi-arch"}, + Violations: []Violation{ + {Image: "main-4-10-sha256:f0c5ee9a4de4d26e02d84154e2cd2856f133661e44c5e9dfb1867c75cd8069c5", Arch: "multi-arch", Violation: "violation two"}, + {Image: "main-4-10-sha256:f0c5ee9a4de4d26e02d84154e2cd2856f133661e44c5e9dfb1867c75cd8069c5", Arch: "multi-arch", Violation: "violation four"}, + }, + }, + { + Name: "scanner-4-10", + Archs: []string{"multi-arch", "s390x"}, + Violations: []Violation{ + {Image: "scanner-4-10-sha256:f0c5ee9a4de4d26e02d84154e2cd2856f133661e44c5e9dfb1867c75cd8069c5-s390x", Arch: "s390x", Violation: "violation one"}, + {Image: "scanner-4-10-sha256:f0c5ee9a4de4d26e02d84154e2cd2856f133661e44c5e9dfb1867c75cd8069c5", Arch: "multi-arch", Violation: "violation three"}, + }, + }, + } + + if !reflect.DeepEqual(groups, expected) { + t.Errorf("groupViolations() = %+v, expected %+v", groups, expected) + } +} + +func TestGroupViolations_Empty(t *testing.T) { + if groups := groupViolations(nil); len(groups) != 0 { + t.Errorf("groupViolations(nil) = %+v, expected no groups", groups) + } +} From 7a23917bbc5ee8aa8fb756a2d558fe650f87e979 Mon Sep 17 00:00:00 2001 From: Tom Martensen Date: Fri, 13 Nov 2026 12:02:51 +0100 Subject: [PATCH 07/29] serve: note that conforma violations are for the dev policy only The list-conforma-* commands only consider runs triggered on the tag's commit, which use the acs-conforma-dev policy. Add an info note to the Status card and the Conforma Violations widget on the tag page pointing to the Conforma run attached to the custom snapshot for acs-conforma-prod-like policy results. Co-Authored-By: Claude Code --- cmd/relacs/serve/templates/static/style.css | 1 + cmd/relacs/serve/templates/tag.html | 9 +++++++++ 2 files changed, 10 insertions(+) diff --git a/cmd/relacs/serve/templates/static/style.css b/cmd/relacs/serve/templates/static/style.css index 996ebf9..74a9770 100644 --- a/cmd/relacs/serve/templates/static/style.css +++ b/cmd/relacs/serve/templates/static/style.css @@ -83,6 +83,7 @@ details summary::-webkit-details-marker { display: none; } details[open] > summary .chevron { transform: rotate(90deg); } .chevron { transition: transform 0.15s; display: inline-block; } .errors { background: var(--color-failed-bg); border: 1px solid var(--color-failed); border-radius: 8px; padding: 1rem; margin-bottom: 1rem; } +.note { background: var(--color-bg); border: 1px solid var(--color-border); border-radius: 8px; padding: 0.75rem 1rem; margin: 0.5rem 0; font-size: 0.85rem; color: var(--color-text-secondary); } .errors li { margin-left: 1.25rem; color: var(--color-failed); } input[type="text"], input[type="number"], select { padding: 0.5rem 0.75rem; diff --git a/cmd/relacs/serve/templates/tag.html b/cmd/relacs/serve/templates/tag.html index 07003fd..816a5ee 100644 --- a/cmd/relacs/serve/templates/tag.html +++ b/cmd/relacs/serve/templates/tag.html @@ -2,6 +2,13 @@ {{define "title"}} - {{.Repo}}: {{.Tag}}{{end}} +{{define "conforma-policy-note"}} +
+ Conforma violations here are for the acs-conforma-dev policy only.
+ For the acs-conforma-prod-like policy results, review the Conforma run attached to the custom snapshot. +
+{{end}} + {{define "content"}}

{{.Repo}}: {{.Tag}}

@@ -51,6 +58,7 @@

Status

{{end}} + {{template "conforma-policy-note" .}} {{end}}
@@ -150,6 +158,7 @@

Artifacts

none {{end}} + {{template "conforma-policy-note" .}} {{if .ViolationsError}}

Failed to fetch conforma violations. See errors above.

{{else if not .Violations}} From d807efee770103efc68bf0916c51973676ff4f10 Mon Sep 17 00:00:00 2001 From: Tom Martensen Date: Fri, 13 Nov 2026 12:10:18 +0100 Subject: [PATCH 08/29] serve: render conforma violations for all repositories The conforma violations are fetched via pipelines-as-code runs on the tag's commit, which works for any repository, not just the main one. Fetch them for every repo and render the same Conforma Violations widget; drop the "not yet supported" fallback card. The acs-conforma-dev policy note stays limited to the main repository, and the custom snapshot and operator images remain main-repo-only. Co-Authored-By: Claude Code --- cmd/relacs/serve/templates/tag.html | 227 ++++++++++++++-------------- pkg/serve/tag.go | 24 +-- 2 files changed, 127 insertions(+), 124 deletions(-) diff --git a/cmd/relacs/serve/templates/tag.html b/cmd/relacs/serve/templates/tag.html index 816a5ee..212254f 100644 --- a/cmd/relacs/serve/templates/tag.html +++ b/cmd/relacs/serve/templates/tag.html @@ -4,7 +4,8 @@ {{define "conforma-policy-note"}}
- Conforma violations here are for the acs-conforma-dev policy only.
+ Conforma violations here are for the acs-conforma-dev policy only and only for components defined in + this repository (no results from retag-* pipelines).
For the acs-conforma-prod-like policy results, review the Conforma run attached to the custom snapshot.
{{end}} @@ -26,38 +27,38 @@

{{.Repo}}: {{.Tag}}

Status

{{if eq .OverallStatus "passed"}} - Passed + Passed {{else if eq .OverallStatus "failed"}} - Failed + Failed {{else}} - Warning + Warning {{end}}
Pipelines
{{if .PipelinesError}} - Error fetching data + Error fetching data {{else if .AllPipelinesPassed}} - All passed + All passed {{else}} - Some failed + Some failed {{end}}
- {{if eq .Repo "stackrox"}}
Conforma violations
{{if .ViolationsError}} - Error fetching data + Error fetching data {{else if .HasViolations}} - {{len .Violations}} violation(s) + {{len .Violations}} violation(s) {{else}} - None + None {{end}}
+ {{if eq .Repo "stackrox"}} {{template "conforma-policy-note" .}} {{end}} @@ -66,20 +67,24 @@

Status

Artifacts

GitHub Commit
-
{{if .CommitSHA}}{{slice .CommitSHA 0 12}}{{else}}unavailable{{end}}
+
{{if .CommitSHA}}{{slice .CommitSHA 0 12}}{{else}}unavailable{{end}}
{{if eq .Repo "stackrox"}}
Custom Snapshot
-
{{if .SnapshotName}}{{.SnapshotName}}{{else}}unavailable{{end}}
+
{{if .SnapshotName}}{{.SnapshotName}}{{else}}unavailable{{end}}
Operator Bundle Image
-
{{if .OperatorBundleImage}}{{.OperatorBundleImage}}{{else}}unavailable{{end}}
+
{{if .OperatorBundleImage}}{{.OperatorBundleImage}}{{else}}unavailable{{end}}
Operator Index Image
-
{{if .OperatorIndexImage}}{{.OperatorIndexImage}}{{else}}unavailable{{end}}
+
{{if .OperatorIndexImage}}{{.OperatorIndexImage}}{{else}}unavailable{{end}}
{{end}} @@ -90,115 +95,121 @@

Artifacts

▶ Pipeline Runs {{if .PipelinesError}} - error + error {{else if .AllPipelinesPassed}} - passed + passed {{else}} - failed + failed {{end}} {{if not .PipelineGroups}} -

No pipeline runs found.

+

No pipeline runs found.

{{else}} - {{range .PipelineGroups}} -
- - ▶ - {{.Name}} - {{if .AllPassed}} - passed - {{else}} - failed + {{range .PipelineGroups}} +
+ + ▶ + {{.Name}} + {{if .AllPassed}} + passed + {{else}} + failed + {{end}} + ({{len + .PipelineRuns}}) + + + + + + + + + + + + + {{range .PipelineRuns}} + + + + + + + {{end}} - ({{len .PipelineRuns}}) - -
NameCreatedEvent TypeStatusReason
{{.Name}}{{.CreationTimestamp.Format "2006-01-02 15:04:05"}}{{.EventType}} + {{if .Succeeded}} + Succeeded + {{else}} + Failed + {{end}} + {{.Reason}}
- - - - - - - - - - - {{range .PipelineRuns}} - - - - - - - - {{end}} - -
NameCreatedEvent TypeStatusReason
{{.Name}}{{.CreationTimestamp.Format "2006-01-02 15:04:05"}}{{.EventType}} - {{if .Succeeded}} - Succeeded - {{else}} - Failed - {{end}} - {{.Reason}}
-
- {{end}} + + +
+ {{end}} {{end}} -{{if eq .Repo "stackrox"}}
▶ Conforma Violations {{if .ViolationsError}} - error + error {{else if .HasViolations}} - {{len .Violations}} violation(s) + {{len .Violations}} violation(s) {{else}} - none + none {{end}} + {{if eq .Repo "stackrox"}} {{template "conforma-policy-note" .}} + {{end}} {{if .ViolationsError}} -

Failed to fetch conforma violations. See errors above.

+

Failed to fetch conforma violations. See errors above.

{{else if not .Violations}} -

No violations found.

+

No violations found.

{{else}} - {{range $i, $group := .ViolationGroups}} -
- - ▶ - {{$group.Name}} - {{len $group.Violations}} violation(s) - ({{len $group.Archs}} architecture(s)) - -
- - -
- - - - - - - - - {{range $group.Violations}} - - - - - {{end}} - -
ImageViolation
{{.Image}}{{.Violation}}
-
- {{end}} - + {{end}}
-{{else}} -
-

Conforma Violations

-

Not yet supported for this repository. To review Conforma violations manually:

-
    -
  1. Follow a link to a PipelineRun above
  2. -
  3. Click on the linked Snapshot
  4. -
  5. Click on PipelineRuns
  6. -
  7. Click on acs-dev-conforma-..., then Violations
  8. -
-
-{{end}} {{end}} diff --git a/pkg/serve/tag.go b/pkg/serve/tag.go index 1dc8564..b43429c 100644 --- a/pkg/serve/tag.go +++ b/pkg/serve/tag.go @@ -280,6 +280,20 @@ func FetchTagData(ctx context.Context, c *client.Client, repo, tag string) TagDa } }() + wg.Add(1) + go func() { + defer wg.Done() + result, violErr := konflux.ListConformaViolations(ctx, c, org, repo, tag) + if violErr != nil { + addError(fmt.Sprintf("Failed to list conforma violations: %v", violErr)) + mu.Lock() + data.ViolationsError = true + mu.Unlock() + return + } + viols = result.Violations + }() + if isMainRepo { wg.Add(2) @@ -299,16 +313,6 @@ func FetchTagData(ctx context.Context, c *client.Client, repo, tag string) TagDa if err != nil { addError(fmt.Sprintf("Failed to get custom snapshot: %v", err)) } - - result, violErr := konflux.ListConformaViolations(ctx, c, org, repo, tag) - if violErr != nil { - addError(fmt.Sprintf("Failed to list conforma violations: %v", violErr)) - mu.Lock() - data.ViolationsError = true - mu.Unlock() - return - } - viols = result.Violations }() } From 19e837364da7b65c2d66cff987ef0eaeda50940a Mon Sep 17 00:00:00 2001 From: Tom Martensen Date: Fri, 13 Nov 2026 12:13:44 +0100 Subject: [PATCH 09/29] serve: render the conforma policy note for all repositories The acs-conforma-dev policy limitation applies to every repository, not just the main one, so drop the repo condition around the note. Co-Authored-By: Claude Code --- cmd/relacs/serve/templates/tag.html | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/cmd/relacs/serve/templates/tag.html b/cmd/relacs/serve/templates/tag.html index 212254f..db8e505 100644 --- a/cmd/relacs/serve/templates/tag.html +++ b/cmd/relacs/serve/templates/tag.html @@ -6,7 +6,8 @@
Conforma violations here are for the acs-conforma-dev policy only and only for components defined in this repository (no results from retag-* pipelines).
- For the acs-conforma-prod-like policy results, review the Conforma run attached to the custom snapshot. + For release like acs-conforma-prod-like policy results, review the Conforma run attached to the custom + snapshot for the tag in the stackrox repository.
{{end}} @@ -58,9 +59,7 @@

Status

{{end}} - {{if eq .Repo "stackrox"}} {{template "conforma-policy-note" .}} - {{end}}
@@ -163,9 +162,7 @@

Artifacts

none {{end}} - {{if eq .Repo "stackrox"}} {{template "conforma-policy-note" .}} - {{end}} {{if .ViolationsError}}

Failed to fetch conforma violations. See errors above.

{{else if not .Violations}} From 180eb6e9ba3b8c2ebe2562664e382bb0276c9c8d Mon Sep 17 00:00:00 2001 From: Tom Martensen Date: Fri, 13 Nov 2026 12:16:39 +0100 Subject: [PATCH 10/29] serve: link the custom snapshot in the conforma policy note When the custom snapshot is available, link "the custom snapshot" in the policy note to its Konflux UI pipelineruns filtered by the acs-conforma-prod-like pipeline; otherwise keep the plain text. Co-Authored-By: Claude Code --- cmd/relacs/serve/templates/tag.html | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/cmd/relacs/serve/templates/tag.html b/cmd/relacs/serve/templates/tag.html index db8e505..8f243eb 100644 --- a/cmd/relacs/serve/templates/tag.html +++ b/cmd/relacs/serve/templates/tag.html @@ -6,8 +6,9 @@
Conforma violations here are for the acs-conforma-dev policy only and only for components defined in this repository (no results from retag-* pipelines).
- For release like acs-conforma-prod-like policy results, review the Conforma run attached to the custom - snapshot for the tag in the stackrox repository. + For release like acs-conforma-prod-like policy results, review the Conforma run attached to {{if + .SnapshotURL}}the custom + snapshot{{else}}the custom snapshot{{end}} for the tag in the stackrox repository.
{{end}} From b29db1a23ad8fa55fa5d8415bb98668bcdb0f568 Mon Sep 17 00:00:00 2001 From: Tom Martensen Date: Fri, 13 Nov 2026 12:17:57 +0100 Subject: [PATCH 11/29] serve: reword the conforma policy note Say "for a preview of the release like acs-conforma-prod-like policy results" to clarify that the custom snapshot run is a preview. Co-Authored-By: Claude Code --- cmd/relacs/serve/templates/tag.html | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/cmd/relacs/serve/templates/tag.html b/cmd/relacs/serve/templates/tag.html index 8f243eb..1c0159a 100644 --- a/cmd/relacs/serve/templates/tag.html +++ b/cmd/relacs/serve/templates/tag.html @@ -6,9 +6,10 @@
Conforma violations here are for the acs-conforma-dev policy only and only for components defined in this repository (no results from retag-* pipelines).
- For release like acs-conforma-prod-like policy results, review the Conforma run attached to {{if + For a preview of the release like acs-conforma-prod-like policy results, review the Conforma run + attached to {{if .SnapshotURL}}the custom - snapshot{{else}}the custom snapshot{{end}} for the tag in the stackrox repository. + snapshot{{else}}the custom snapshot{{end}} for the tag in the stackrox repository.
{{end}} From 13093bd837f490dbb9564fc67fec7ba7e9b46fce Mon Sep 17 00:00:00 2001 From: Tom Martensen Date: Fri, 13 Nov 2026 12:36:34 +0100 Subject: [PATCH 12/29] serve: pass the conforma scenario explicitly ListConformaViolations now requires the scenario; the serve tag page uses the default acs-conforma-dev scenario. Co-Authored-By: Claude Code --- pkg/serve/tag.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/serve/tag.go b/pkg/serve/tag.go index b43429c..a821069 100644 --- a/pkg/serve/tag.go +++ b/pkg/serve/tag.go @@ -283,7 +283,7 @@ func FetchTagData(ctx context.Context, c *client.Client, repo, tag string) TagDa wg.Add(1) go func() { defer wg.Done() - result, violErr := konflux.ListConformaViolations(ctx, c, org, repo, tag) + result, violErr := konflux.ListConformaViolations(ctx, c, org, repo, tag, konflux.ConformaScenarioDev) if violErr != nil { addError(fmt.Sprintf("Failed to list conforma violations: %v", violErr)) mu.Lock() From 459c7583102ed6bb4a7e5f2c585685c4e21fe2b0 Mon Sep 17 00:00:00 2001 From: Tom Martensen Date: Fri, 13 Nov 2026 12:46:21 +0100 Subject: [PATCH 13/29] conforma: carry URL and reason for skipped and in-progress runs ConformaViolations.SkippedRuns and InProgressRuns now hold ConformaRunInfo entries with the pipeline run's Konflux UI URL and, for skipped runs, the reason the report was unavailable, instead of bare run names. The list-conforma-violations output adapts accordingly. The serve Conforma Violations widget renders this as three tabs under the policy note: Completed (the grouped violations), In progress (links to the running pipeline runs) and Skipped (links with reasons), each tab title showing its count. Co-Authored-By: Claude Code --- .../konflux/list_conforma_violations.go | 28 +++++++---- cmd/relacs/serve/templates/static/style.css | 4 ++ cmd/relacs/serve/templates/tag.html | 50 ++++++++++++++++++- pkg/konflux/conforma.go | 32 +++++++++--- pkg/konflux/conforma_runs.go | 10 ++-- pkg/serve/tag.go | 23 +++++++++ tests/konflux/conforma_violations_test.go | 24 +++++++-- 7 files changed, 145 insertions(+), 26 deletions(-) diff --git a/cmd/relacs/konflux/list_conforma_violations.go b/cmd/relacs/konflux/list_conforma_violations.go index 42e739d..0a46843 100644 --- a/cmd/relacs/konflux/list_conforma_violations.go +++ b/cmd/relacs/konflux/list_conforma_violations.go @@ -12,12 +12,12 @@ import ( ) type ConformaViolationsOutput struct { - Organization string `json:"organization" yaml:"organization"` - Repository string `json:"repository" yaml:"repository"` - Tag string `json:"tag" yaml:"tag"` - Violations konflux.Violations `json:"violations" yaml:"violations"` - SkippedRuns []string `json:"skippedRuns" yaml:"skippedRuns"` - InProgressRuns []string `json:"inProgressRuns" yaml:"inProgressRuns"` + Organization string `json:"organization" yaml:"organization"` + Repository string `json:"repository" yaml:"repository"` + Tag string `json:"tag" yaml:"tag"` + Violations konflux.Violations `json:"violations" yaml:"violations"` + SkippedRuns []konflux.ConformaRunInfo `json:"skippedRuns" yaml:"skippedRuns"` + InProgressRuns []konflux.ConformaRunInfo `json:"inProgressRuns" yaml:"inProgressRuns"` } func (c ConformaViolationsOutput) String() string { @@ -34,13 +34,13 @@ func (c ConformaViolationsOutput) String() string { if len(c.InProgressRuns) > 0 { output += fmt.Sprintln("In-progress runs:") for _, run := range c.InProgressRuns { - output += fmt.Sprintf(" - %s\n", run) + output += fmt.Sprintf(" - %s (%s)\n", run.Name, run.URL) } } if len(c.SkippedRuns) > 0 { output += fmt.Sprintln("Skipped runs (no report available):") for _, run := range c.SkippedRuns { - output += fmt.Sprintf(" - %s\n", run) + output += fmt.Sprintf(" - %s: %s\n", run.Name, run.Reason) } } return output @@ -94,10 +94,10 @@ func runListConformaViolations(cmd *cobra.Command, args []string, c *client.Clie // The result is partial: still render the output, but exit non-zero. var reasons []string if len(result.SkippedRuns) > 0 { - reasons = append(reasons, fmt.Sprintf("no conforma report available for %d run(s): %s", len(result.SkippedRuns), strings.Join(result.SkippedRuns, ", "))) + reasons = append(reasons, fmt.Sprintf("no conforma report available for %d run(s): %s", len(result.SkippedRuns), runNames(result.SkippedRuns))) } if len(result.InProgressRuns) > 0 { - reasons = append(reasons, fmt.Sprintf("%d conforma run(s) still in progress: %s", len(result.InProgressRuns), strings.Join(result.InProgressRuns, ", "))) + reasons = append(reasons, fmt.Sprintf("%d conforma run(s) still in progress: %s", len(result.InProgressRuns), runNames(result.InProgressRuns))) } return output, &common.PartialResultError{ Err: fmt.Errorf("%s", strings.Join(reasons, "; ")), @@ -105,3 +105,11 @@ func runListConformaViolations(cmd *cobra.Command, args []string, c *client.Clie } return output, nil } + +func runNames(runs []konflux.ConformaRunInfo) string { + names := make([]string, len(runs)) + for i, run := range runs { + names[i] = run.Name + } + return strings.Join(names, ", ") +} diff --git a/cmd/relacs/serve/templates/static/style.css b/cmd/relacs/serve/templates/static/style.css index 74a9770..bcc5ed5 100644 --- a/cmd/relacs/serve/templates/static/style.css +++ b/cmd/relacs/serve/templates/static/style.css @@ -84,6 +84,10 @@ details[open] > summary .chevron { transform: rotate(90deg); } .chevron { transition: transform 0.15s; display: inline-block; } .errors { background: var(--color-failed-bg); border: 1px solid var(--color-failed); border-radius: 8px; padding: 1rem; margin-bottom: 1rem; } .note { background: var(--color-bg); border: 1px solid var(--color-border); border-radius: 8px; padding: 0.75rem 1rem; margin: 0.5rem 0; font-size: 0.85rem; color: var(--color-text-secondary); } +.tabs { display: flex; gap: 0.25rem; border-bottom: 1px solid var(--color-border); margin: 0.75rem 0; } +.tab { background: none; border: none; border-bottom: 2px solid transparent; padding: 0.5rem 0.75rem; font-size: 0.9rem; font-weight: 500; color: var(--color-text-secondary); cursor: pointer; } +.tab:hover { color: var(--color-text); } +.tab.active { color: var(--color-text); border-bottom-color: var(--color-link); } .errors li { margin-left: 1.25rem; color: var(--color-failed); } input[type="text"], input[type="number"], select { padding: 0.5rem 0.75rem; diff --git a/cmd/relacs/serve/templates/tag.html b/cmd/relacs/serve/templates/tag.html index 1c0159a..821f31b 100644 --- a/cmd/relacs/serve/templates/tag.html +++ b/cmd/relacs/serve/templates/tag.html @@ -167,10 +167,22 @@

Artifacts

{{template "conforma-policy-note" .}} {{if .ViolationsError}}

Failed to fetch conforma violations. See errors above.

- {{else if not .Violations}} + {{else if and (not .Violations) (not .InProgressRuns) (not .SkippedRuns)}}

No violations found.

{{else}} - {{range $i, $group := .ViolationGroups}} +
+ + + +
+
+ {{if not .ViolationGroups}} +

No violations found.

+ {{else}} + {{range $i, $group := .ViolationGroups}}
▶ @@ -208,7 +220,41 @@

Artifacts

{{end}} + {{end}} +
+ + - {{end}} - + } + // Apply the initially selected architecture (the first option) to each + // group, since the dropdown has no "all" option. + var archFilters = document.querySelectorAll('select[id$="-arch-filter-"]'); + for (var i = 0; i < archFilters.length; i++) { + filterViolations(archFilters[i]); + } + {{end}} diff --git a/pkg/serve/tag.go b/pkg/serve/tag.go index 23aac55..a3bb2c5 100644 --- a/pkg/serve/tag.go +++ b/pkg/serve/tag.go @@ -28,6 +28,7 @@ type PipelineRunInfo struct { CreationTimestamp time.Time EventType string Succeeded bool + Running bool Reason string URL string } @@ -63,6 +64,40 @@ func convertConformaRuns(runs []konflux.ConformaRunInfo) []ConformaRun { return out } +// ConformaResults holds the results of one conforma scenario for a tag. +type ConformaResults struct { + Violations []Violation + Groups []ViolationGroup + InProgressRuns []ConformaRun + SkippedRuns []ConformaRun + Error bool +} + +func convertConformaResult(result konflux.ConformaViolations) ConformaResults { + violations := convertViolations(result.Violations) + return ConformaResults{ + Violations: violations, + Groups: groupViolations(violations), + InProgressRuns: convertConformaRuns(result.InProgressRuns), + SkippedRuns: convertConformaRuns(result.SkippedRuns), + } +} + +// ConformaTabData is the data for one conforma widget's tab content, +// identified by a prefix that namespaces its element ids. +type ConformaTabData struct { + Prefix string + Results ConformaResults +} + +func (t TagData) DevTabs() ConformaTabData { + return ConformaTabData{Prefix: "dev", Results: t.ConformaDev} +} + +func (t TagData) PreviewTabs() ConformaTabData { + return ConformaTabData{Prefix: "preview", Results: t.ConformaReleasePreview} +} + type TagData struct { Tag string Repo string @@ -78,17 +113,18 @@ type TagData struct { OperatorBundleImage string OperatorIndexImage string - PipelineGroups []PipelineGroup - PipelinesError bool - Violations []Violation - ViolationGroups []ViolationGroup - InProgressRuns []ConformaRun - SkippedRuns []ConformaRun - ViolationsError bool - Errors []string + PipelineGroups []PipelineGroup + PipelinesError bool + + // ConformaDev holds the acs-conforma-dev results, ConformaReleasePreview + // the acs-conforma-prod-like results (main repository only). + ConformaDev ConformaResults + ConformaReleasePreview ConformaResults + + Errors []string } -func computeTagOverallStatus(data *TagData) { +func computeTagOverallStatus(data *TagData, isMainRepo bool) { data.AllPipelinesPassed = len(data.PipelineGroups) > 0 for _, g := range data.PipelineGroups { if !g.AllPassed { @@ -96,14 +132,48 @@ func computeTagOverallStatus(data *TagData) { break } } - data.HasViolations = len(data.Violations) > 0 + data.HasViolations = len(data.ConformaDev.Violations) > 0 + + // The overall status is "error" when any data could not be retrieved, + // "failed" when prod-like violations were found, prod-like runs were + // skipped or the latest run of a build pipeline run group did not + // succeed, "waiting" while conforma or build pipeline runs are still in + // progress, and "green" only when every build pipeline run group's latest + // run succeeded and, for the main repository, the custom snapshot and the + // operator bundle and index images are present and there are no prod-like + // violations. For other repositories, green build pipeline runs are + // sufficient. + if data.PipelinesError || data.ConformaDev.Error || + (isMainRepo && (data.ConformaReleasePreview.Error || data.SnapshotName == "" || + data.OperatorBundleImage == "" || data.OperatorIndexImage == "")) { + data.OverallStatus = "error" + return + } - if data.PipelinesError || data.ViolationsError || !data.AllPipelinesPassed { + failed := isMainRepo && (len(data.ConformaReleasePreview.Violations) > 0 || len(data.ConformaReleasePreview.SkippedRuns) > 0) + waiting := isMainRepo && len(data.ConformaReleasePreview.InProgressRuns) > 0 + for _, g := range data.PipelineGroups { + if len(g.PipelineRuns) == 0 { + continue + } + latest := g.PipelineRuns[0] + if latest.Succeeded { + continue + } + if latest.Running { + waiting = true + } else { + failed = true + } + } + + switch { + case failed: data.OverallStatus = "failed" - } else if data.HasViolations { - data.OverallStatus = "warning" - } else { - data.OverallStatus = "passed" + case waiting: + data.OverallStatus = "waiting" + default: + data.OverallStatus = "green" } } @@ -207,6 +277,7 @@ func convertPipelineRun(plr kflx.PipelineRun) (PipelineRunInfo, error) { CreationTimestamp: *plr.Metadata.CreationTimestamp, EventType: plr.Metadata.Labels["pipelinesascode.tekton.dev/event-type"], Succeeded: condition.Status == "True", + Running: condition.Status == "Unknown", Reason: condition.Reason, URL: utils.Application{Name: plr.Metadata.Labels["appstudio.openshift.io/application"]}.GetPipelineRunURL(plr.Metadata.Name), }, nil @@ -266,7 +337,6 @@ func FetchTagData(ctx context.Context, c *client.Client, repo, tag string) TagDa commit github.CommitInfo snap kflx.Snapshot plrs []kflx.PipelineRun - viols konflux.Violations indexImg konflux.OperatorIndexImage ) @@ -306,19 +376,32 @@ func FetchTagData(ctx context.Context, c *client.Client, repo, tag string) TagDa if violErr != nil { addError(fmt.Sprintf("Failed to list conforma violations: %v", violErr)) mu.Lock() - data.ViolationsError = true + data.ConformaDev.Error = true mu.Unlock() return } - viols = result.Violations mu.Lock() - data.InProgressRuns = convertConformaRuns(result.InProgressRuns) - data.SkippedRuns = convertConformaRuns(result.SkippedRuns) + data.ConformaDev = convertConformaResult(result) mu.Unlock() }() if isMainRepo { - wg.Add(2) + wg.Add(3) + + go func() { + defer wg.Done() + result, violErr := konflux.ListConformaViolations(ctx, c, org, repo, tag, konflux.ConformaScenarioProdLike) + if violErr != nil { + addError(fmt.Sprintf("Failed to list conforma release preview violations: %v", violErr)) + mu.Lock() + data.ConformaReleasePreview.Error = true + mu.Unlock() + return + } + mu.Lock() + data.ConformaReleasePreview = convertConformaResult(result) + mu.Unlock() + }() go func() { defer wg.Done() @@ -381,10 +464,7 @@ func FetchTagData(ctx context.Context, c *client.Client, repo, tag string) TagDa } } - data.Violations = convertViolations(viols) - data.ViolationGroups = groupViolations(data.Violations) - - computeTagOverallStatus(&data) + computeTagOverallStatus(&data, isMainRepo) return data } diff --git a/pkg/serve/tag_test.go b/pkg/serve/tag_test.go index ab98a4b..60ab97c 100644 --- a/pkg/serve/tag_test.go +++ b/pkg/serve/tag_test.go @@ -90,3 +90,165 @@ func TestGroupViolations_Empty(t *testing.T) { t.Errorf("groupViolations(nil) = %+v, expected no groups", groups) } } + +func TestComputeTagOverallStatus(t *testing.T) { + buildGroup := func(name string, succeeded, running bool) PipelineGroup { + return PipelineGroup{Name: name, PipelineRuns: []PipelineRunInfo{{Succeeded: succeeded, Running: running}}} + } + mainRepoGreen := TagData{ + PipelineGroups: []PipelineGroup{buildGroup("build", true, false)}, + SnapshotName: "snap", + OperatorBundleImage: "bundle", + OperatorIndexImage: "index", + ConformaReleasePreview: ConformaResults{}, + } + + tests := []struct { + name string + isMainRep bool + data TagData + expected string + }{ + { + name: "green when everything is satisfied", + isMainRep: true, + data: mainRepoGreen, + expected: "green", + }, + { + name: "error when pipeline runs could not be retrieved", + isMainRep: true, + data: TagData{PipelinesError: true}, + expected: "error", + }, + { + name: "error when dev conforma results could not be retrieved", + isMainRep: true, + data: TagData{ConformaDev: ConformaResults{Error: true}}, + expected: "error", + }, + { + name: "error when release preview results could not be retrieved", + isMainRep: true, + data: TagData{ConformaReleasePreview: ConformaResults{Error: true}}, + expected: "error", + }, + { + name: "error when the custom snapshot is missing", + isMainRep: true, + data: func() TagData { + d := mainRepoGreen + d.SnapshotName = "" + return d + }(), + expected: "error", + }, + { + name: "error when the operator bundle image is missing", + isMainRep: true, + data: func() TagData { + d := mainRepoGreen + d.OperatorBundleImage = "" + return d + }(), + expected: "error", + }, + { + name: "error when the operator index image is missing", + isMainRep: true, + data: func() TagData { + d := mainRepoGreen + d.OperatorIndexImage = "" + return d + }(), + expected: "error", + }, + { + name: "failed when there are release preview violations", + isMainRep: true, + data: func() TagData { + d := mainRepoGreen + d.ConformaReleasePreview.Violations = []Violation{{Image: "main-4-10", Violation: "v"}} + return d + }(), + expected: "failed", + }, + { + name: "failed when release preview runs were skipped", + isMainRep: true, + data: func() TagData { + d := mainRepoGreen + d.ConformaReleasePreview.SkippedRuns = []ConformaRun{{Name: "run"}} + return d + }(), + expected: "failed", + }, + { + name: "failed when the latest build pipeline run failed", + isMainRep: true, + data: func() TagData { + d := mainRepoGreen + d.PipelineGroups = []PipelineGroup{buildGroup("build", false, false)} + return d + }(), + expected: "failed", + }, + { + name: "waiting when release preview runs are in progress", + isMainRep: true, + data: func() TagData { + d := mainRepoGreen + d.ConformaReleasePreview.InProgressRuns = []ConformaRun{{Name: "run"}} + return d + }(), + expected: "waiting", + }, + { + name: "waiting when the latest build pipeline run is running", + isMainRep: true, + data: func() TagData { + d := mainRepoGreen + d.PipelineGroups = []PipelineGroup{buildGroup("build", false, true)} + return d + }(), + expected: "waiting", + }, + { + name: "failed takes precedence over waiting", + isMainRep: true, + data: func() TagData { + d := mainRepoGreen + d.PipelineGroups = []PipelineGroup{buildGroup("a", false, true), buildGroup("b", false, false)} + return d + }(), + expected: "failed", + }, + { + name: "green for other repositories with only green builds", + isMainRep: false, + data: TagData{PipelineGroups: []PipelineGroup{buildGroup("build", true, false)}}, + expected: "green", + }, + { + name: "waiting for other repositories with a running build", + isMainRep: false, + data: TagData{PipelineGroups: []PipelineGroup{buildGroup("build", false, true)}}, + expected: "waiting", + }, + { + name: "failed for other repositories with a failed build", + isMainRep: false, + data: TagData{PipelineGroups: []PipelineGroup{buildGroup("build", false, false)}}, + expected: "failed", + }, + } + + for _, test := range tests { + t.Run(test.name, func(t *testing.T) { + computeTagOverallStatus(&test.data, test.isMainRep) + if test.data.OverallStatus != test.expected { + t.Errorf("computeTagOverallStatus() = %q, expected %q", test.data.OverallStatus, test.expected) + } + }) + } +} From 02cd00f51db82718cee8ad46da1d6f15b6fac094 Mon Sep 17 00:00:00 2001 From: Tom Martensen Date: Fri, 13 Nov 2026 13:06:24 +0100 Subject: [PATCH 15/29] serve: point the conforma policy note at the Release Preview widget The note no longer links to the custom snapshot's Konflux UI page but refers to the Conforma Release Preview widget on the same page. Co-Authored-By: Claude Code --- cmd/relacs/serve/templates/tag.html | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/cmd/relacs/serve/templates/tag.html b/cmd/relacs/serve/templates/tag.html index cb8e42f..f14aed2 100644 --- a/cmd/relacs/serve/templates/tag.html +++ b/cmd/relacs/serve/templates/tag.html @@ -6,10 +6,8 @@
Conforma violations here are for the acs-conforma-dev policy only and only for components defined in this repository (no results from retag-* pipelines).
- For a preview of the release like acs-conforma-prod-like policy results, review the Conforma run - attached to {{if - .SnapshotURL}}the custom - snapshot{{else}}the custom snapshot{{end}} for the tag in the stackrox repository. + For a preview of the release like acs-conforma-prod-like policy results, review the Conforma Release + Preview tab for the tag in the stackrox repository.
{{end}} From c2a81937be71299df5e12e393011baa350984622 Mon Sep 17 00:00:00 2001 From: Tom Martensen Date: Fri, 13 Nov 2026 13:15:29 +0100 Subject: [PATCH 16/29] serve: sort pipeline run groups into release milestones The Pipeline Runs widget groups the pipeline run groups into three milestones in order: all others, operator-bundle-on-push, and operator-index-on-push + create-custom-snapshot. Each milestone is a collapsible section with a combined status (passed/running/failed, failed taking precedence over running) computed from the latest run of each of its groups. Empty milestones are dropped. Co-Authored-By: Claude Code --- cmd/relacs/serve/templates/tag.html | 77 ++++++++++++++--------- pkg/serve/tag.go | 88 ++++++++++++++++++++++++++- pkg/serve/tag_test.go | 94 +++++++++++++++++++++++++++++ 3 files changed, 227 insertions(+), 32 deletions(-) diff --git a/cmd/relacs/serve/templates/tag.html b/cmd/relacs/serve/templates/tag.html index f14aed2..98e01b9 100644 --- a/cmd/relacs/serve/templates/tag.html +++ b/cmd/relacs/serve/templates/tag.html @@ -201,47 +201,64 @@

Artifacts

{{if not .PipelineGroups}}

No pipeline runs found.

{{else}} - {{range .PipelineGroups}} + {{range .PipelineMilestones}}
▶ {{.Name}} - {{if .AllPassed}} + {{if eq .Status "passed"}} passed + {{else if eq .Status "running"}} + running {{else}} failed {{end}} ({{len - .PipelineRuns}}) + .Groups}} group(s)) - - - - - - - - - - - - {{range .PipelineRuns}} - - - - - - - + {{range .Groups}} +
+ + ▶ + {{.Name}} + {{if .AllPassed}} + passed + {{else}} + failed {{end}} -
-
NameCreatedEvent TypeStatusReason
{{.Name}}{{.CreationTimestamp.Format "2006-01-02 15:04:05"}}{{.EventType}} - {{if .Succeeded}} - Succeeded - {{else}} - Failed - {{end}} - {{.Reason}}
+ ({{len + .PipelineRuns}}) + + + + + + + + + + + + + {{range .PipelineRuns}} + + + + + + + + {{end}} + +
NameCreatedEvent TypeStatusReason
{{.Name}}{{.CreationTimestamp.Format "2006-01-02 15:04:05"}}{{.EventType}} + {{if .Succeeded}} + Succeeded + {{else}} + Failed + {{end}} + {{.Reason}}
+
+ {{end}} {{end}} {{end}} diff --git a/pkg/serve/tag.go b/pkg/serve/tag.go index a3bb2c5..f18cf37 100644 --- a/pkg/serve/tag.go +++ b/pkg/serve/tag.go @@ -23,6 +23,88 @@ type PipelineGroup struct { AllPassed bool } +// PipelineMilestone sorts the pipeline run groups into the release +// milestones, in order: everything else, the operator bundle, and the +// operator index and custom snapshot. +type PipelineMilestone struct { + Name string + Status string // "passed", "running", "failed" + Groups []PipelineGroup +} + +// pipelineMilestoneOrder lists the milestones in display order. A milestone +// with no group names collects all groups that belong to no other milestone. +var pipelineMilestoneOrder = []struct { + Name string + Names []string +}{ + {Name: "Others"}, + {Name: "operator-bundle-on-push", Names: []string{"operator-bundle-on-push"}}, + {Name: "operator-index-on-push, create-custom-snapshot", Names: []string{"operator-index-on-push", "create-custom-snapshot"}}, +} + +// groupPipelineMilestones sorts the groups into the release milestones and +// computes each milestone's combined status from the latest run of each of +// its groups. Empty milestones are dropped. +func groupPipelineMilestones(groups []PipelineGroup) []PipelineMilestone { + membership := map[string]int{} + for i, milestone := range pipelineMilestoneOrder { + for _, name := range milestone.Names { + membership[name] = i + } + } + + byMilestone := make([][]PipelineGroup, len(pipelineMilestoneOrder)) + for _, g := range groups { + idx, ok := membership[g.Name] + if !ok { + idx = 0 + } + byMilestone[idx] = append(byMilestone[idx], g) + } + + var milestones []PipelineMilestone + for i, milestone := range pipelineMilestoneOrder { + if len(byMilestone[i]) == 0 { + continue + } + milestones = append(milestones, PipelineMilestone{ + Name: milestone.Name, + Status: milestoneStatus(byMilestone[i]), + Groups: byMilestone[i], + }) + } + return milestones +} + +// milestoneStatus is the combined status of a milestone's groups: "failed" +// when the latest run of any group did not succeed and is not running, +// "running" while any latest run is still running, and "passed" otherwise. +func milestoneStatus(groups []PipelineGroup) string { + failed, running := false, false + for _, g := range groups { + if len(g.PipelineRuns) == 0 { + continue + } + latest := g.PipelineRuns[0] + switch { + case latest.Succeeded: + case latest.Running: + running = true + default: + failed = true + } + } + switch { + case failed: + return "failed" + case running: + return "running" + default: + return "passed" + } +} + type PipelineRunInfo struct { Name string CreationTimestamp time.Time @@ -113,8 +195,9 @@ type TagData struct { OperatorBundleImage string OperatorIndexImage string - PipelineGroups []PipelineGroup - PipelinesError bool + PipelineGroups []PipelineGroup + PipelineMilestones []PipelineMilestone + PipelinesError bool // ConformaDev holds the acs-conforma-dev results, ConformaReleasePreview // the acs-conforma-prod-like results (main repository only). @@ -460,6 +543,7 @@ func FetchTagData(ctx context.Context, c *client.Client, repo, tag string) TagDa } else { ComputeGroupStatus(groups) data.PipelineGroups = groups + data.PipelineMilestones = groupPipelineMilestones(groups) } } } diff --git a/pkg/serve/tag_test.go b/pkg/serve/tag_test.go index 60ab97c..8d98ef3 100644 --- a/pkg/serve/tag_test.go +++ b/pkg/serve/tag_test.go @@ -91,6 +91,100 @@ func TestGroupViolations_Empty(t *testing.T) { } } +func TestGroupPipelineMilestones(t *testing.T) { + group := func(name string, succeeded, running bool) PipelineGroup { + return PipelineGroup{Name: name, PipelineRuns: []PipelineRunInfo{{Succeeded: succeeded, Running: running}}} + } + + groups := []PipelineGroup{ + group("operator-index-on-push", true, false), + group("main-on-push", false, true), + group("create-custom-snapshot", true, false), + group("operator-bundle-on-push", false, false), + group("retag-main", true, false), + } + + milestones := groupPipelineMilestones(groups) + + expected := []PipelineMilestone{ + { + Name: "Others", + Status: "running", // main-on-push is running, retag-main passed + Groups: []PipelineGroup{group("main-on-push", false, true), group("retag-main", true, false)}, + }, + { + Name: "operator-bundle-on-push", + Status: "failed", + Groups: []PipelineGroup{group("operator-bundle-on-push", false, false)}, + }, + { + Name: "operator-index-on-push, create-custom-snapshot", + Status: "passed", + Groups: []PipelineGroup{group("operator-index-on-push", true, false), group("create-custom-snapshot", true, false)}, + }, + } + + if !reflect.DeepEqual(milestones, expected) { + t.Errorf("groupPipelineMilestones() = %+v, expected %+v", milestones, expected) + } +} + +func TestGroupPipelineMilestones_DropsEmptyMilestones(t *testing.T) { + // A non-main repository has no operator bundle/index pipelines. + groups := []PipelineGroup{{Name: "main-on-push", PipelineRuns: []PipelineRunInfo{{Succeeded: true}}}} + + milestones := groupPipelineMilestones(groups) + + if len(milestones) != 1 || milestones[0].Name != "Others" { + t.Errorf("groupPipelineMilestones() = %+v, expected only the Others milestone", milestones) + } +} + +func TestMilestoneStatus(t *testing.T) { + tests := []struct { + name string + groups []PipelineGroup + expected string + }{ + { + name: "passed when all latest runs succeeded", + groups: []PipelineGroup{{PipelineRuns: []PipelineRunInfo{{Succeeded: true}}}}, + expected: "passed", + }, + { + name: "running while a latest run is running", + groups: []PipelineGroup{{PipelineRuns: []PipelineRunInfo{{Running: true}}}}, + expected: "running", + }, + { + name: "failed when a latest run failed", + groups: []PipelineGroup{{PipelineRuns: []PipelineRunInfo{{}}}}, + expected: "failed", + }, + { + name: "failed takes precedence over running", + groups: []PipelineGroup{ + {PipelineRuns: []PipelineRunInfo{{Running: true}}}, + {PipelineRuns: []PipelineRunInfo{{}}}, + }, + expected: "failed", + }, + { + name: "passed for groups without runs", + groups: []PipelineGroup{{}}, + expected: "passed", + }, + } + + for _, test := range tests { + t.Run(test.name, func(t *testing.T) { + if got := milestoneStatus(test.groups); got != test.expected { + t.Errorf("milestoneStatus() = %q, expected %q", got, test.expected) + } + }) + } +} + func TestComputeTagOverallStatus(t *testing.T) { buildGroup := func(name string, succeeded, running bool) PipelineGroup { return PipelineGroup{Name: name, PipelineRuns: []PipelineRunInfo{{Succeeded: succeeded, Running: running}}} From 3afc51703b7e5eadcdc91555ce8c0f6820faba0d Mon Sep 17 00:00:00 2001 From: Tom Martensen Date: Fri, 13 Nov 2026 13:18:04 +0100 Subject: [PATCH 17/29] serve: rename the pipeline milestones Rename the milestone sections to Operands & Operator, Operator Bundle, and Custom Snapshot & Index Image. Co-Authored-By: Claude Code --- pkg/serve/tag.go | 6 +++--- pkg/serve/tag_test.go | 10 +++++----- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/pkg/serve/tag.go b/pkg/serve/tag.go index f18cf37..11c0950 100644 --- a/pkg/serve/tag.go +++ b/pkg/serve/tag.go @@ -38,9 +38,9 @@ var pipelineMilestoneOrder = []struct { Name string Names []string }{ - {Name: "Others"}, - {Name: "operator-bundle-on-push", Names: []string{"operator-bundle-on-push"}}, - {Name: "operator-index-on-push, create-custom-snapshot", Names: []string{"operator-index-on-push", "create-custom-snapshot"}}, + {Name: "Operands & Operator"}, + {Name: "Operator Bundle", Names: []string{"operator-bundle-on-push"}}, + {Name: "Custom Snapshot & Index Image", Names: []string{"operator-index-on-push", "create-custom-snapshot"}}, } // groupPipelineMilestones sorts the groups into the release milestones and diff --git a/pkg/serve/tag_test.go b/pkg/serve/tag_test.go index 8d98ef3..4a2dd78 100644 --- a/pkg/serve/tag_test.go +++ b/pkg/serve/tag_test.go @@ -108,17 +108,17 @@ func TestGroupPipelineMilestones(t *testing.T) { expected := []PipelineMilestone{ { - Name: "Others", + Name: "Operands & Operator", Status: "running", // main-on-push is running, retag-main passed Groups: []PipelineGroup{group("main-on-push", false, true), group("retag-main", true, false)}, }, { - Name: "operator-bundle-on-push", + Name: "Operator Bundle", Status: "failed", Groups: []PipelineGroup{group("operator-bundle-on-push", false, false)}, }, { - Name: "operator-index-on-push, create-custom-snapshot", + Name: "Custom Snapshot & Index Image", Status: "passed", Groups: []PipelineGroup{group("operator-index-on-push", true, false), group("create-custom-snapshot", true, false)}, }, @@ -135,8 +135,8 @@ func TestGroupPipelineMilestones_DropsEmptyMilestones(t *testing.T) { milestones := groupPipelineMilestones(groups) - if len(milestones) != 1 || milestones[0].Name != "Others" { - t.Errorf("groupPipelineMilestones() = %+v, expected only the Others milestone", milestones) + if len(milestones) != 1 || milestones[0].Name != "Operands & Operator" { + t.Errorf("groupPipelineMilestones() = %+v, expected only the Operands & Operator milestone", milestones) } } From 08dddaf3579bbaeb76dad7ddeaeeb6d59fdd9771 Mon Sep 17 00:00:00 2001 From: Tom Martensen Date: Fri, 13 Nov 2026 13:19:51 +0100 Subject: [PATCH 18/29] serve: drop the conforma policy note from the status box The note remains in the Conforma Dev widget where it belongs. Co-Authored-By: Claude Code --- cmd/relacs/serve/templates/tag.html | 1 - 1 file changed, 1 deletion(-) diff --git a/cmd/relacs/serve/templates/tag.html b/cmd/relacs/serve/templates/tag.html index 98e01b9..dd37753 100644 --- a/cmd/relacs/serve/templates/tag.html +++ b/cmd/relacs/serve/templates/tag.html @@ -156,7 +156,6 @@

Status

{{end}} - {{template "conforma-policy-note" .}}
From 62c4f39a3e17497038c6cad5cf14be0bc51bdf94 Mon Sep 17 00:00:00 2001 From: Tom Martensen Date: Fri, 13 Nov 2026 13:22:05 +0100 Subject: [PATCH 19/29] serve: display the component label as the pipeline run group name Group headers under the milestones show the appstudio.openshift.io/component label (e.g. operator-bundle-5-0) instead of the pipeline name, falling back to the pipeline name when a run carries no component label. The pipeline name remains the grouping key and drives the milestone membership. Co-Authored-By: Claude Code --- cmd/relacs/serve/templates/tag.html | 2 +- pkg/serve/tag.go | 19 ++++++++-- pkg/serve/tag_test.go | 57 +++++++++++++++++++++++++++++ 3 files changed, 74 insertions(+), 4 deletions(-) diff --git a/cmd/relacs/serve/templates/tag.html b/cmd/relacs/serve/templates/tag.html index dd37753..f5727ee 100644 --- a/cmd/relacs/serve/templates/tag.html +++ b/cmd/relacs/serve/templates/tag.html @@ -219,7 +219,7 @@

Artifacts

▶ - {{.Name}} + {{.Component}} {{if .AllPassed}} passed {{else}} diff --git a/pkg/serve/tag.go b/pkg/serve/tag.go index 11c0950..9a67b6c 100644 --- a/pkg/serve/tag.go +++ b/pkg/serve/tag.go @@ -18,7 +18,13 @@ import ( ) type PipelineGroup struct { - Name string + // Name is the pipeline name (the pipelinesascode.tekton.dev/original-prname + // label); it is the grouping key and drives the milestone membership. + Name string + // Component is the group's display name: the + // appstudio.openshift.io/component label, falling back to the pipeline + // name when the runs carry no component label. + Component string PipelineRuns []PipelineRunInfo AllPassed bool } @@ -368,6 +374,7 @@ func convertPipelineRun(plr kflx.PipelineRun) (PipelineRunInfo, error) { func groupPipelineRuns(plrs []kflx.PipelineRun) ([]PipelineGroup, error) { groupMap := map[string][]PipelineRunInfo{} + components := map[string]string{} var groupOrder []string for _, plr := range plrs { @@ -381,6 +388,7 @@ func groupPipelineRuns(plrs []kflx.PipelineRun) ([]PipelineGroup, error) { } if _, exists := groupMap[name]; !exists { groupOrder = append(groupOrder, name) + components[name] = plr.Metadata.Labels["appstudio.openshift.io/component"] } groupMap[name] = append(groupMap[name], info) } @@ -388,10 +396,15 @@ func groupPipelineRuns(plrs []kflx.PipelineRun) ([]PipelineGroup, error) { sort.Strings(groupOrder) groups := make([]PipelineGroup, 0, len(groupOrder)) for _, name := range groupOrder { - groups = append(groups, PipelineGroup{ + group := PipelineGroup{ Name: name, + Component: name, PipelineRuns: groupMap[name], - }) + } + if component := components[name]; component != "" { + group.Component = component + } + groups = append(groups, group) } return groups, nil } diff --git a/pkg/serve/tag_test.go b/pkg/serve/tag_test.go index 4a2dd78..53c32a6 100644 --- a/pkg/serve/tag_test.go +++ b/pkg/serve/tag_test.go @@ -3,6 +3,9 @@ package serve import ( "reflect" "testing" + "time" + + kflx "github.com/stackrox/relacs/pkg/client/konflux" ) func TestViolationImageGroup(t *testing.T) { @@ -91,6 +94,60 @@ func TestGroupViolations_Empty(t *testing.T) { } } +func TestGroupPipelineRuns_ComponentNames(t *testing.T) { + newPipelineRun := func(name, pipeline, component string) kflx.PipelineRun { + labels := map[string]string{ + "pipelinesascode.tekton.dev/original-prname": pipeline, + } + if component != "" { + labels["appstudio.openshift.io/component"] = component + } + created := time.Date(2025, 1, 1, 0, 0, 0, 0, time.UTC) + return kflx.PipelineRun{ + Metadata: kflx.Metadata{ + Name: name, + CreationTimestamp: &created, + Labels: labels, + }, + Status: kflx.PipelineRunStatus{ + Conditions: []kflx.PipelineRunCondition{ + {Type: "Succeeded", Status: "True", Reason: "Succeeded"}, + }, + }, + } + } + + plrs := []kflx.PipelineRun{ + newPipelineRun("plr-1", "operator-bundle-on-push", "operator-bundle-5-0"), + newPipelineRun("plr-2", "operator-bundle-on-push", "operator-bundle-5-0"), + newPipelineRun("plr-3", "create-custom-snapshot", ""), + } + + groups, err := groupPipelineRuns(plrs) + + if err != nil { + t.Fatalf("groupPipelineRuns() unexpected error: %v", err) + } + if len(groups) != 2 { + t.Fatalf("groupPipelineRuns() returned %d groups, expected 2", len(groups)) + } + byName := map[string]PipelineGroup{} + for _, g := range groups { + byName[g.Name] = g + } + bundle := byName["operator-bundle-on-push"] + if bundle.Component != "operator-bundle-5-0" { + t.Errorf("operator-bundle-on-push component = %q, expected operator-bundle-5-0", bundle.Component) + } + if len(bundle.PipelineRuns) != 2 { + t.Errorf("operator-bundle-on-push group has %d runs, expected 2", len(bundle.PipelineRuns)) + } + snapshot := byName["create-custom-snapshot"] + if snapshot.Component != "create-custom-snapshot" { + t.Errorf("create-custom-snapshot component = %q, expected fallback to the pipeline name", snapshot.Component) + } +} + func TestGroupPipelineMilestones(t *testing.T) { group := func(name string, succeeded, running bool) PipelineGroup { return PipelineGroup{Name: name, PipelineRuns: []PipelineRunInfo{{Succeeded: succeeded, Running: running}}} From 856c10482e65cfe8262af799937e755460d756a0 Mon Sep 17 00:00:00 2001 From: Tom Martensen Date: Fri, 13 Nov 2026 14:31:59 +0100 Subject: [PATCH 20/29] serve: add retest instructions modal to the pipeline milestones Each milestone section shows a retest button that opens a modal with one /konflux-retest tag: command per currently failed pipeline of the milestone, to be posted as a comment on the tagged commit (linked). The button is only enabled when all groups of the previous milestone succeeded; the first milestone is always enabled. Milestones without failed pipelines show no button. Co-Authored-By: Claude Code --- cmd/relacs/serve/templates/static/style.css | 5 +++ cmd/relacs/serve/templates/tag.html | 47 +++++++++++++++++--- pkg/serve/tag.go | 25 +++++++++-- pkg/serve/tag_test.go | 49 +++++++++++++++++---- 4 files changed, 108 insertions(+), 18 deletions(-) diff --git a/cmd/relacs/serve/templates/static/style.css b/cmd/relacs/serve/templates/static/style.css index bcc5ed5..bb54045 100644 --- a/cmd/relacs/serve/templates/static/style.css +++ b/cmd/relacs/serve/templates/static/style.css @@ -88,6 +88,11 @@ details[open] > summary .chevron { transform: rotate(90deg); } .tab { background: none; border: none; border-bottom: 2px solid transparent; padding: 0.5rem 0.75rem; font-size: 0.9rem; font-weight: 500; color: var(--color-text-secondary); cursor: pointer; } .tab:hover { color: var(--color-text); } .tab.active { color: var(--color-text); border-bottom-color: var(--color-link); } +.retest-button { background: none; border: none; cursor: pointer; font-size: 1rem; padding: 0 0.25rem; margin-left: 0.5rem; } +.retest-button.disabled { opacity: 0.4; cursor: not-allowed; } +.modal { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0, 0, 0, 0.5); display: flex; align-items: center; justify-content: center; z-index: 100; } +.modal-content { max-width: 640px; width: 90%; } +.modal-content pre { white-space: pre-wrap; word-break: break-all; background: var(--color-bg); border: 1px solid var(--color-border); border-radius: 8px; padding: 0.75rem 1rem; } .errors li { margin-left: 1.25rem; color: var(--color-failed); } input[type="text"], input[type="number"], select { padding: 0.5rem 0.75rem; diff --git a/cmd/relacs/serve/templates/tag.html b/cmd/relacs/serve/templates/tag.html index f5727ee..13469c2 100644 --- a/cmd/relacs/serve/templates/tag.html +++ b/cmd/relacs/serve/templates/tag.html @@ -200,22 +200,30 @@

Artifacts

{{if not .PipelineGroups}}

No pipeline runs found.

{{else}} - {{range .PipelineMilestones}} + {{range $i, $m := .PipelineMilestones}}
▶ - {{.Name}} - {{if eq .Status "passed"}} + {{$m.Name}} + {{if eq $m.Status "passed"}} passed - {{else if eq .Status "running"}} + {{else if eq $m.Status "running"}} running {{else}} failed {{end}} ({{len - .Groups}} group(s)) + $m.Groups}} group(s)) + {{if $m.FailedPipelines}} + {{if $m.Retestable}} + + {{else}} + 🔁 + {{end}} + {{end}} - {{range .Groups}} + {{range $m.Groups}}
▶ @@ -258,6 +266,25 @@

Artifacts

{{end}} + {{if $m.FailedPipelines}} + + {{end}}
{{end}} {{end}} @@ -328,5 +355,13 @@

Artifacts

for (var i = 0; i < archFilters.length; i++) { filterViolations(archFilters[i]); } + function showRetestModal(id) { + document.getElementById(id).style.display = 'flex'; + } + function hideRetestModal(event, id) { + if (event.target === document.getElementById(id)) { + document.getElementById(id).style.display = 'none'; + } + } {{end}} diff --git a/pkg/serve/tag.go b/pkg/serve/tag.go index 9a67b6c..1202288 100644 --- a/pkg/serve/tag.go +++ b/pkg/serve/tag.go @@ -36,6 +36,12 @@ type PipelineMilestone struct { Name string Status string // "passed", "running", "failed" Groups []PipelineGroup + // FailedPipelines lists the pipeline names of the groups whose latest + // run failed; they are the candidates for a /konflux-retest. + FailedPipelines []string + // Retestable reports whether the milestone's retest button is enabled: + // all groups of the previous milestone succeeded. + Retestable bool } // pipelineMilestoneOrder lists the milestones in display order. A milestone @@ -74,10 +80,23 @@ func groupPipelineMilestones(groups []PipelineGroup) []PipelineMilestone { if len(byMilestone[i]) == 0 { continue } + // A milestone is retestable when all groups of the previous + // milestone succeeded; an empty previous milestone counts as passed. + retestable := i == 0 || milestoneStatus(byMilestone[i-1]) == "passed" + + var failedPipelines []string + for _, g := range byMilestone[i] { + if len(g.PipelineRuns) > 0 && !g.PipelineRuns[0].Succeeded && !g.PipelineRuns[0].Running { + failedPipelines = append(failedPipelines, g.Name) + } + } + milestones = append(milestones, PipelineMilestone{ - Name: milestone.Name, - Status: milestoneStatus(byMilestone[i]), - Groups: byMilestone[i], + Name: milestone.Name, + Status: milestoneStatus(byMilestone[i]), + Groups: byMilestone[i], + FailedPipelines: failedPipelines, + Retestable: retestable, }) } return milestones diff --git a/pkg/serve/tag_test.go b/pkg/serve/tag_test.go index 53c32a6..3703560 100644 --- a/pkg/serve/tag_test.go +++ b/pkg/serve/tag_test.go @@ -165,19 +165,24 @@ func TestGroupPipelineMilestones(t *testing.T) { expected := []PipelineMilestone{ { - Name: "Operands & Operator", - Status: "running", // main-on-push is running, retag-main passed - Groups: []PipelineGroup{group("main-on-push", false, true), group("retag-main", true, false)}, + Name: "Operands & Operator", + Status: "running", // main-on-push is running, retag-main passed + Groups: []PipelineGroup{group("main-on-push", false, true), group("retag-main", true, false)}, + FailedPipelines: nil, // the running group is not failed + Retestable: true, }, { - Name: "Operator Bundle", - Status: "failed", - Groups: []PipelineGroup{group("operator-bundle-on-push", false, false)}, + Name: "Operator Bundle", + Status: "failed", + Groups: []PipelineGroup{group("operator-bundle-on-push", false, false)}, + FailedPipelines: []string{"operator-bundle-on-push"}, + Retestable: false, // the previous milestone is still running }, { - Name: "Custom Snapshot & Index Image", - Status: "passed", - Groups: []PipelineGroup{group("operator-index-on-push", true, false), group("create-custom-snapshot", true, false)}, + Name: "Custom Snapshot & Index Image", + Status: "passed", + Groups: []PipelineGroup{group("operator-index-on-push", true, false), group("create-custom-snapshot", true, false)}, + Retestable: false, // the previous milestone failed }, } @@ -186,6 +191,32 @@ func TestGroupPipelineMilestones(t *testing.T) { } } +func TestGroupPipelineMilestones_Retestable(t *testing.T) { + group := func(name string, succeeded, running bool) PipelineGroup { + return PipelineGroup{Name: name, PipelineRuns: []PipelineRunInfo{{Succeeded: succeeded, Running: running}}} + } + + groups := []PipelineGroup{ + group("main-on-push", true, false), + group("operator-bundle-on-push", false, false), + group("create-custom-snapshot", true, false), + } + + milestones := groupPipelineMilestones(groups) + + // The first milestone passed, so the failed Operator Bundle milestone is + // retestable; it failed, so the last milestone is not. + if !milestones[1].Retestable { + t.Error("Operator Bundle milestone expected to be retestable") + } + if !reflect.DeepEqual(milestones[1].FailedPipelines, []string{"operator-bundle-on-push"}) { + t.Errorf("Operator Bundle FailedPipelines = %v, expected [operator-bundle-on-push]", milestones[1].FailedPipelines) + } + if milestones[2].Retestable { + t.Error("Custom Snapshot & Index Image milestone expected not to be retestable") + } +} + func TestGroupPipelineMilestones_DropsEmptyMilestones(t *testing.T) { // A non-main repository has no operator bundle/index pipelines. groups := []PipelineGroup{{Name: "main-on-push", PipelineRuns: []PipelineRunInfo{{Succeeded: true}}}} From ca0d2b01c0af6181460179e679755584e1abb528 Mon Sep 17 00:00:00 2001 From: Tom Martensen Date: Fri, 13 Nov 2026 14:33:04 +0100 Subject: [PATCH 21/29] serve: right-align the pipeline milestone retest button Co-Authored-By: Claude Code --- cmd/relacs/serve/templates/static/style.css | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmd/relacs/serve/templates/static/style.css b/cmd/relacs/serve/templates/static/style.css index bb54045..f25e86a 100644 --- a/cmd/relacs/serve/templates/static/style.css +++ b/cmd/relacs/serve/templates/static/style.css @@ -88,7 +88,7 @@ details[open] > summary .chevron { transform: rotate(90deg); } .tab { background: none; border: none; border-bottom: 2px solid transparent; padding: 0.5rem 0.75rem; font-size: 0.9rem; font-weight: 500; color: var(--color-text-secondary); cursor: pointer; } .tab:hover { color: var(--color-text); } .tab.active { color: var(--color-text); border-bottom-color: var(--color-link); } -.retest-button { background: none; border: none; cursor: pointer; font-size: 1rem; padding: 0 0.25rem; margin-left: 0.5rem; } +.retest-button { background: none; border: none; cursor: pointer; font-size: 1rem; padding: 0 0.25rem; margin-left: auto; } .retest-button.disabled { opacity: 0.4; cursor: not-allowed; } .modal { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0, 0, 0, 0.5); display: flex; align-items: center; justify-content: center; z-index: 100; } .modal-content { max-width: 640px; width: 90%; } From dea5c05606b2a73ad152ece9b71a5d84eebf11ff Mon Sep 17 00:00:00 2001 From: Tom Martensen Date: Fri, 13 Nov 2026 14:38:10 +0100 Subject: [PATCH 22/29] serve: show running status for pipeline groups and widget A running pipeline run group used to be badged as failed because only the latest run's success was considered. ComputeGroupStatus now also sets a group-level Running flag, the Pipeline Runs widget header shows running when at least one group is running and none failed (new PipelinesRunning flag), the run table rows and the Status card's Pipelines row distinguish running from failed as well. Co-Authored-By: Claude Code --- cmd/relacs/serve/templates/tag.html | 8 ++++ pkg/serve/tag.go | 12 +++++- pkg/serve/tag_test.go | 63 +++++++++++++++++++++++++++++ 3 files changed, 82 insertions(+), 1 deletion(-) diff --git a/cmd/relacs/serve/templates/tag.html b/cmd/relacs/serve/templates/tag.html index 13469c2..1266759 100644 --- a/cmd/relacs/serve/templates/tag.html +++ b/cmd/relacs/serve/templates/tag.html @@ -125,6 +125,8 @@

Status

Error fetching data {{else if .AllPipelinesPassed}} All passed + {{else if .PipelinesRunning}} + Running {{else}} Some failed {{end}} @@ -193,6 +195,8 @@

Artifacts

error {{else if .AllPipelinesPassed}} passed + {{else if .PipelinesRunning}} + running {{else}} failed {{end}} @@ -230,6 +234,8 @@

Artifacts

{{.Component}} {{if .AllPassed}} passed + {{else if .Running}} + running {{else}} failed {{end}} @@ -255,6 +261,8 @@

Artifacts

{{if .Succeeded}} Succeeded + {{else if .Running}} + Running {{else}} Failed {{end}} diff --git a/pkg/serve/tag.go b/pkg/serve/tag.go index 1202288..7d84184 100644 --- a/pkg/serve/tag.go +++ b/pkg/serve/tag.go @@ -27,6 +27,8 @@ type PipelineGroup struct { Component string PipelineRuns []PipelineRunInfo AllPassed bool + // Running reports whether the group's latest run is still running. + Running bool } // PipelineMilestone sorts the pipeline run groups into the release @@ -211,7 +213,10 @@ type TagData struct { OverallStatus string // "passed", "failed", "warning" AllPipelinesPassed bool - HasViolations bool + // PipelinesRunning reports whether build pipeline runs are still running + // and none failed; it drives the Pipeline Runs widget's running status. + PipelinesRunning bool + HasViolations bool CommitSHA string CommitURL string @@ -260,6 +265,7 @@ func computeTagOverallStatus(data *TagData, isMainRepo bool) { failed := isMainRepo && (len(data.ConformaReleasePreview.Violations) > 0 || len(data.ConformaReleasePreview.SkippedRuns) > 0) waiting := isMainRepo && len(data.ConformaReleasePreview.InProgressRuns) > 0 + buildFailed, buildRunning := false, false for _, g := range data.PipelineGroups { if len(g.PipelineRuns) == 0 { continue @@ -269,11 +275,14 @@ func computeTagOverallStatus(data *TagData, isMainRepo bool) { continue } if latest.Running { + buildRunning = true waiting = true } else { + buildFailed = true failed = true } } + data.PipelinesRunning = buildRunning && !buildFailed switch { case failed: @@ -365,6 +374,7 @@ func ComputeGroupStatus(groups []PipelineGroup) { groups[i].PipelineRuns = runs if len(runs) > 0 { groups[i].AllPassed = runs[0].Succeeded + groups[i].Running = !runs[0].Succeeded && runs[0].Running } } } diff --git a/pkg/serve/tag_test.go b/pkg/serve/tag_test.go index 3703560..cd897fb 100644 --- a/pkg/serve/tag_test.go +++ b/pkg/serve/tag_test.go @@ -434,3 +434,66 @@ func TestComputeTagOverallStatus(t *testing.T) { }) } } + +func TestComputeTagOverallStatus_PipelinesRunning(t *testing.T) { + buildGroup := func(name string, succeeded, running bool) PipelineGroup { + return PipelineGroup{Name: name, PipelineRuns: []PipelineRunInfo{{Succeeded: succeeded, Running: running}}} + } + + tests := []struct { + name string + groups []PipelineGroup + expectRunning bool + }{ + { + name: "running when all latest runs are running", + groups: []PipelineGroup{buildGroup("a", false, true), buildGroup("b", false, true)}, + expectRunning: true, + }, + { + name: "not running when a latest run failed", + groups: []PipelineGroup{buildGroup("a", false, true), buildGroup("b", false, false)}, + expectRunning: false, + }, + { + name: "not running when all latest runs succeeded", + groups: []PipelineGroup{buildGroup("a", true, false)}, + expectRunning: false, + }, + } + + for _, test := range tests { + t.Run(test.name, func(t *testing.T) { + data := TagData{PipelineGroups: test.groups} + computeTagOverallStatus(&data, false) + if data.PipelinesRunning != test.expectRunning { + t.Errorf("PipelinesRunning = %v, expected %v", data.PipelinesRunning, test.expectRunning) + } + }) + } +} + +func TestComputeGroupStatus_Running(t *testing.T) { + newer := time.Date(2025, 2, 1, 0, 0, 0, 0, time.UTC) + older := time.Date(2025, 1, 1, 0, 0, 0, 0, time.UTC) + + groups := []PipelineGroup{{ + Name: "scanner-on-push", + PipelineRuns: []PipelineRunInfo{ + {Name: "old", CreationTimestamp: older, Succeeded: true}, + {Name: "new", CreationTimestamp: newer, Running: true}, + }, + }} + + ComputeGroupStatus(groups) + + if groups[0].AllPassed { + t.Error("AllPassed = true, expected false for a running latest run") + } + if !groups[0].Running { + t.Error("Running = false, expected true for a running latest run") + } + if groups[0].PipelineRuns[0].Name != "new" { + t.Errorf("latest run = %q, expected the newest run to be sorted first", groups[0].PipelineRuns[0].Name) + } +} From 71f05f07021407053ba205192747aea81e0549d5 Mon Sep 17 00:00:00 2001 From: Tom Martensen Date: Fri, 13 Nov 2026 14:41:31 +0100 Subject: [PATCH 23/29] serve: compute the pipeline running status before the error return The overall status computation returns early on retrieval errors, which skipped the PipelinesRunning computation and left the Pipeline Runs widget showing failed while pipelines were running (e.g. a tag whose conforma fetch errored). Compute the build pipeline running status before the error early-return; the overall status logic now reuses the same pass. Co-Authored-By: Claude Code --- pkg/serve/tag.go | 41 +++++++++++++++++++++-------------------- pkg/serve/tag_test.go | 18 ++++++++++++++++++ 2 files changed, 39 insertions(+), 20 deletions(-) diff --git a/pkg/serve/tag.go b/pkg/serve/tag.go index 7d84184..5d53687 100644 --- a/pkg/serve/tag.go +++ b/pkg/serve/tag.go @@ -247,24 +247,8 @@ func computeTagOverallStatus(data *TagData, isMainRepo bool) { } data.HasViolations = len(data.ConformaDev.Violations) > 0 - // The overall status is "error" when any data could not be retrieved, - // "failed" when prod-like violations were found, prod-like runs were - // skipped or the latest run of a build pipeline run group did not - // succeed, "waiting" while conforma or build pipeline runs are still in - // progress, and "green" only when every build pipeline run group's latest - // run succeeded and, for the main repository, the custom snapshot and the - // operator bundle and index images are present and there are no prod-like - // violations. For other repositories, green build pipeline runs are - // sufficient. - if data.PipelinesError || data.ConformaDev.Error || - (isMainRepo && (data.ConformaReleasePreview.Error || data.SnapshotName == "" || - data.OperatorBundleImage == "" || data.OperatorIndexImage == "")) { - data.OverallStatus = "error" - return - } - - failed := isMainRepo && (len(data.ConformaReleasePreview.Violations) > 0 || len(data.ConformaReleasePreview.SkippedRuns) > 0) - waiting := isMainRepo && len(data.ConformaReleasePreview.InProgressRuns) > 0 + // The pipeline widget's running status is independent of the overall + // status below, so compute it before the error early-return. buildFailed, buildRunning := false, false for _, g := range data.PipelineGroups { if len(g.PipelineRuns) == 0 { @@ -276,14 +260,31 @@ func computeTagOverallStatus(data *TagData, isMainRepo bool) { } if latest.Running { buildRunning = true - waiting = true } else { buildFailed = true - failed = true } } data.PipelinesRunning = buildRunning && !buildFailed + // The overall status is "error" when any data could not be retrieved, + // "failed" when prod-like violations were found, prod-like runs were + // skipped or the latest run of a build pipeline run group did not + // succeed, "waiting" while conforma or build pipeline runs are still in + // progress, and "green" only when every build pipeline run group's latest + // run succeeded and, for the main repository, the custom snapshot and the + // operator bundle and index images are present and there are no prod-like + // violations. For other repositories, green build pipeline runs are + // sufficient. + if data.PipelinesError || data.ConformaDev.Error || + (isMainRepo && (data.ConformaReleasePreview.Error || data.SnapshotName == "" || + data.OperatorBundleImage == "" || data.OperatorIndexImage == "")) { + data.OverallStatus = "error" + return + } + + failed := buildFailed || (isMainRepo && (len(data.ConformaReleasePreview.Violations) > 0 || len(data.ConformaReleasePreview.SkippedRuns) > 0)) + waiting := buildRunning || (isMainRepo && len(data.ConformaReleasePreview.InProgressRuns) > 0) + switch { case failed: data.OverallStatus = "failed" diff --git a/pkg/serve/tag_test.go b/pkg/serve/tag_test.go index cd897fb..49cdf41 100644 --- a/pkg/serve/tag_test.go +++ b/pkg/serve/tag_test.go @@ -473,6 +473,24 @@ func TestComputeTagOverallStatus_PipelinesRunning(t *testing.T) { } } +func TestComputeTagOverallStatus_PipelinesRunningDespiteError(t *testing.T) { + // The overall status errors out (e.g. the conforma fetch failed), but the + // pipeline widget still needs its running status. + data := TagData{ + ConformaDev: ConformaResults{Error: true}, + PipelineGroups: []PipelineGroup{{Name: "a", PipelineRuns: []PipelineRunInfo{{Running: true}}}}, + } + + computeTagOverallStatus(&data, false) + + if data.OverallStatus != "error" { + t.Errorf("OverallStatus = %q, expected error", data.OverallStatus) + } + if !data.PipelinesRunning { + t.Error("PipelinesRunning = false, expected true despite the overall error") + } +} + func TestComputeGroupStatus_Running(t *testing.T) { newer := time.Date(2025, 2, 1, 0, 0, 0, 0, time.UTC) older := time.Date(2025, 1, 1, 0, 0, 0, 0, time.UTC) From 98adbf9b5538ac7c0eebdfc4f7a0c2c66389099a Mon Sep 17 00:00:00 2001 From: Tom Martensen Date: Fri, 13 Nov 2026 14:45:37 +0100 Subject: [PATCH 24/29] serve: offer retest instructions per failed component group Each component group whose newest pipeline run failed (not running and not succeeded) shows a retest button that opens a modal with the single /konflux-retest command for that group's pipeline, gated by the same previous-milestone-passed rule as the milestone button. Co-Authored-By: Claude Code --- cmd/relacs/serve/templates/tag.html | 47 +++++++++++++++++++++++------ 1 file changed, 38 insertions(+), 9 deletions(-) diff --git a/cmd/relacs/serve/templates/tag.html b/cmd/relacs/serve/templates/tag.html index 1266759..54874ab 100644 --- a/cmd/relacs/serve/templates/tag.html +++ b/cmd/relacs/serve/templates/tag.html @@ -227,20 +227,28 @@

Artifacts

{{end}} {{end}}
- {{range $m.Groups}} + {{range $j, $g := $m.Groups}}
▶ - {{.Component}} - {{if .AllPassed}} + {{$g.Component}} + {{if $g.AllPassed}} passed - {{else if .Running}} + {{else if $g.Running}} running {{else}} failed {{end}} ({{len - .PipelineRuns}}) + $g.PipelineRuns}}) + {{if and (not $g.AllPassed) (not $g.Running)}} + {{if $m.Retestable}} + + {{else}} + 🔁 + {{end}} + {{end}} @@ -272,6 +280,25 @@

Artifacts

{{end}}
+ {{if and (not $g.AllPassed) (not $g.Running)}} + + {{end}}
{{end}} {{if $m.FailedPipelines}} @@ -279,8 +306,8 @@

Artifacts

onclick="hideRetestModal(event, 'retest-modal-{{$i}}')">
@@ -333,7 +361,8 @@

Retest failed pipelines

{{template "conforma-policy-note" .}} {{if .ConformaDev.Error}} -

Failed to fetch conforma violations. See errors above.

+

Failed to fetch conforma violations. See errors above. If no pipeline runs + are finished yet, revisit this page later.

{{else}} {{template "conforma-tabs" .DevTabs}} {{end}} From 59fd9d783e34ca0cc78b3d37b4ca117bc806107e Mon Sep 17 00:00:00 2001 From: Tom Martensen Date: Fri, 13 Nov 2026 14:55:14 +0100 Subject: [PATCH 25/29] serve: fix arch filter default and treat running conforma as waiting The initial architecture filter never applied because the element selector matched ids ending in "-arch-filter-" but the ids end in the group index; use a contains selector. The amd64 option is now explicitly selected as the default. While every conforma run is still in progress, ListConformaViolations now returns the partial result with the in-progress runs instead of erroring, so the serve page shows a running badge and the in-progress tab instead of an error box. The Conforma Dev violations row in the Status card shows Waiting while any pipeline run is still running, instead of a premature No violations. Co-Authored-By: Claude Code --- cmd/relacs/serve/templates/tag.html | 10 ++++-- pkg/konflux/conforma.go | 11 +++--- pkg/serve/tag.go | 4 +++ pkg/serve/tag_test.go | 44 +++++++++++++++++++++++ tests/konflux/conforma_violations_test.go | 7 ++-- 5 files changed, 66 insertions(+), 10 deletions(-) diff --git a/cmd/relacs/serve/templates/tag.html b/cmd/relacs/serve/templates/tag.html index 54874ab..480cc22 100644 --- a/cmd/relacs/serve/templates/tag.html +++ b/cmd/relacs/serve/templates/tag.html @@ -43,7 +43,7 @@ @@ -153,6 +153,8 @@

Status

Error fetching data {{else if .HasViolations}} {{len .ConformaDev.Violations}} violation(s) + {{else if or .ConformaDev.Waiting .PipelinesRunning}} + Waiting {{else}} No violations {{end}} @@ -335,6 +337,8 @@

Retest failed pipelines

error {{else if .ConformaReleasePreview.Violations}} {{len .ConformaReleasePreview.Violations}} violation(s) + {{else if .ConformaReleasePreview.Waiting}} + running {{else}} no violations {{end}} @@ -355,6 +359,8 @@

Retest failed pipelines

error {{else if .HasViolations}} {{len .ConformaDev.Violations}} violation(s) + {{else if .ConformaDev.Waiting}} + running {{else}} no violations {{end}} @@ -388,7 +394,7 @@

Retest failed pipelines

} // Apply the initially selected architecture (the first option) to each // group, since the dropdown has no "all" option. - var archFilters = document.querySelectorAll('select[id$="-arch-filter-"]'); + var archFilters = document.querySelectorAll('select[id*="-arch-filter-"]'); for (var i = 0; i < archFilters.length; i++) { filterViolations(archFilters[i]); } diff --git a/pkg/konflux/conforma.go b/pkg/konflux/conforma.go index a350232..8204d8b 100644 --- a/pkg/konflux/conforma.go +++ b/pkg/konflux/conforma.go @@ -52,7 +52,9 @@ type ConformaViolations struct { // ListConformaViolations returns the violations reported by the conforma // pipeline runs for the given tag and scenario. Runs that are still in // progress are listed in InProgressRuns, and runs whose report could not be -// retrieved (e.g. they failed before the report step ran) in SkippedRuns. +// retrieved (e.g. they failed before the report step ran) in SkippedRuns. It +// errors only when no report could be read at all because runs were skipped; +// while every run is still in progress, the partial result is returned. func ListConformaViolations(ctx context.Context, c *client.Client, org, repo, tag, scenario string) (ConformaViolations, error) { pipelineRuns, err := conformaPipelineRunsForScenario(ctx, c, org, repo, tag, scenario) if err != nil { @@ -107,12 +109,11 @@ func violationsFromPipelineRuns(ctx context.Context, c *client.Client, pipelineR result.Violations.Violations = append(result.Violations.Violations, runViolations.Violations...) reportsRead++ } - if reportsRead == 0 { - if len(result.SkippedRuns) == 0 { - return ConformaViolations{}, fmt.Errorf("conforma checks for tag %s are still in progress (%d run(s) running)", tag, len(result.InProgressRuns)) - } + if reportsRead == 0 && len(result.SkippedRuns) > 0 { return ConformaViolations{}, fmt.Errorf("failed to retrieve any conforma report for tag %s (%d run(s) still in progress)", tag, len(result.InProgressRuns)) } + // When every run is still in progress, the result is partial with the + // runs listed in InProgressRuns rather than an error. return result, nil } diff --git a/pkg/serve/tag.go b/pkg/serve/tag.go index 5d53687..5487de0 100644 --- a/pkg/serve/tag.go +++ b/pkg/serve/tag.go @@ -180,6 +180,9 @@ type ConformaResults struct { InProgressRuns []ConformaRun SkippedRuns []ConformaRun Error bool + // Waiting reports that the checks are still running and nothing has been + // verified yet. + Waiting bool } func convertConformaResult(result konflux.ConformaViolations) ConformaResults { @@ -189,6 +192,7 @@ func convertConformaResult(result konflux.ConformaViolations) ConformaResults { Groups: groupViolations(violations), InProgressRuns: convertConformaRuns(result.InProgressRuns), SkippedRuns: convertConformaRuns(result.SkippedRuns), + Waiting: len(result.InProgressRuns) > 0 && len(result.Violations.Violations) == 0 && len(result.SkippedRuns) == 0, } } diff --git a/pkg/serve/tag_test.go b/pkg/serve/tag_test.go index 49cdf41..2e57f57 100644 --- a/pkg/serve/tag_test.go +++ b/pkg/serve/tag_test.go @@ -6,6 +6,7 @@ import ( "time" kflx "github.com/stackrox/relacs/pkg/client/konflux" + "github.com/stackrox/relacs/pkg/konflux" ) func TestViolationImageGroup(t *testing.T) { @@ -273,6 +274,49 @@ func TestMilestoneStatus(t *testing.T) { } } +func TestConvertConformaResult_Waiting(t *testing.T) { + tests := []struct { + name string + result konflux.ConformaViolations + expected bool + }{ + { + name: "waiting when only in-progress runs", + result: konflux.ConformaViolations{InProgressRuns: []konflux.ConformaRunInfo{{Name: "run"}}}, + expected: true, + }, + { + name: "not waiting when violations were found", + result: konflux.ConformaViolations{ + Violations: konflux.Violations{Violations: []konflux.Violation{{Image: "main", Violation: "v"}}}, + InProgressRuns: []konflux.ConformaRunInfo{{Name: "run"}}, + }, + expected: false, + }, + { + name: "not waiting when runs were skipped", + result: konflux.ConformaViolations{ + SkippedRuns: []konflux.ConformaRunInfo{{Name: "run"}}, + InProgressRuns: []konflux.ConformaRunInfo{{Name: "run"}}, + }, + expected: false, + }, + { + name: "not waiting when everything was read", + result: konflux.ConformaViolations{}, + expected: false, + }, + } + + for _, test := range tests { + t.Run(test.name, func(t *testing.T) { + if got := convertConformaResult(test.result).Waiting; got != test.expected { + t.Errorf("Waiting = %v, expected %v", got, test.expected) + } + }) + } +} + func TestComputeTagOverallStatus(t *testing.T) { buildGroup := func(name string, succeeded, running bool) PipelineGroup { return PipelineGroup{Name: name, PipelineRuns: []PipelineRunInfo{{Succeeded: succeeded, Running: running}}} diff --git a/tests/konflux/conforma_violations_test.go b/tests/konflux/conforma_violations_test.go index c399b5f..17b96ff 100644 --- a/tests/konflux/conforma_violations_test.go +++ b/tests/konflux/conforma_violations_test.go @@ -230,16 +230,17 @@ func (s *ConformaViolationsTestSuite) TestListConformaRuns_ProdLike() { func (s *ConformaViolationsTestSuite) TestListConformaViolations_InProgress() { // Tekton reports a started run as a Succeeded condition with unknown - // status, not as an absent condition. + // status, not as an absent condition. With every run still in progress, + // the partial result is returned instead of an error. started := s.conformaPipelineRun("acs-conforma-dev-4-10-started", "uid-started", "main-4-10", s.startedConditions()) s.mockConformaPipelineRuns(started) result, err := s.listConformaViolations() - s.Require().Error(err) - s.Contains(err.Error(), "still in progress") + s.Require().NoError(err) s.Empty(result.Violations.Violations) s.Empty(result.SkippedRuns) + s.Equal([]relacskonflux.ConformaRunInfo{s.expectedRunInfo("acs-conforma-dev-4-10-started")}, result.InProgressRuns) s.True(gock.IsDone()) } From ac0d0e29916ea3ba70e2575892fa50f1fc6cf777 Mon Sep 17 00:00:00 2001 From: Tom Martensen Date: Fri, 13 Nov 2026 14:56:32 +0100 Subject: [PATCH 26/29] serve: show waiting badge on the Conforma Dev widget The Conforma Dev widget badge shows waiting instead of no violations while any pipeline run is still running, matching the Status card row. Co-Authored-By: Claude Code --- cmd/relacs/serve/templates/tag.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cmd/relacs/serve/templates/tag.html b/cmd/relacs/serve/templates/tag.html index 480cc22..d93f877 100644 --- a/cmd/relacs/serve/templates/tag.html +++ b/cmd/relacs/serve/templates/tag.html @@ -359,8 +359,8 @@

Retest failed pipelines

error {{else if .HasViolations}} {{len .ConformaDev.Violations}} violation(s) - {{else if .ConformaDev.Waiting}} - running + {{else if or .ConformaDev.Waiting .PipelinesRunning}} + waiting {{else}} no violations {{end}} From 169500128e36a48b6903e8e3eedfc9a68e4b9aca Mon Sep 17 00:00:00 2001 From: Tom Martensen Date: Fri, 13 Nov 2026 14:58:12 +0100 Subject: [PATCH 27/29] serve: copy button for the retest instructions The retest modals have a clipboard button that copies the /konflux-retest commands to the user's clipboard, with brief visual feedback. Co-Authored-By: Claude Code --- cmd/relacs/serve/templates/static/style.css | 3 +++ cmd/relacs/serve/templates/tag.html | 20 ++++++++++++++++++-- 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/cmd/relacs/serve/templates/static/style.css b/cmd/relacs/serve/templates/static/style.css index f25e86a..9df33f0 100644 --- a/cmd/relacs/serve/templates/static/style.css +++ b/cmd/relacs/serve/templates/static/style.css @@ -93,6 +93,9 @@ details[open] > summary .chevron { transform: rotate(90deg); } .modal { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0, 0, 0, 0.5); display: flex; align-items: center; justify-content: center; z-index: 100; } .modal-content { max-width: 640px; width: 90%; } .modal-content pre { white-space: pre-wrap; word-break: break-all; background: var(--color-bg); border: 1px solid var(--color-border); border-radius: 8px; padding: 0.75rem 1rem; } +.copy-wrapper { position: relative; } +.copy-button { position: absolute; top: 0.5rem; right: 0.5rem; background: var(--color-bg); border: 1px solid var(--color-border); border-radius: 6px; cursor: pointer; padding: 0.25rem 0.5rem; font-size: 0.85rem; } +.copy-button:hover { opacity: 0.8; } .errors li { margin-left: 1.25rem; color: var(--color-failed); } input[type="text"], input[type="number"], select { padding: 0.5rem 0.75rem; diff --git a/cmd/relacs/serve/templates/tag.html b/cmd/relacs/serve/templates/tag.html index d93f877..dfb76b0 100644 --- a/cmd/relacs/serve/templates/tag.html +++ b/cmd/relacs/serve/templates/tag.html @@ -290,7 +290,11 @@

Retest failed pipelines

To retest the failed pipelineruns, add a comment on {{if $.CommitURL}}{{slice $.CommitSHA 0 12}}{{else}}the tagged commit{{end}}.

-
/konflux-retest {{$g.Name}} tag:{{$.Tag}}
+
+
/konflux-retest {{$g.Name}} tag:{{$.Tag}}
+ +

Note: This command was generated to retest the currently failed pipelines. Succeeded and in progress pipelines are not retested. Revisit this page to see the latest status.

@@ -311,8 +315,12 @@

Retest failed pipelines

To retest the failed pipelineruns, add a comment on {{if $.CommitURL}}{{slice $.CommitSHA 0 12}}{{else}}the tagged commit{{end}}.

-
{{range $m.FailedPipelines}}/konflux-retest {{.}} tag:{{$.Tag}}
+                
+
{{range $m.FailedPipelines}}/konflux-retest {{.}} tag:{{$.Tag}}
 {{end}}
+ +

Note: This command was generated to retest the currently failed pipelines. Succeeded and in progress pipelines are not retested. Revisit this page to see the latest status.

@@ -406,5 +414,13 @@

Retest failed pipelines

document.getElementById(id).style.display = 'none'; } } + function copyRetestCommands(id, button) { + var text = document.getElementById(id).textContent.trim(); + navigator.clipboard.writeText(text).then(function () { + var original = button.innerHTML; + button.innerHTML = '✓ Copied'; + setTimeout(function () { button.innerHTML = original; }, 1500); + }); + } {{end}} From e4dfc5d1d243c867b0ec8511e9edec5fa926ea33 Mon Sep 17 00:00:00 2001 From: Tom Martensen Date: Fri, 13 Nov 2026 15:09:48 +0100 Subject: [PATCH 28/29] serve: one retest comment per failed pipeline in the milestone modal Retesting multiple pipelines takes one comment per pipeline, each with a single /konflux-retest command, not one combined comment. The milestone modal now shows one copyable command block per failed pipeline and the note reflects the plural. Co-Authored-By: Claude Code --- cmd/relacs/serve/templates/tag.html | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/cmd/relacs/serve/templates/tag.html b/cmd/relacs/serve/templates/tag.html index dfb76b0..6f10b11 100644 --- a/cmd/relacs/serve/templates/tag.html +++ b/cmd/relacs/serve/templates/tag.html @@ -312,17 +312,18 @@

Retest failed pipelines

onclick="hideRetestModal(event, 'retest-modal-{{$i}}')">