-
Notifications
You must be signed in to change notification settings - Fork 35
Draft: feat(tkn): add compute-families param to remaining AWS Tekton task templates #882
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
amastbau
wants to merge
6
commits into
redhat-developer:main
Choose a base branch
from
amastbau:feat/compute-families-all-tkn-tasks
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
bf8f4a5
feat(tkn): add compute-families param to all AWS Tekton task templates
df3c818
test(tkn): verify compute-families param in all AWS Tekton tasks
4b768f6
fix(tkn): properly wire compute-families for eks/kind/windows; drop f…
5c08132
fix(tkn): correct windows memory param description default value
8cd8e35
fix(tkn): single-quote param values in compute block for eks/kind/win…
2d24254
fix(tkn): drop redundant empty-check guard on compute-families param
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,80 @@ | ||
| package tkn | ||
|
|
||
| import ( | ||
| "os" | ||
| "path/filepath" | ||
| "strings" | ||
| "testing" | ||
| ) | ||
|
|
||
| // Tasks that have a compute-sizes conditional in their script and must also | ||
| // conditionally pass --compute-families in the else branch. | ||
| var tasksWithComputeFamiliesScript = map[string]struct{}{ | ||
| "infra-aws-rhel.yaml": {}, | ||
| "infra-aws-ocp-snc.yaml": {}, | ||
| "infra-aws-fedora.yaml": {}, | ||
| "infra-aws-rhel-ai.yaml": {}, | ||
| "infra-aws-eks.yaml": {}, | ||
| "infra-aws-kind.yaml": {}, | ||
| "infra-aws-windows-server.yaml": {}, | ||
| } | ||
|
|
||
| // mac uses dedicated host provisioning — CLI does not accept --compute-families. | ||
| var tasksWithoutComputeFamiliesParam = map[string]struct{}{ | ||
| "infra-aws-mac.yaml": {}, | ||
| } | ||
|
|
||
| func TestComputeFamiliesParamDefined(t *testing.T) { | ||
| root := moduleRoot(t) | ||
| for _, dir := range []string{"tkn", filepath.Join("tkn", "template")} { | ||
| entries, err := os.ReadDir(filepath.Join(root, dir)) | ||
| if err != nil { | ||
| t.Fatal(err) | ||
| } | ||
| for _, entry := range entries { | ||
| name := entry.Name() | ||
| if !isAWSInfraTask(name) { | ||
| continue | ||
| } | ||
| if _, skip := tasksWithoutComputeFamiliesParam[name]; skip { | ||
| continue | ||
| } | ||
| path := filepath.Join(root, dir, name) | ||
| data, err := os.ReadFile(path) | ||
| if err != nil { | ||
| t.Fatal(err) | ||
| } | ||
| if !strings.Contains(string(data), "name: compute-families") { | ||
| t.Errorf("%s: missing 'compute-families' param definition", path) | ||
| } | ||
| } | ||
| } | ||
| } | ||
|
|
||
| func TestComputeFamiliesPassedInScript(t *testing.T) { | ||
| root := moduleRoot(t) | ||
| for _, dir := range []string{"tkn", filepath.Join("tkn", "template")} { | ||
| entries, err := os.ReadDir(filepath.Join(root, dir)) | ||
| if err != nil { | ||
| t.Fatal(err) | ||
| } | ||
| for _, entry := range entries { | ||
| name := entry.Name() | ||
| if _, ok := tasksWithComputeFamiliesScript[name]; !ok { | ||
| continue | ||
| } | ||
| path := filepath.Join(root, dir, name) | ||
| data, err := os.ReadFile(path) | ||
| if err != nil { | ||
| t.Fatal(err) | ||
| } | ||
| if !strings.Contains(string(data), "--compute-families") { | ||
| t.Errorf("%s: missing '--compute-families' flag in script", path) | ||
| } | ||
| } | ||
| } | ||
| } | ||
|
|
||
| func isAWSInfraTask(name string) bool { | ||
| return strings.HasSuffix(name, ".yaml") && strings.HasPrefix(name, "infra-aws-") | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
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:
Repository: redhat-developer/mapt
Length of output: 188
🏁 Script executed:
Repository: redhat-developer/mapt
Length of output: 50378
🏁 Script executed:
Repository: redhat-developer/mapt
Length of output: 4754
🏁 Script executed:
Repository: redhat-developer/mapt
Length of output: 17620
Replace string-based
evalexecution with safe argument handling.All four sites insert
$(params.compute-families)into a command string and execute it witheval "${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-L274tkn/infra-aws-rhel.yaml#L283-L283tkn/template/infra-aws-rhel.yaml#L283-L283🤖 Prompt for AI Agents
Source: Path instructions