Skip to content

Conversation

@Kunal1522
Copy link
Contributor

Fixes #3351

Add validation to jobPorts() function

Changes

This PR adds validation to the jobPorts() function in pkg/functions/job.go to:

  1. Skip file entries (only process directories)
  2. Skip directories with non-integer names (only valid port numbers)
    This addresses the existing TODO comment and aligns with the validation already present in cleanupJobDirs().

What was changed

  • Added filtering in the jobPorts() loop to validate entries
  • Added isValidPort() helper function
  • Removed the TODO comment

Testing

  • Existing TestJob_New and TestJob_Stop tests pass
  • go build ./pkg/functions/ succeeds

/kind cleanup

…ports and introduce an `isValidPort` helper.
@knative-prow knative-prow bot added the kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. label Jan 12, 2026
@knative-prow knative-prow bot added needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Jan 12, 2026
@knative-prow
Copy link

knative-prow bot commented Jan 12, 2026

Hi @Kunal1522. Thanks for your PR.

I'm waiting for a knative member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@codecov
Copy link

codecov bot commented Jan 12, 2026

Codecov Report

❌ Patch coverage is 66.66667% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 55.17%. Comparing base (b8ab823) to head (a57ab6a).
⚠️ Report is 6 commits behind head on main.

Files with missing lines Patch % Lines
pkg/functions/job.go 66.66% 1 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3352      +/-   ##
==========================================
+ Coverage   55.12%   55.17%   +0.05%     
==========================================
  Files         170      170              
  Lines       19965    19970       +5     
==========================================
+ Hits        11005    11019      +14     
+ Misses       7882     7874       -8     
+ Partials     1078     1077       -1     
Flag Coverage Δ
e2e 39.40% <60.00%> (+<0.01%) ⬆️
e2e go 35.43% <0.00%> (?)
e2e node 30.98% <0.00%> (-0.02%) ⬇️
e2e python 35.17% <0.00%> (+0.07%) ⬆️
e2e quarkus 31.13% <0.00%> (?)
e2e rust 30.53% <0.00%> (?)
e2e springboot 30.62% <0.00%> (+0.05%) ⬆️
e2e typescript 31.09% <0.00%> (-0.02%) ⬇️
integration 17.46% <0.00%> (+<0.01%) ⬆️
unit macos-14 45.11% <60.00%> (+<0.01%) ⬆️
unit macos-latest 45.11% <60.00%> (+<0.01%) ⬆️
unit ubuntu-24.04-arm 45.20% <66.66%> (+<0.01%) ⬆️
unit ubuntu-latest 46.00% <60.00%> (+<0.01%) ⬆️
unit windows-latest 45.13% <60.00%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@matejvasek
Copy link
Contributor

/approve
/lgtm

@knative-prow knative-prow bot added the lgtm Indicates that a PR is ready to be merged. label Jan 13, 2026
@knative-prow
Copy link

knative-prow bot commented Jan 13, 2026

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: Kunal1522, matejvasek

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@knative-prow knative-prow bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jan 13, 2026
@knative-prow knative-prow bot merged commit f508122 into knative:main Jan 13, 2026
43 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. lgtm Indicates that a PR is ready to be merged. needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. size/S Denotes a PR that changes 10-29 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Validate entries in jobPorts() function

2 participants