-
Notifications
You must be signed in to change notification settings - Fork 38.7k
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
Retry downloads, respect URL list, validate tar hash #74100
Retry downloads, respect URL list, validate tar hash #74100
Conversation
cluster/gce/win1803/common.psm1
Outdated
} | ||
} | ||
|
||
# Attempts to downlaod the file from URLs, trying each URL in succession (with retries) |
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.
s/downlaod/download
/test ci-kubernetes-e2e-windows-gce |
bf6f0af
to
9e1bd0e
Compare
9e1bd0e
to
513f6f2
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.
This looks great, thanks!
cluster/gce/win1803/common.psm1
Outdated
@@ -86,5 +86,69 @@ function Get-InstanceMetadataValue { | |||
} | |||
} | |||
|
|||
function Validate-Hash { |
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.
Add a comment that the hash is SHA1, or change the function name to indicate this.
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.
Done.
cluster/gce/win1803/common.psm1
Outdated
|
||
# Attempts to download the file from URLs, trying each URL in succession (with retries) | ||
# until it succeeds. It will loop through the URLs list forever until it has a success. | ||
# If successful, it will write the file to OutDir, with a |
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.
OutFile
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.
Done.
cluster/gce/win1803/common.psm1
Outdated
if ($Hash -ne $null) { | ||
Try { | ||
Validate-Hash -Hash $Hash -Path $OutFile | ||
} Catch { |
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.
There's a couple extra leading spaces 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.
Done.
if ($kube_env.ContainsKey('NODE_BINARY_TAR_HASH')) { | ||
$hash = ${kube_env}['NODE_BINARY_TAR_HASH'] | ||
} | ||
MustDownload-File -Hash $hash -OutFile ${tmp_dir}\${filename} -URLs $urls |
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.
Should we change other Invoke-WebRequest calls in this file to use MustDownload-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.
Good point. Done.
cluster/gce/win1803/common.psm1
Outdated
# Attempts to download the file from URLs, trying each URL in succession (with retries) | ||
# until it succeeds. It will loop through the URLs list forever until it has a success. | ||
# If successful, it will write the file to OutDir, with a | ||
# filename matching the base (final) segment of the URL. You can optionall provide a Hash |
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.
optionally
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.
Done.
cluster/gce/win1803/common.psm1
Outdated
|
||
# TODO(mtaufen): We could probably set this in a more general place. | ||
# Disable progress bar to increase download speed. | ||
$ProgressPreference = 'SilentlyContinue' |
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.
You could move this to Set-PrerequisiteOptions in k8s-node-setup.psm1, or (perhaps better) just move this to be "global" at the top of this 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.
Moved to top of file.
513f6f2
to
7ffe810
Compare
/lgtm |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: mtaufen, yujuhong 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 |
Looks like this had a small bug, fix in #74324 |
I tested this with the instructions in the README: https://github.com/pjh/kubernetes/blob/gce-windows-cluster/cluster/gce/win1803/README-GCE-Windows-kube-up.md
What type of PR is this?
/kind bug
What this PR does / why we need it:
@yujuhong @pjh