Skip to content
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

[kjobctl] Move unmask_filename to templates. #3180

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

mbobrovskyi
Copy link
Contributor

@mbobrovskyi mbobrovskyi commented Oct 2, 2024

What type of PR is this?

/kind cleanup

What this PR does / why we need it:

Move unmask_filename to templates in kjobctl.

Which issue(s) this PR fixes:

Fixes #

Special notes for your reviewer:

Follow up for #3136 (comment).

Does this PR introduce a user-facing change?

NONE

@k8s-ci-robot k8s-ci-robot added release-note-none Denotes a PR that doesn't merit a release note. kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. labels Oct 2, 2024
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: mbobrovskyi
Once this PR has been reviewed and has the lgtm label, please assign trasc for approval. For more information see the Kubernetes Code Review Process.

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

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

@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Oct 2, 2024
Copy link

netlify bot commented Oct 2, 2024

Deploy Preview for kubernetes-sigs-kueue canceled.

Name Link
🔨 Latest commit 2168679
🔍 Latest deploy log https://app.netlify.com/sites/kubernetes-sigs-kueue/deploys/67060a7e754170000899d388

@mbobrovskyi mbobrovskyi force-pushed the cleanup/move-unmask-filename-function-to-templates branch from 6fd8f26 to 24c188a Compare October 2, 2024 12:55
@mimowo
Copy link
Contributor

mimowo commented Oct 2, 2024

/cc @trasc

@k8s-ci-robot k8s-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Oct 4, 2024
@mbobrovskyi mbobrovskyi force-pushed the cleanup/move-unmask-filename-function-to-templates branch from 24c188a to 370eafd Compare October 4, 2024 05:56
@k8s-ci-robot k8s-ci-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Oct 4, 2024
@k8s-ci-robot k8s-ci-robot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Oct 4, 2024
@mbobrovskyi mbobrovskyi changed the title [kjobctl] Move unmask_filename to templates. [kjobctl] Use unmask_filename as embed file. Oct 4, 2024
@mbobrovskyi mbobrovskyi force-pushed the cleanup/move-unmask-filename-function-to-templates branch from 387f031 to 5d71e96 Compare October 4, 2024 15:14
Copy link
Contributor

Choose a reason for hiding this comment

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

this is not a .tmpl :) , it should not be a match for the template wildcard

Copy link
Contributor Author

@mbobrovskyi mbobrovskyi Oct 5, 2024

Choose a reason for hiding this comment

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

The issue is that the linter incorrectly identifies it as a .sh file, resulting in an error: https://prow.k8s.io/view/gs/kubernetes-jenkins/pr-logs/pull/kubernetes-sigs_kueue/3180/pull-kueue-test-kjobctl/1842216444394213376. Adding a shebang here results in it being duplicated in the template, which is incorrect. We could also ignore it using # shellcheck disable=SC2148, but this would make the resulting output less clear.

Honestly, I think it should be template because this is a part of template. I moved it to separate file to be easier test this function. I don't see significant advantages to not using it as a template, but there are drawbacks - such as developer comments being included in the result and we need to create a separate embed variable, whereas simply including the file name in the template would be much easier.

I propose reverting to the previous solution, which I believe is much better. However, if you have another solution that you think is better, feel free to discuss it.

Copy link
Contributor

@trasc trasc Oct 7, 2024

Choose a reason for hiding this comment

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

Since it is only used in one place you could just put its content in the entrypoint template.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We can't test it in this way 😕.

replaced="${replaced//%%/%}"

echo "$replaced"
}
Copy link
Contributor

Choose a reason for hiding this comment

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

NIT:

Suggested change
}
}

Copy link
Contributor Author

@mbobrovskyi mbobrovskyi Oct 9, 2024

Choose a reason for hiding this comment

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

Why do we need it? This space will be added in the main template.

@mbobrovskyi mbobrovskyi force-pushed the cleanup/move-unmask-filename-function-to-templates branch from 5d71e96 to 2168679 Compare October 9, 2024 04:45
@k8s-ci-robot k8s-ci-robot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. and removed size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Oct 9, 2024
@mbobrovskyi mbobrovskyi changed the title [kjobctl] Use unmask_filename as embed file. [kjobctl] Move unmask_filename to templates. Oct 9, 2024
@mbobrovskyi
Copy link
Contributor Author

mbobrovskyi commented Oct 9, 2024

We discussed this case wit @trasc and take a decision to continue working on it after implementing e2e tests.

/hold

@k8s-ci-robot k8s-ci-robot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Oct 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. release-note-none Denotes a PR that doesn't merit a release note. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants