Skip to content

Draft: feat(tkn): add compute-families param to remaining AWS Tekton task templates - #882

Open
amastbau wants to merge 6 commits into
redhat-developer:mainfrom
amastbau:feat/compute-families-all-tkn-tasks
Open

Draft: feat(tkn): add compute-families param to remaining AWS Tekton task templates#882
amastbau wants to merge 6 commits into
redhat-developer:mainfrom
amastbau:feat/compute-families-all-tkn-tasks

Conversation

@amastbau

@amastbau amastbau commented Aug 10, 2026

Copy link
Copy Markdown
Contributor

Summary

Follow-up to #872 (which added `compute-families` to RHEL and SNC tasks only).
adrianriobo asked why not all tasks — this PR extends it to all remaining AWS task templates.

  • fedora, rhel-ai: param + `compute-sizes`/else conditional in script (same pattern as `infra-aws-rhel.yaml`)
  • eks, kind, windows-server: param + `compute-sizes`, `cpus`, `memory` params + compute-sizes/else conditional — CLI supports `--compute-families` for these targets
  • mac: param NOT added — `mapt aws mac` uses dedicated host provisioning (`allocate-hosts` with fixed instance type per arch); CLI has no `--compute-families` flag and `AddComputeRequestFlags()` does not apply

`tkn/*.yaml` regenerated via `make tkn-update`.

E2E Test Results

All tests run with `--compute-families m5,m6i`, on-demand, verified via `aws ec2 describe-instances`, then destroyed.

rhel ✅

DEBU Requesting an on-demand instance of type: m5.large
+----------------------+------------+----------+
|  i-04a7cccb1ab5021e5 |  m5.large  |  running |
+----------------------+------------+----------+

fedora ✅

DEBU Requesting an on-demand instance of type: m6i.large
+----------------------+-------------+----------+
|  i-...               |  m6i.large  |  running |
+----------------------+-------------+----------+

rhel-ai ✅

DEBU Requesting an on-demand instance of type: m5.large
+----------------------+------------+----------+
|  i-...               |  m5.large  |  running |
+----------------------+------------+----------+

kind ✅

DEBU Requesting an on-demand instance of type: m6i.xlarge
+----------------------+--------------+----------+
|  i-...               |  m6i.xlarge  |  running |
+----------------------+--------------+----------+

eks (worker node) ✅

+----------------------+-------------+----------+
|  i-0b0c0005ad1fbb55d |  m6i.large  |  running |
+----------------------+-------------+----------+

windows ⏭️ SKIP

Custom AMI `Windows_Server-2019-English-Full-HyperV-RHQE` not available in test account. Script wiring is identical to the other targets.

Test Plan

  • `make build` passes
  • `make test` passes
  • Unit tests: `TestComputeFamiliesParamDefined` + `TestComputeFamiliesPassedInScript` cover all 7 wired tasks
  • E2E: 5/6 targets provisioned and destroyed with `--compute-families m5,m6i` respected — all instances landed in m5 or m6i family

Follows up on adrianriobo's comment in #872

Generated with Claude Code

Extends the compute-families param (added in redhat-developer#872 for RHEL and SNC) to
the remaining 6 AWS task templates for API consistency.

- fedora, rhel-ai: param definition + conditional pass in else branch
  of compute-sizes check (same pattern as infra-aws-rhel.yaml)
- windows-server, mac, eks, kind: param definition only (no-op; these
  targets do not use the standard compute-request/allocation flow)

Regenerated tkn/*.yaml via make tkn-update.

Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Aug 10, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Summary by CodeRabbit

  • New Features

    • Added optional AWS compute-family filtering for infrastructure provisioning.
    • Added explicit compute-size selection, taking precedence over CPU and memory settings when provided.
    • Expanded compute configuration options across EKS, Fedora, KIND, RHEL AI, and Windows Server environments.
    • Improved consistent handling of compute-family settings across AWS infrastructure tasks.
  • Tests

    • Added validation to ensure compute-family parameters are defined and correctly passed during provisioning.

Walkthrough

AWS Tekton tasks now support explicit compute sizes and optional AWS instance-family filtering. Compute sizes take precedence over CPU and memory settings. AWS task tests verify parameter definitions and required command flags.

Changes

AWS compute sizing

Layer / File(s) Summary
Compute selection in core AWS tasks
tkn/infra-aws-eks.yaml, tkn/infra-aws-kind.yaml, tkn/infra-aws-windows-server.yaml, tkn/template/infra-aws-eks.yaml, tkn/template/infra-aws-kind.yaml, tkn/template/infra-aws-windows-server.yaml
These tasks add compute parameters. When compute-sizes is set, provisioning uses it. Otherwise, provisioning passes CPU, memory, and compute-families.
Compute-family filtering across AWS tasks
tkn/infra-aws-fedora.yaml, tkn/infra-aws-rhel-ai.yaml, tkn/infra-aws-rhel.yaml, tkn/infra-aws-ocp-snc.yaml, tkn/template/infra-aws-fedora.yaml, tkn/template/infra-aws-rhel-ai.yaml, tkn/template/infra-aws-rhel.yaml, tkn/template/infra-aws-ocp-snc.yaml
These tasks add compute-families where needed. Their create commands now pass --compute-families in the fallback path, including when the value is empty.
Task parameter and flag validation
pkg/tkn/compute_families_test.go
Tests scan AWS task files for compute-families parameters and required --compute-families flags. Mac tasks are excluded.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Suggested reviewers: jangel97

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description check ✅ Passed The description clearly explains the AWS task changes, macOS limitation, tests, and E2E results.
Title check ✅ Passed The title clearly identifies the addition of the compute-families parameter to the remaining AWS Tekton task templates.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@amastbau amastbau changed the title feat(tkn): add compute-families param to remaining AWS Tekton task templates Draft: feat(tkn): add compute-families param to remaining AWS Tekton task templates Aug 10, 2026

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with 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.

Inline comments:
In `@tkn/template/infra-aws-fedora.yaml`:
- Around line 261-263: Remove the shared eval-based command construction in
tkn/template/infra-aws-fedora.yaml: build mapt as an argument array using set --
or direct execution, and validate evaluate-families/compute-families against the
supported family-prefix grammar before use. Regenerate tkn/infra-aws-fedora.yaml
(lines 261-263) and tkn/infra-aws-rhel-ai.yaml (lines 289-291) from the fixed
templates so both generated provisioners avoid reparsing input with eval; apply
the corresponding template change at tkn/template/infra-aws-rhel-ai.yaml (lines
289-291).
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 4af1a5d1-5447-4d0e-b455-9ce78fad352c

📥 Commits

Reviewing files that changed from the base of the PR and between 4dbf136 and bf8f4a5.

📒 Files selected for processing (12)
  • tkn/infra-aws-eks.yaml
  • tkn/infra-aws-fedora.yaml
  • tkn/infra-aws-kind.yaml
  • tkn/infra-aws-mac.yaml
  • tkn/infra-aws-rhel-ai.yaml
  • tkn/infra-aws-windows-server.yaml
  • tkn/template/infra-aws-eks.yaml
  • tkn/template/infra-aws-fedora.yaml
  • tkn/template/infra-aws-kind.yaml
  • tkn/template/infra-aws-mac.yaml
  • tkn/template/infra-aws-rhel-ai.yaml
  • tkn/template/infra-aws-windows-server.yaml

Comment thread tkn/template/infra-aws-fedora.yaml Outdated
Amos Mastbaum and others added 2 commits August 10, 2026 15:39
Two table-driven tests scanning both tkn/ and tkn/template/:
- TestComputeFamiliesParamDefined: all 8 infra-aws-* tasks must define
  the compute-families param
- TestComputeFamiliesPassedInScript: rhel, ocp-snc, fedora, rhel-ai must
  conditionally pass --compute-families in the provisioner script

Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
…rom mac

- eks, kind, windows: add compute-sizes + cpus/memory params and wire
  compute-sizes/else conditional in script so --compute-families is
  actually passed to the CLI (all three targets support the flag)
- mac: remove compute-families param — mac uses dedicated host
  provisioning and the CLI does not accept the flag
- Update TestComputeFamiliesParamDefined to skip mac
- Add eks, kind, windows to TestComputeFamiliesPassedInScript

Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🤖 Prompt for all review comments with 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.

Inline comments:
In `@tkn/template/infra-aws-eks.yaml`:
- Around line 231-239: Remove eval-based parsing from the EKS and Windows
compute argument handling, including tkn/template/infra-aws-eks.yaml lines
231-239 and tkn/template/infra-aws-windows-server.yaml lines 249-257. Pass
interpolated task parameters through environment variables and construct a
quoted argument vector directly, applying this to all existing interpolated
parameters. Regenerate the corresponding tasks in tkn/infra-aws-eks.yaml lines
231-239 and tkn/infra-aws-windows-server.yaml lines 249-257 so they contain the
same safe handling.

In `@tkn/template/infra-aws-windows-server.yaml`:
- Around line 118-120: Update the memory default documentation in
tkn/template/infra-aws-windows-server.yaml at lines 118-120 to match the
selected default value of 200 GiB. Regenerate tkn/infra-aws-windows-server.yaml
at lines 118-120 from the corrected template; no separate manual logic change is
needed there.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 573dc603-203e-4da3-89b6-25f9e69068c3

📥 Commits

Reviewing files that changed from the base of the PR and between bf8f4a5 and 4b768f6.

📒 Files selected for processing (7)
  • pkg/tkn/compute_families_test.go
  • tkn/infra-aws-eks.yaml
  • tkn/infra-aws-kind.yaml
  • tkn/infra-aws-windows-server.yaml
  • tkn/template/infra-aws-eks.yaml
  • tkn/template/infra-aws-kind.yaml
  • tkn/template/infra-aws-windows-server.yaml
🚧 Files skipped from review as they are similar to previous changes (2)
  • tkn/infra-aws-kind.yaml
  • tkn/template/infra-aws-kind.yaml

Comment thread tkn/template/infra-aws-eks.yaml
Comment thread tkn/template/infra-aws-windows-server.yaml
Amos Mastbaum and others added 3 commits August 10, 2026 18:35
Description said "default 64" but default is 200 GiB (Windows bare metal
needs more RAM than standard Linux targets).

Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
…dows

Params passed through eval must be single-quoted to prevent shell
reinterpretation of special characters. fedora and rhel-ai already used
quotes; apply the same pattern to the newly added compute-sizes/families
blocks in eks, kind, and windows-server.

Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
CLI documents: "Empty means no restriction" — passing --compute-families ''
is equivalent to omitting the flag. The if != "" guard was unnecessary
and inconsistent with how other optional params (e.g. --gpu-manufacturer)
are passed unconditionally.

Remove the guard from all 7 affected templates.

Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (1)
tkn/infra-aws-ocp-snc.yaml (1)

274-274: 🗄️ Data Integrity & Integration | 🔵 Trivial | ⚡ Quick win

Add an explicit-empty compute-families regression test.

All four tasks pass --compute-families ''. pflag and Viper produce an empty slice, and the AWS selector treats it as no restriction. Extend pkg/tkn/compute_families_test.go to cover the default and template OCP-SNC and RHEL create paths.

🤖 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 `@tkn/infra-aws-ocp-snc.yaml` at line 274, Add explicit-empty compute-families
regression coverage in pkg/tkn/compute_families_test.go for the default and
template OCP-SNC and RHEL create paths, verifying each passes --compute-families
'' and preserves unrestricted AWS selection. The affected command sites are
tkn/infra-aws-ocp-snc.yaml:274-274, tkn/template/infra-aws-ocp-snc.yaml:274-274,
tkn/infra-aws-rhel.yaml:283-283, and tkn/template/infra-aws-rhel.yaml:283-283;
no direct changes are required there.
🤖 Prompt for all review comments with 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.

Inline comments:
In `@tkn/infra-aws-ocp-snc.yaml`:
- Line 274: Replace string-built commands and eval execution at
tkn/infra-aws-ocp-snc.yaml:274-274, tkn/template/infra-aws-ocp-snc.yaml:274-274,
tkn/infra-aws-rhel.yaml:283-283, and tkn/template/infra-aws-rhel.yaml:283-283
with argument-array construction and direct "${cmd[@]}" invocation. Validate
params.compute-families against the documented comma-separated family-prefix
format before adding it to the arguments, then apply the same changes to both
templates and regenerate both rendered files.

---

Nitpick comments:
In `@tkn/infra-aws-ocp-snc.yaml`:
- Line 274: Add explicit-empty compute-families regression coverage in
pkg/tkn/compute_families_test.go for the default and template OCP-SNC and RHEL
create paths, verifying each passes --compute-families '' and preserves
unrestricted AWS selection. The affected command sites are
tkn/infra-aws-ocp-snc.yaml:274-274, tkn/template/infra-aws-ocp-snc.yaml:274-274,
tkn/infra-aws-rhel.yaml:283-283, and tkn/template/infra-aws-rhel.yaml:283-283;
no direct changes are required there.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: c6cd6431-377b-4df3-861b-d5a8fdec0fbe

📥 Commits

Reviewing files that changed from the base of the PR and between 5c08132 and 2d24254.

📒 Files selected for processing (14)
  • tkn/infra-aws-eks.yaml
  • tkn/infra-aws-fedora.yaml
  • tkn/infra-aws-kind.yaml
  • tkn/infra-aws-ocp-snc.yaml
  • tkn/infra-aws-rhel-ai.yaml
  • tkn/infra-aws-rhel.yaml
  • tkn/infra-aws-windows-server.yaml
  • tkn/template/infra-aws-eks.yaml
  • tkn/template/infra-aws-fedora.yaml
  • tkn/template/infra-aws-kind.yaml
  • tkn/template/infra-aws-ocp-snc.yaml
  • tkn/template/infra-aws-rhel-ai.yaml
  • tkn/template/infra-aws-rhel.yaml
  • tkn/template/infra-aws-windows-server.yaml
🚧 Files skipped from review as they are similar to previous changes (10)
  • tkn/template/infra-aws-windows-server.yaml
  • tkn/infra-aws-eks.yaml
  • tkn/template/infra-aws-rhel-ai.yaml
  • tkn/template/infra-aws-fedora.yaml
  • tkn/infra-aws-windows-server.yaml
  • tkn/infra-aws-kind.yaml
  • tkn/template/infra-aws-kind.yaml
  • tkn/infra-aws-rhel-ai.yaml
  • tkn/template/infra-aws-eks.yaml
  • tkn/infra-aws-fedora.yaml

if [[ "$(params.compute-families)" != "" ]]; then
cmd+="--compute-families '$(params.compute-families)' "
fi
cmd+="--compute-families '$(params.compute-families)' "

Copy link
Copy Markdown

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:

#!/usr/bin/env bash
set -euo pipefail

payload="m5'; printf 'INJECTED\n'; #"
cmd="printf '%s\n' --compute-families '$payload' "

if eval "$cmd" | grep -qx 'INJECTED'; then
  echo "raw single-quoting is unsafe"
  exit 1
fi

Repository: redhat-developer/mapt

Length of output: 188


🏁 Script executed:

#!/usr/bin/env bash
set -euo pipefail

files=(
  tkn/infra-aws-ocp-snc.yaml
  tkn/template/infra-aws-ocp-snc.yaml
  tkn/infra-aws-rhel.yaml
  tkn/template/infra-aws-rhel.yaml
)

for f in "${files[@]}"; do
  echo "===== $f ====="
  wc -l "$f"
  rg -n -C 8 --fixed-strings \
    'cmd+="--compute-families' "$f"
  rg -n -C 8 'eval|compute-families|params.compute-families' "$f"
done

echo "===== related declarations and invocation patterns ====="
rg -n -C 5 'compute-families|cmd\+=|cmd=\(|"\$\{cmd|\beval\b' \
  tkn README.md .github 2>/dev/null || true

echo "===== template/generated comparison ====="
diff -u tkn/template/infra-aws-ocp-snc.yaml tkn/infra-aws-ocp-snc.yaml | head -200 || true
diff -u tkn/template/infra-aws-rhel.yaml tkn/infra-aws-rhel.yaml | head -200 || true

Repository: redhat-developer/mapt

Length of output: 50378


🏁 Script executed:

#!/usr/bin/env bash
set -euo pipefail

python3 - <<'PY'
from pathlib import Path

pairs = [
    ("tkn/template/infra-aws-ocp-snc.yaml", "tkn/infra-aws-ocp-snc.yaml", 250, 330),
    ("tkn/template/infra-aws-rhel.yaml", "tkn/infra-aws-rhel.yaml", 260, 325),
]
for template, generated, start, end in pairs:
    a = Path(template).read_text().splitlines()
    b = Path(generated).read_text().splitlines()
    print(f"===== {template} vs {generated} =====")
    for line in range(start, end + 1):
        if a[line - 1] != b[line - 1]:
            print(f"line {line}:")
            print(" template :", a[line - 1])
            print(" generated:", b[line - 1])
    print("affected blocks equal:",
          a[start - 1:end] == b[start - 1:end])
PY

echo "===== consumer references ====="
rg -n -C 5 --glob '!tkn/**' --glob '!**/*.yaml' \
  'compute-families|compute_families' . 2>/dev/null || true

echo "===== focused shell behavior ====="
bash -c '
set -euo pipefail
payload="m5'\''; printf '\''INJECTED\n'\''; #"
cmd="printf "%s\n" --compute-families '\''$payload'\'' "
printf "command source: %s\n" "$cmd"
printf "eval output:\n"
eval "$cmd"
'

Repository: redhat-developer/mapt

Length of output: 4754


🏁 Script executed:

#!/usr/bin/env bash
set -euo pipefail

echo "===== compute-family implementation references ====="
rg -n -C 6 \
  'computeFamilies|compute-families|ComputeFamil|compute family|family prefix' \
  cmd pkg internal 2>/dev/null | head -300

echo "===== relevant file outlines ====="
for f in $(rg -l 'computeFamilies|compute-families|ComputeFamil' cmd pkg internal 2>/dev/null | head -20); do
  echo "--- $f"
  wc -l "$f"
  ast-grep outline "$f" 2>/dev/null | head -80 || true
done

Repository: redhat-developer/mapt

Length of output: 17620


Replace string-based eval execution with safe argument handling.

All four sites insert $(params.compute-families) into a command string and execute it with eval "${cmd}". A crafted value executes injected shell code. Build the complete command as an argument array, validate the documented comma-separated family-prefix format, and invoke "${cmd[@]}" directly. Update both templates and regenerate both rendered files.

📍 Affects 4 files
  • tkn/infra-aws-ocp-snc.yaml#L274-L274 (this comment)
  • tkn/template/infra-aws-ocp-snc.yaml#L274-L274
  • tkn/infra-aws-rhel.yaml#L283-L283
  • tkn/template/infra-aws-rhel.yaml#L283-L283
🤖 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 `@tkn/infra-aws-ocp-snc.yaml` at line 274, Replace string-built commands and
eval execution at tkn/infra-aws-ocp-snc.yaml:274-274,
tkn/template/infra-aws-ocp-snc.yaml:274-274, tkn/infra-aws-rhel.yaml:283-283,
and tkn/template/infra-aws-rhel.yaml:283-283 with argument-array construction
and direct "${cmd[@]}" invocation. Validate params.compute-families against the
documented comma-separated family-prefix format before adding it to the
arguments, then apply the same changes to both templates and regenerate both
rendered files.

Source: Path instructions

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant