-
Notifications
You must be signed in to change notification settings - Fork 107
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
Improve patchComponent && Add patchCluster scripts #12207
base: master
Are you sure you want to change the base?
Improve patchComponent && Add patchCluster scripts #12207
Conversation
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.
In addition to those I provided through the code I don't know how both scripts handle different error situations, e.g. if patch is already applied, if it is partially succeed? Can it be reversed? It would be useful if you'll clarify these questions as well.
# NOTE: We do not support patching from file and patching from command line simultaneously | ||
# If both provided at the command line patching from command line takes precedence | ||
|
||
podCmdActions="wget https://raw.githubusercontent.com/todor-ivanov/WMCoreAux/master/bin/patchComponent.sh -O /data/patchComponent.sh && chmod 755 /data/patchComponent.sh " |
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.
Few things here:
- you are assuming that
wget
is installed on a node which may not be the case. Please add appropriate test and failure forwget
(and/orcurl
) commands - I think you should use back quote to get output of command to assign it to a shell variable. please check
- I also suggest to separate wget and chmod command to properly capture wget output
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.
Indeed, wget
or curl
are requirements. I can try to double check if they are present at the container, but this would make the podCmd*
commands executions more complicate.... - would require two extra steps from the caller script, so at least one more cycle there.... The idea here is that they should go in as "one-liners" because they would be pushed through the kubectl
connection session as a single command with accumulated errors. So the only way to achieve that is through an &&
logical chain. I'll see what I can do, though, and will write back the results from my tests here.
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.
so:
I think you should use back quote to get output of command to assign it to a shell variable. please check
Actually not. Because we need to delay the execution as much as possible so it happens at the container. A back quote here would push the execution to happen at the caller's shell. So we better first construct the strings and then send it through the session to the containers.
echo "DEBUG: newPipeFlag=$newPipeFlag" | ||
} | ||
|
||
podCmd="$podCmdActions && sudo /data/patchComponent.sh $podCmdOpts $patchList " |
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.
the same comment here, you are implying that sudo
exists which may not be the case.
} | ||
|
||
podCmd="$podCmdActions && sudo /data/patchComponent.sh $podCmdOpts $patchList " | ||
restartCmd="/data/manage restart && sleep 1 && /data/manage status" |
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.
here you assume that /data/manage
exist, and it is related to our current way of installing which may change in a future. Maybe you should define manage somehow, or at least test that it exists
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.
that is all true.... I will try to include this one in the above mentioned tests as well.
echo -------------------------------------------------------- | ||
# First try to find any pod from the service name provided and then extend the list in currPods: | ||
if [[ -n $currService ]]; then | ||
servicePods=`kubectl -n $nameSpace get ep $currService -o=jsonpath='{.subsets[*].addresses[*].ip}' | tr ' ' '\n' | xargs -I % kubectl -n $nameSpace get pods -o=name --field-selector=status.podIP=%` |
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.
please test that kubectl
exists in a user PATH.
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.
same answer... Will try it in my next commit
mkdir -p $pythonLibPath/$fileDir | ||
echo INFO: orig: https://raw.githubusercontent.com/dmwm/WMCore/$srcBranch/test/python/$file | ||
echo INFO: dest: $pythonLibPath/$file | ||
curl -f https://raw.githubusercontent.com/dmwm/WMCore/$srcBranch/test/python/$file -o $pythonLibPath/$file || { |
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.
here you use curl
while in patchCluster.sh you rely on wget, why both and not using a single tool. I always prefer curl, so my point is that there is no need to use wget
if we use curl
or vice versa.
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.
I do not remember the exact reason why I used one tool above the the another one here... I'll test with either of them and if possible I'll stick to one of them
Fix broken testFileList creation
9b2941b
to
2d06401
Compare
Fixes #11685
Status
ready
Description
With the current PR we improve the functionality of
patchComponent.sh
script adding the following functionalities:upstream/master
) if the first attempt to patch from the currently deployed version fails. It is a feature quite needed in the case of completely broken history and/or intermediate developments that might have happened between the moment of forking to a new branch for creating the patch and the actually applying and/or when the origin branch on top of which the patch has been created is behind the branch currently deployed at destination.git *
commands) without going through officially creating a PR in the upstream repositoryWe also introduce the script
patchClustetr.sh
, which is capable of applying all those step on a Kuberenetes cluster. The granularity could be:This way those two scripts become a well coupled pair, which boosts the development and testing/validation process tremendously!!!
Is it backward compatible (if not, which system it affects?)
YES
Related PRs
None
External dependencies / deployment changes
None