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}}
+
+
+
+
+
+
+ {{if not .PipelineGroups}}
+ No pipeline runs found.
+ {{else}}
+ {{range .PipelineGroups}}
+
+
+
+
+
+ | Name |
+ Created |
+ Event Type |
+ Status |
+ Reason |
+
+
+
+ {{range .PipelineRuns}}
+
+ | {{.Name}} |
+ {{.CreationTimestamp.Format "2006-01-02 15:04:05"}} |
+ {{.EventType}} |
+
+ {{if .Succeeded}}
+ Succeeded
+ {{else}}
+ Failed
+ {{end}}
+ |
+ {{.Reason}} |
+
+ {{end}}
+
+
+
+ {{end}}
+ {{end}}
+
+
+
+
+ {{if .ViolationsError}}
+ Failed to fetch conforma violations. See errors above.
+ {{else if not .Violations}}
+ No violations found.
+ {{else}}
+
+
+
+
+
+
+
+ | Image |
+ Violation |
+
+
+
+ {{range .Violations}}
+
+ | {{.Image}} |
+ {{.Violation}} |
+
+ {{end}}
+
+
+
+ {{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