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

WINC-949: Rename powershellVariablesInCommand #1352

Merged
merged 1 commit into from Dec 6, 2022

Conversation

sebsoto
Copy link
Contributor

@sebsoto sebsoto commented Dec 5, 2022

Renames powershellVariablesInCommand to powershellPreScripts to remove the implicit requirement of a variable to replace, which is not always necessary. Also renames powershellVaraiblesInCommand.Name, to VariableName, to be more clear about the purpose of the field with the new naming.

@openshift-ci openshift-ci bot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Dec 5, 2022
@openshift-ci
Copy link
Contributor

openshift-ci bot commented Dec 5, 2022

Skipping CI for Draft Pull Request.
If you want CI signal for your change, please convert it to an actual PR.
You can still manually trigger a test run with /test all

@openshift-ci openshift-ci bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Dec 5, 2022
@sebsoto
Copy link
Contributor Author

sebsoto commented Dec 5, 2022

/test build

@sebsoto
Copy link
Contributor Author

sebsoto commented Dec 5, 2022

/test lint

@sebsoto
Copy link
Contributor Author

sebsoto commented Dec 5, 2022

/approve cancel

@openshift-ci openshift-ci bot removed the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Dec 5, 2022
Copy link
Contributor

@saifshaikh48 saifshaikh48 left a comment

Choose a reason for hiding this comment

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

/lgtm

thanks for doing this ⚡

@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label Dec 5, 2022
Copy link
Contributor

@aravindhp aravindhp left a comment

Choose a reason for hiding this comment

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

Thanks for working on this, @sebsoto. Please address my comments.

Priority: 1,
Bootstrap: true,
Dependencies: []string{windows.ContainerdServiceName},
PowershellPreScripts: powershellVars,
Copy link
Contributor

Choose a reason for hiding this comment

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

Now this looks a bit odd. Why would PowershellPreScripts be referred to as powershellVars

}
if psVar.Name != "" {
vars[psVar.Name] = strings.TrimSpace(out)
if psVar.VariableName != "" {
Copy link
Contributor

Choose a reason for hiding this comment

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

Now this variable is stuttering because this is no longer a psVar.

Name string `json:"name"`
// Path is the location of a PowerShell script whose output is the value of the variable
// PowershellPreScript describes a PowerShell script to be ran and an optional variable to be populated
type PowershellPreScript struct {
Copy link
Contributor

Choose a reason for hiding this comment

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

If you are thinking about PowerShellPostScript shouldn't this be generic?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

PowerShellPostScript would just need to be a []string, as there wouldn't be any variables to replace, given it runs after the service.

Copy link
Contributor

Choose a reason for hiding this comment

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

Would this also be the case for arbitrary scripts that we were going to introduce instead of always having scripts associated with a service? While there might not be variables to replace there either do you think the struct could be reused with other members added to it?

@openshift-ci openshift-ci bot removed the lgtm Indicates that a PR is ready to be merged. label Dec 5, 2022
type PowershellPreScript struct {
// VariableName is the name of a variable which should be replaced by the output of the script. An empty value will
// cause no variable replacement to occur, but the script will still be ran.
VariableName string `json:"variableName"`
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we need to add omitempty?

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes, I think so. In addition, would be nice to add a unit test to cover this scenario, where a PowershellPreScript gets created without VariableName.

@openshift-ci
Copy link
Contributor

openshift-ci bot commented Dec 5, 2022

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: aravindhp

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

The pull request process is described 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

@openshift-ci openshift-ci bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Dec 5, 2022
Copy link
Contributor

@jrvaldes jrvaldes left a comment

Choose a reason for hiding this comment

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

LGTM, just a few suggestions.

@@ -67,9 +67,7 @@ func containerdConfiguration(debug bool) servicescm.Service {
Name: windows.ContainerdServiceName,
Command: containerdServiceCmd,
NodeVariablesInCommand: nil,
PowershellVariablesInCommand: []servicescm.PowershellCmdArg{{
// Name is left blank as we just want this script to execute, without any service command replacements
Copy link
Contributor

Choose a reason for hiding this comment

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

It may be helpful to keep the comment.

type PowershellPreScript struct {
// VariableName is the name of a variable which should be replaced by the output of the script. An empty value will
// cause no variable replacement to occur, but the script will still be ran.
VariableName string `json:"variableName"`
Copy link
Contributor

Choose a reason for hiding this comment

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

Yes, I think so. In addition, would be nice to add a unit test to cover this scenario, where a PowershellPreScript gets created without VariableName.

Copy link
Contributor

@saifshaikh48 saifshaikh48 left a comment

Choose a reason for hiding this comment

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

/lgtm

LGTM from my end

@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label Dec 5, 2022
Renames powershellVariablesInCommand to powershellPreScripts to remove
the implicit requirement of a variable to replace, which is not always
necessary. Also renames powershellVaraiblesInCommand.Name, to
VariableName, to be more clear about the purpose of the field with the
new naming.
@openshift-ci openshift-ci bot removed the lgtm Indicates that a PR is ready to be merged. label Dec 6, 2022
@sebsoto
Copy link
Contributor Author

sebsoto commented Dec 6, 2022

/test aws-e2e-operator

@sebsoto
Copy link
Contributor Author

sebsoto commented Dec 6, 2022

/test gcp-e2e-operator

@jrvaldes
Copy link
Contributor

jrvaldes commented Dec 6, 2022

/lgtm

@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label Dec 6, 2022
@sebsoto sebsoto marked this pull request as ready for review December 6, 2022 16:43
@openshift-ci openshift-ci bot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Dec 6, 2022
@sebsoto
Copy link
Contributor Author

sebsoto commented Dec 6, 2022

/retest-required

@openshift-ci-robot
Copy link

/retest-required

Remaining retests: 0 against base HEAD 1b76b08 and 2 for PR HEAD c4ec11c in total

@sebsoto
Copy link
Contributor Author

sebsoto commented Dec 6, 2022

/retest-required

@sebsoto
Copy link
Contributor Author

sebsoto commented Dec 6, 2022

/cherry-pick release-4.12

@openshift-cherrypick-robot

@sebsoto: once the present PR merges, I will cherry-pick it on top of release-4.12 in a new PR and assign it to you.

In response to this:

/cherry-pick release-4.12

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/test-infra repository.

@openshift-ci
Copy link
Contributor

openshift-ci bot commented Dec 6, 2022

@sebsoto: all tests passed!

Full PR test history. Your PR dashboard.

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/test-infra repository. I understand the commands that are listed here.

@openshift-merge-robot openshift-merge-robot merged commit 505d39f into openshift:master Dec 6, 2022
@openshift-cherrypick-robot

@sebsoto: #1352 failed to apply on top of branch "release-4.12":

Applying: Rename powershellVariablesInCommand
Using index info to reconstruct a base tree...
M	pkg/daemon/controller/controller.go
M	pkg/daemon/controller/controller_test.go
M	pkg/services/services.go
Falling back to patching base and 3-way merge...
Auto-merging pkg/services/services.go
CONFLICT (content): Merge conflict in pkg/services/services.go
Auto-merging pkg/daemon/controller/controller_test.go
CONFLICT (content): Merge conflict in pkg/daemon/controller/controller_test.go
Auto-merging pkg/daemon/controller/controller.go
CONFLICT (content): Merge conflict in pkg/daemon/controller/controller.go
error: Failed to merge in the changes.
hint: Use 'git am --show-current-patch=diff' to see the failed patch
Patch failed at 0001 Rename powershellVariablesInCommand
When you have resolved this problem, run "git am --continue".
If you prefer to skip this patch, run "git am --skip" instead.
To restore the original branch and stop patching, run "git am --abort".

In response to this:

/cherry-pick release-4.12

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/test-infra repository.

@mansikulkarni96
Copy link
Member

/cherry-pick release-4.12

@openshift-cherrypick-robot

@mansikulkarni96: new pull request created: #1436

In response to this:

/cherry-pick release-4.12

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/test-infra repository.

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. lgtm Indicates that a PR is ready to be merged.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

8 participants