Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .tekton/acs-mcp-server-pull-request.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,10 @@ spec:
value: '0'
- name: clone-fetch-tags
value: 'true'
- name: extra-labels
value:
# X.Y in the cpe label must be adjusted for every version stream.
- "cpe=cpe:/a:redhat:agentic_cluster_security_suite:0.2::el9"

pipelineRef:
name: basic-component-pipeline
Expand Down
4 changes: 4 additions & 0 deletions .tekton/acs-mcp-server-push.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,10 @@ spec:
- linux/arm64
- linux/ppc64le
- linux/s390x
- name: extra-labels
value:
# X.Y in the cpe label must be adjusted for every version stream.
- "cpe=cpe:/a:redhat:agentic_cluster_security_suite:0.2::el9"

pipelineRef:
name: basic-component-pipeline
Expand Down
40 changes: 40 additions & 0 deletions .tekton/basic-component-pipeline.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,44 @@ spec:
workspaces:
- name: basic-auth
workspace: git-auth

- name: determine-version
params:
- name: SOURCE_ARTIFACT
value: $(tasks.clone-repository.results.SOURCE_ARTIFACT)
runAfter:
- clone-repository
taskSpec:
params:
- name: SOURCE_ARTIFACT
type: string
results:
- name: VERSION
description: Version string derived from git tags.
volumes:
- name: workdir
emptyDir: {}
stepTemplate:
volumeMounts:
- mountPath: /var/workdir
name: workdir
steps:
- name: use-trusted-artifact
image: quay.io/redhat-appstudio/build-trusted-artifacts:latest@sha256:9b180776a41d9a22a1c51539f1647c60defbbd55b44bbebdd4130e33512d8b0d
args:
- use
- $(params.SOURCE_ARTIFACT)=/var/workdir/source
- name: determine-version
image: registry.access.redhat.com/ubi9/ubi-minimal:latest@sha256:2e8edce823a48e51858f1fad3ff4cbf6875ce8a3f86b9eecf298bc2050c8652a
Comment on lines +183 to +189

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔒 Security & Privacy | 🟠 Major | 🏗️ Heavy lift

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

printf '\n== File slice: .tekton/basic-component-pipeline.yaml ==\n'
nl -ba .tekton/basic-component-pipeline.yaml | sed -n '150,230p'

printf '\n== Search for image params/bundles in .tekton ==\n'
rg -n --hidden --glob '.tekton/**' '(params\.[A-Za-z0-9_-]*image|bundle|trusted-artifact|determine-version|quay.io/redhat-appstudio/build-trusted-artifacts|registry.access.redhat.com/ubi9/ubi-minimal)' .

printf '\n== List .tekton files ==\n'
git ls-files '.tekton/**'

Repository: stackrox/stackrox-mcp

Length of output: 256


🏁 Script executed:

#!/bin/bash
set -euo pipefail

printf '\n== File slice: .tekton/basic-component-pipeline.yaml ==\n'
sed -n '150,230p' .tekton/basic-component-pipeline.yaml | awk '{printf "%6d  %s\n", NR+149, $0}'

printf '\n== Search for image params/bundles in .tekton ==\n'
rg -n --hidden --glob '.tekton/**' '(params\.[A-Za-z0-9_-]*image|bundle|trusted-artifact|determine-version|quay.io/redhat-appstudio/build-trusted-artifacts|registry.access.redhat.com/ubi9/ubi-minimal)' .

printf '\n== List .tekton files ==\n'
git ls-files '.tekton/**'

Repository: stackrox/stackrox-mcp

Length of output: 7844


🏁 Script executed:

#!/bin/bash
set -euo pipefail

printf '\n== File slice: .tekton/basic-component-pipeline.yaml ==\n'
python3 - <<'PY'
from pathlib import Path
path = Path('.tekton/basic-component-pipeline.yaml')
for i, line in enumerate(path.read_text().splitlines(), start=1):
    if 150 <= i <= 230:
        print(f"{i:6d}  {line}")
PY

printf '\n== Search for image params/bundles in .tekton ==\n'
rg -n --hidden --glob '.tekton/**' '(params\.[A-Za-z0-9_-]*image|bundle|trusted-artifact|determine-version|quay.io/redhat-appstudio/build-trusted-artifacts|registry.access.redhat.com/ubi9/ubi-minimal)' .

printf '\n== List .tekton files ==\n'
git ls-files '.tekton/**'

Repository: stackrox/stackrox-mcp

Length of output: 7844


Move these step images behind a bundle or params. These images are embedded directly in the inline taskSpec; parameterize them or extract the step into a bundled Task to match the .tekton/** image policy.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.tekton/basic-component-pipeline.yaml around lines 183 - 189, Parameterize
the images used by the inline taskSpec steps use-trusted-artifact and
determine-version instead of embedding them directly. Add task parameters for
these image references and update each step’s image field to consume the
corresponding parameter, preserving the existing pinned image values as defaults
and complying with the .tekton image policy.

Source: Path instructions

workingDir: /var/workdir/source
Comment on lines +178 to +190

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🩺 Stability & Availability | 🟠 Major | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

sed -n '150,220p' .tekton/basic-component-pipeline.yaml

Repository: stackrox/stackrox-mcp

Length of output: 2674


🏁 Script executed:

rg -n "computeResources|resources:" .tekton/basic-component-pipeline.yaml

Repository: stackrox/stackrox-mcp

Length of output: 159


🏁 Script executed:

python3 - <<'PY'
from pathlib import Path
text = Path('.tekton/basic-component-pipeline.yaml').read_text()
for needle in ['computeResources', 'resources:']:
    print(needle, text.count(needle))
PY

Repository: stackrox/stackrox-mcp

Length of output: 191


Set resource requests and limits on the new task steps

use-trusted-artifact and determine-version run without any computeResources, so they can consume unbounded CPU and memory on shared CI workers. Add explicit requests and limits via stepTemplate.computeResources or per-step settings.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.tekton/basic-component-pipeline.yaml around lines 178 - 190, Define
explicit CPU and memory requests and limits for the new use-trusted-artifact and
determine-version steps by adding computeResources to their stepTemplate or
individual step definitions. Keep the resource values consistent with the
pipeline’s existing resource conventions.

Source: Path instructions

script: |
#!/usr/bin/env bash
set -euo pipefail
microdnf install -y git-core
VERSION=$(git describe --tags --always 2>/dev/null || echo "dev")

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

# Inspect the relevant section of the Tekton pipeline and nearby context.
file=".tekton/basic-component-pipeline.yaml"
wc -l "$file"
sed -n '160,230p' "$file"

# Find other uses of git describe / version detection in tekton files.
rg -n "git describe|VERSION=.*dev|dev\"" .tekton -S

Repository: stackrox/stackrox-mcp

Length of output: 2684


🏁 Script executed:

#!/bin/bash
set -euo pipefail

# Map the task definition around the version-detection step.
ast-grep outline .tekton/basic-component-pipeline.yaml

Repository: stackrox/stackrox-mcp

Length of output: 211


🏁 Script executed:

#!/bin/bash
set -euo pipefail

# Locate where the VERSION result is consumed in this pipeline.
rg -n "tasks\.determine-version\.results\.VERSION|determine-version\.results\.VERSION|VERSION" .tekton/basic-component-pipeline.yaml -S

# Read a wider slice around the task and any downstream consumers.
sed -n '180,340p' .tekton/basic-component-pipeline.yaml

Repository: stackrox/stackrox-mcp

Length of output: 5941


🏁 Script executed:

#!/bin/bash
set -euo pipefail

# Check whether the taskSpec has any guard or fallback handling around git metadata.
sed -n '188,208p' .tekton/basic-component-pipeline.yaml

# Inspect surrounding Tekton pipeline parameters/results to understand impact.
sed -n '1,120p' .tekton/basic-component-pipeline.yaml

Repository: stackrox/stackrox-mcp

Length of output: 5017


🏁 Script executed:

#!/bin/bash
set -euo pipefail

# Inspect the clone task and trusted-artifact handoff that feed determine-version.
rg -n "clone-repository|use-trusted-artifact|SOURCE_ARTIFACT|git describe" .tekton/basic-component-pipeline.yaml -n -S

# Read the clone task and the determine-version consumers around the task boundaries.
sed -n '120,210p' .tekton/basic-component-pipeline.yaml
sed -n '230,270p' .tekton/basic-component-pipeline.yaml

Repository: stackrox/stackrox-mcp

Length of output: 5999


🏁 Script executed:

#!/bin/bash
set -euo pipefail

# Read the clone task and nearby pipeline structure to assess whether the repo can be invalid here.
sed -n '1,170p' .tekton/basic-component-pipeline.yaml

Repository: stackrox/stackrox-mcp

Length of output: 5543


🏁 Script executed:

#!/bin/bash
set -euo pipefail

python3 - <<'PY'
import subprocess, textwrap, tempfile, os, shutil, pathlib, sys

# Demonstrate git describe behavior in a normal repo, a repo without tags, and a non-repo.
tmp = tempfile.mkdtemp(prefix="git-describe-check-")
try:
    cwd = pathlib.Path(tmp)
    subprocess.run(["git", "init", "-q"], cwd=tmp, check=True)
    subprocess.run(["git", "config", "user.email", "a@example.com"], cwd=tmp, check=True)
    subprocess.run(["git", "config", "user.name", "a"], cwd=tmp, check=True)
    (cwd / "f").write_text("x\n")
    subprocess.run(["git", "add", "f"], cwd=tmp, check=True)
    subprocess.run(["git", "commit", "-q", "-m", "init"], cwd=tmp, check=True)

    def run(cmd, cwd):
        p = subprocess.run(cmd, cwd=cwd, capture_output=True, text=True)
        return p.returncode, p.stdout.strip(), p.stderr.strip()

    print("repo-no-tags:", run(["git", "describe", "--tags", "--always"], tmp))
    print("non-repo:", run(["git", "describe", "--tags", "--always"], "/tmp"))
finally:
    shutil.rmtree(tmp)
PY

Repository: stackrox/stackrox-mcp

Length of output: 284


🏁 Script executed:

#!/bin/bash
set -euo pipefail

# Inspect if any explicit versioning expectations or release tags are documented nearby.
rg -n "dev|release version|git describe|VERSION" -g '!**/*.sum' -g '!**/vendor/**' . -S | head -n 80

Repository: stackrox/stackrox-mcp

Length of output: 5940


Drop the dev fallback here. git describe --tags --always already returns a commit ID when no tag exists, so || echo "dev" only hides repository/setup failures and propagates a bogus VERSION into the build args.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.tekton/basic-component-pipeline.yaml at line 195, Update the VERSION
assignment in the pipeline to use only git describe --tags --always, removing
the || echo "dev" fallback so repository or setup failures are not masked and
bogus build versions are not propagated.

echo "Determined version: ${VERSION}" >&2
echo -n "${VERSION}" | tee "$(results.VERSION.path)"
- name: prefetch-dependencies
params:
- name: input
Expand Down Expand Up @@ -210,6 +248,7 @@ spec:
value: $(tasks.clone-repository.results.commit)
- name: BUILD_ARGS
value:
- VERSION=$(tasks.determine-version.results.VERSION)
- $(params.build-args[*])
Comment on lines 249 to 252

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

# Locate the relevant pipeline and task files
git ls-files '.tekton/**' | sed -n '1,200p'

echo '--- outline basic-component-pipeline.yaml ---'
ast-grep outline .tekton/basic-component-pipeline.yaml --view expanded || true

echo '--- relevant lines in basic-component-pipeline.yaml ---'
nl -ba .tekton/basic-component-pipeline.yaml | sed -n '220,280p'

echo '--- search for BUILD_ARGS / VERSION usage in tekton files ---'
rg -n 'BUILD_ARGS|build-args|determine-version.results.VERSION|VERSION=' .tekton -S

echo '--- locate downstream task definitions ---'
rg -n 'name:\s*(build|sast|.*analysis|.*image|.*component)|BUILD_ARGS' .tekton -S

Repository: stackrox/stackrox-mcp

Length of output: 466


🏁 Script executed:

#!/bin/bash
set -euo pipefail

# Inspect the task that receives BUILD_ARGS and the scripts that consume it.
rg -n 'BUILD_ARGS|build-args|VERSION=' .tekton -S --glob '*.yaml' --glob '*.yml'

# Try to find any referenced task definitions under tekton
fd -t f -e yaml -e yml .tekton

# If a candidate task file exists, show outlines for the likely consumers.
for f in $(fd -t f -e yaml -e yml .tekton); do
  if rg -q 'BUILD_ARGS|build-args' "$f"; then
    echo "--- $f ---"
    ast-grep outline "$f" --view expanded || true
    nl -ba "$f" | sed -n '1,260p'
  fi
done

Repository: stackrox/stackrox-mcp

Length of output: 1188


🏁 Script executed:

#!/bin/bash
set -euo pipefail

nl -ba .tekton/basic-component-pipeline.yaml | sed -n '240,270p'
echo '---'
nl -ba .tekton/basic-component-pipeline.yaml | sed -n '500,530p'
echo '---'
rg -n 'BUILD_ARGS|VERSION=' .tekton -S

Repository: stackrox/stackrox-mcp

Length of output: 199


🏁 Script executed:

#!/bin/bash
set -euo pipefail

# Show the full task definitions referenced by the pipeline around the BUILD_ARGS entries.
python3 - <<'PY'
from pathlib import Path
p = Path('.tekton/basic-component-pipeline.yaml')
text = p.read_text()
for marker in ['- name: BUILD_ARGS', 'determine-version.results.VERSION', 'build-args']:
    idx = text.find(marker)
    print(f'=== {marker} ===')
    if idx == -1:
        print('not found')
        continue
    start = text.rfind('\n', 0, idx-200)
    if start == -1:
        start = 0
    end = text.find('\n', idx+400)
    if end == -1:
        end = len(text)
    print(text[start+1:end])
    print()
PY

Repository: stackrox/stackrox-mcp

Length of output: 2110


🏁 Script executed:

#!/bin/bash
set -euo pipefail

nl -ba .tekton/basic-component-pipeline.yaml | sed -n '245,255p'
echo '---'
nl -ba .tekton/basic-component-pipeline.yaml | sed -n '505,515p'
echo '---'
rg -n 'build-args|BUILD_ARGS|VERSION=' .tekton -S

Repository: stackrox/stackrox-mcp

Length of output: 199


🏁 Script executed:

#!/bin/bash
set -euo pipefail

python3 - <<'PY'
from pathlib import Path
p = Path('.tekton/basic-component-pipeline.yaml')
lines = p.read_text().splitlines()
for start, end in [(220, 290), (490, 530)]:
    print(f'--- lines {start+1}-{end} ---')
    for i in range(start, min(end, len(lines))):
        print(f'{i+1}: {lines[i]}')
PY

echo '--- search all task refs and build-arg consumers ---'
python3 - <<'PY'
from pathlib import Path
import re

for path in Path('.tekton').rglob('*'):
    if path.is_file() and path.suffix in {'.yaml', '.yml'}:
        text = path.read_text()
        if 'BUILD_ARGS' in text or 'build-args' in text or 'buildah' in text:
            print(f'=== {path} ===')
            for m in re.finditer(r'BUILD_ARGS|build-args|buildah|VERSION=', text):
                s = max(0, m.start()-180)
                e = min(len(text), m.end()+220)
                print(text[s:e].replace('\n', '\n'))
                print('---')
PY

Repository: stackrox/stackrox-mcp

Length of output: 13120


🏁 Script executed:

#!/bin/bash
set -euo pipefail

# Find the exact task or script that consumes BUILD_ARGS and how it expands duplicates.
python3 - <<'PY'
from pathlib import Path
import re

def show(path, needle, radius=260):
    text = path.read_text()
    pos = text.find(needle)
    if pos == -1:
        return False
    s = max(0, pos - radius)
    e = min(len(text), pos + len(needle) + radius)
    print(f'=== {path} :: {needle} ===')
    print(text[s:e])
    print()
    return True

for path in Path('.').rglob('*'):
    if path.is_file() and path.suffix in {'.yaml', '.yml', '.sh', '.bash', '.txt', '.md'}:
        txt = path.read_text(errors='ignore')
        if 'BUILD_ARGS' in txt or 'build-args' in txt or 'buildah' in txt:
            for needle in ['BUILD_ARGS', 'build-args', 'buildah bud', 'buildah build', 'VERSION=']:
                show(path, needle)
PY

Repository: stackrox/stackrox-mcp

Length of output: 3091


🏁 Script executed:

#!/bin/bash
set -euo pipefail

# Check whether there are any docs or scripts describing precedence for repeated build args.
rg -n 'last-wins|duplicate|precedence|build-arg|BUILD_ARGS' . -S

Repository: stackrox/stackrox-mcp

Length of output: 1237


🏁 Script executed:

#!/bin/bash
set -euo pipefail

# Search for the task implementation that actually consumes BUILD_ARGS.
rg -n 'BUILD_ARGS|build-args|buildah|--build-arg' . -S

Repository: stackrox/stackrox-mcp

Length of output: 346


🏁 Script executed:

#!/bin/bash
set -euo pipefail

python3 - <<'PY'
from pathlib import Path
terms = ['BUILD_ARGS', 'build-args', '--build-arg', 'buildah', 'bud ', 'buildah bud', 'buildah build']
for path in Path('.').rglob('*'):
    if not path.is_file():
        continue
    if path.suffix.lower() not in {'.yaml', '.yml', '.sh', '.bash', '.md', '.txt', '.json', '.go', '.js', '.ts'}:
        continue
    try:
        text = path.read_text()
    except Exception:
        continue
    if any(t in text for t in terms):
        print(f'=== {path} ===')
        for t in terms:
            idx = text.find(t)
            if idx != -1:
                s = max(0, idx - 200)
                e = min(len(text), idx + 500)
                print(text[s:e])
                print('---')
PY

Repository: stackrox/stackrox-mcp

Length of output: 3768


🌐 Web query:

buildah build --build-arg duplicate same name precedence last wins

💡 Result:

When using buildah build, build arguments are merged across all provided --build-arg and --build-arg-file options [1][2][3]. When a specific build argument name is provided multiple times, the last instance processed is the one that takes precedence and is passed to the build [1][4][3]. Because files specified via --build-arg-file are read before the arguments supplied directly via --build-arg on the command line, values provided via --build-arg will override any conflicting values defined in --build-arg-file [1][5][3].

Citations:


Keep the generated VERSION last. Both BUILD_ARGS lists put VERSION=$(tasks.determine-version.results.VERSION) before $(params.build-args[*]), so a caller-supplied VERSION=... can win under buildah’s last-value precedence. Move the generated VERSION to the end or filter it out of build-args.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.tekton/basic-component-pipeline.yaml around lines 249 - 252, Update the
BUILD_ARGS list in the pipeline so $(params.build-args[*]) appears before
VERSION=$(tasks.determine-version.results.VERSION). Ensure the generated VERSION
remains the final argument, preserving its precedence over any caller-supplied
VERSION value in both BUILD_ARGS lists.

- name: BUILD_ARGS_FILE
value: $(params.build-args-file)
Expand Down Expand Up @@ -469,6 +508,7 @@ spec:
value: $(tasks.clone-repository.results.commit)
- name: BUILD_ARGS
value:
- VERSION=$(tasks.determine-version.results.VERSION)
- $(params.build-args[*])
- name: BUILD_ARGS_FILE
value: $(params.build-args-file)
Expand Down
18 changes: 18 additions & 0 deletions konflux.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,24 @@ RUN dnf install -y \
# Stage 4: Runtime - Minimal runtime image
FROM ubi-micro-base

# Build arguments for labels
ARG VERSION=dev

# Define labels
LABEL \
com.redhat.component="agentic-cluster-security-suite-acs-mcp-server-container" \
com.redhat.license_terms="https://www.redhat.com/agreements" \
description="The ACS MCP Server" \
io.k8s.description="The ACS MCP Server" \
io.k8s.display-name="acs-mcp-server" \
io.openshift.tags="acs-mcp-server" \
maintainer="Red Hat, Inc." \
name="agentic-cluster-security-suite-tech-preview/acs-mcp-server-rhel9" \
source-location="https://github.com/stackrox/stackrox-mcp" \
summary="The ACS MCP Server" \
version="${VERSION}" \
release="${VERSION}"

# Set default environment variables
ENV LOG_LEVEL=INFO

Expand Down
Loading