-
Notifications
You must be signed in to change notification settings - Fork 4.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
Change go version detection logic #10101
Merged
+117
−81
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
#!/bin/bash | ||
# | ||
# This library holds golang related utility functions. | ||
|
||
# os::golang::verify_go_version ensure the go tool exists and is a viable version. | ||
function os::golang::verify_go_version() { | ||
if ! which go &>/dev/null; then | ||
os::log::error "Can't find 'go' in PATH, please fix and retry." | ||
os::log::error "See http://golang.org/doc/install for installation instructions." | ||
return 1 | ||
fi | ||
|
||
local go_version | ||
go_version=($(go version)) | ||
if [[ "${go_version[2]}" != go1.6* ]]; then | ||
os::log::info "Detected go version: ${go_version[*]}." | ||
if [[ -z "${PERMISSIVE_GO:-}" ]]; then | ||
os::log::error "Please install Go version 1.6 or use PERMISSIVE_GO=y to bypass this check." | ||
return 1 | ||
else | ||
os::log::warn "Detected golang version doesn't match preferred Go version for Origin." | ||
os::log::warn "This version mismatch could lead to differences in execution between this run and the Origin CI systems." | ||
return 0 | ||
fi | ||
fi | ||
} | ||
readonly -f os::golang::verify_go_version | ||
|
||
# os::golang::verify_golint_version ensure the golint tool exists. | ||
function os::golang::verify_golint_version() { | ||
if ! which golint &>/dev/null; then | ||
os::log::error "Unable to detect 'golint' package." | ||
os::log::error "To install it, run: 'go get github.com/golang/lint/golint'." | ||
return 1 | ||
fi | ||
} | ||
readonly -f os::golang::verify_golint_version |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,6 +9,7 @@ import ( | |
"strings" | ||
"time" | ||
|
||
knet "k8s.io/kubernetes/pkg/util/net" | ||
"k8s.io/kubernetes/pkg/util/sets" | ||
|
||
"github.com/golang/glog" | ||
|
@@ -123,8 +124,9 @@ func TransportFor(ca string, certFile string, keyFile string) (http.RoundTripper | |
} | ||
|
||
// Copy default transport | ||
transport := *http.DefaultTransport.(*http.Transport) | ||
transport.TLSClientConfig = &tls.Config{} | ||
transport := knet.SetTransportDefaults(&http.Transport{ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @soltysh what did we gain from using the k8s lib? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. the intent of this was to pick up default transport settings, which the lib does safely |
||
TLSClientConfig: &tls.Config{}, | ||
}) | ||
|
||
if len(ca) != 0 { | ||
roots, err := CertPoolFromFile(ca) | ||
|
@@ -142,7 +144,7 @@ func TransportFor(ca string, certFile string, keyFile string) (http.RoundTripper | |
transport.TLSClientConfig.Certificates = []tls.Certificate{cert} | ||
} | ||
|
||
return &transport, nil | ||
return transport, nil | ||
} | ||
|
||
// GetCertificateFunc returns a function that can be used in tls.Config#GetCertificate | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
@soltysh we don't want to remove this part of
hack/verify-govet.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.
Why, I haven't see us using it?