-
Notifications
You must be signed in to change notification settings - Fork 22
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
[RFC-13] Refactor run.ps1
#60
[RFC-13] Refactor run.ps1
#60
Conversation
I take it you mean, compare the image tag from the file to the version, after replacing the Also I don't believe we have any specific contract around that file existing or containing only a single entry; I'm hesitant to agree to using this as an indicator of the currently installed RKE2 version. The k3s-upgrade image used by SUC actually just runs We never got around to adding this same behavior to rke2-upgrade, but I'd prefer to actually check the version reported by the currently installed binary, instead of parsing tags from text files that were not meant to be used as an installed version indicator. |
afe8285
to
d09a17a
Compare
Good to know! I had thought about using |
d09a17a
to
8b8c6dc
Compare
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.
Minor nits
scripts/windows/version.ps1
Outdated
$VERSION = $VERSION.Replace('+', '-') | ||
|
||
#export stuff out | ||
$env:VERSION = $VERSION | ||
$env:COMMIT = $COMMIT | ||
$env:REPO = "rancher" | ||
$env:IMAGE = "$REPO/system-agent-installer-rke2:$VERSION" | ||
$env:IMAGE = "$env:REPO/system-agent-installer-rke2:$VERSION" |
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.
Can $env:REPO
ever be unset? Maybe use the `REPO = if () {} else {""}; paradigm instead
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.
It is occasionally overridden by devs if they are trying to build a custom image, but even in that case people usually just retag it before pushing it. I suppose we could also see more use of this as we start building and pushing directly to Prime? It should never be empty.
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've reverted a few of the changes I've made to this file and the download.ps1
file just to be super sure this won't negatively impact CI. After looking closer I was able to fix the issues I was having when building locally with fewer changes. The CI right now only relies on download.ps1
which relies on version.ps1
.
8b8c6dc
to
2e63a29
Compare
2e63a29
to
dcab8e9
Compare
Issues: rancher/rancher#45386, rancher/rancher#46344, rancher/rancher#45385
This PR refactors
run.ps1
, many of the build scripts used to create development images of thesystem-agent-installer-rke2
on Windows, and makes minor changes to the CI workflows.The core changes are located in
run.ps1
, and cover the followingrun.ps1
will now compare the value of the$env:INSTALL_RKE2_VERSION
environment variable and the/usr/local/bin/rke2.exe --version
output to determine if the node is undergoing an upgrade. If the environment variable or the output ofrke2.exe --version
are are empty, or if they do not match, thenrke2
will be stopped if needed and reinstalled onto the node. Properly providingINSTALL_RKE2_VERSION
will preventrke2
from being stopped and reinstalled unnecessarily. Going forward, this variable will always be provided by the Rancher plannerrke2
service will always be configured with aDelayed
start type. This ensures thatrke2
starts after other, potentially more disruptive, services have startedWINS_RESTART_STAMP
environment variable provided by the Rancher planner. Additionally, the$RESTART
variable is properly utilized to restart therke2
service only when needed.rke2
environment variables has been updated to properly remove environment variables from the registry if they are no longer providedThe changes to powershell files such as
make.ps1
andbuild.ps1
do not impact CI and are only included to make local development easier.