-
Notifications
You must be signed in to change notification settings - Fork 609
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
Support custom paths for cli cert checks #31988
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -55,3 +55,4 @@ install_manifest.txt | |
*.cbp | ||
!/.copr/Makefile | ||
!/.buildkite/Makefile | ||
.vscode/launch.json |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,7 +20,22 @@ type ApplicationPackage struct { | |
TestPath string | ||
} | ||
|
||
func (ap *ApplicationPackage) HasCertificate() bool { return ap.hasFile("security", "clients.pem") } | ||
func (ap *ApplicationPackage) HasCertificate(certPaths []string) bool { | ||
if len(certPaths) == 0 { | ||
if ap.hasFile("security", "clients.pem") { | ||
return true | ||
} else { | ||
return false | ||
} | ||
} else { | ||
for _, certPath := range certPaths { | ||
if ap.hasFile(certPath) { | ||
return true | ||
} | ||
} | ||
Comment on lines
+31
to
+35
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. This should check that all files are present, not just one. 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. 👍 |
||
return false | ||
} | ||
} | ||
|
||
func (ap *ApplicationPackage) HasMatchingCertificate(certificatePEM []byte) (bool, error) { | ||
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. This needs to consider all certificates now, not just 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. Thanks @mpolden, I'll look at refactoring for this. The issue I had originally was that the 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. Hey, I've been playing around with this and think I could do with some steer on solving it. I've been trying to get around the circular imports by changing the The only other option I could think of was to recreate some of the xml parsing functionality within ApplicationPackage. It wouldn't be very dry, but would enable this. What do you think is the best way forward? (btw I'm on the vespa slack so let me know if its easier to chat this through there) |
||
clientsPEM, err := os.ReadFile(filepath.Join(ap.Path, "security", "clients.pem")) | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -27,7 +27,7 @@ func TestDeploy(t *testing.T) { | |
Target: target, | ||
ApplicationPackage: ApplicationPackage{Path: appDir}, | ||
} | ||
_, err := Deploy(opts) | ||
_, err := Deploy(opts, []string{}) | ||
assert.Nil(t, err) | ||
assert.Equal(t, 1, len(httpClient.Requests)) | ||
req := httpClient.LastRequest | ||
|
@@ -49,7 +49,7 @@ func TestDeployCloud(t *testing.T) { | |
Target: target, | ||
ApplicationPackage: ApplicationPackage{Path: appDir}, | ||
} | ||
_, err := Deploy(opts) | ||
_, err := Deploy(opts, []string{}) | ||
require.Nil(t, err) | ||
assert.Equal(t, 1, len(httpClient.Requests)) | ||
req := httpClient.LastRequest | ||
|
@@ -62,7 +62,7 @@ func TestDeployCloud(t *testing.T) { | |
assert.False(t, hasDeployOptions) | ||
|
||
opts.Version = version.MustParse("1.2.3") | ||
_, err = Deploy(opts) | ||
_, err = Deploy(opts, []string{}) | ||
require.Nil(t, err) | ||
req = httpClient.LastRequest | ||
values = parseMultiPart(t, req) | ||
|
@@ -83,7 +83,7 @@ func TestSubmit(t *testing.T) { | |
ApplicationPackage: ApplicationPackage{Path: appDir}, | ||
} | ||
httpClient.NextResponseString(200, `{"build": 42}`) | ||
build, err := Submit(opts, Submission{}) | ||
build, err := Submit(opts, Submission{}, []string{}) | ||
require.Nil(t, err) | ||
require.Equal(t, int64(42), build) | ||
require.Nil(t, httpClient.LastRequest.ParseMultipartForm(1<<20)) | ||
|
@@ -102,7 +102,7 @@ func TestSubmit(t *testing.T) { | |
Description: "broken garbage", | ||
AuthorEmail: "[email protected]", | ||
SourceURL: "https://github.com/foo/repo", | ||
}) | ||
}, []string{}) | ||
require.Nil(t, err) | ||
require.Equal(t, int64(43), build) | ||
require.Nil(t, httpClient.LastRequest.ParseMultipartForm(1<<20)) | ||
|
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.
Nit: Error messages should be lower-case as this may be concatenated with other errors further up.
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.
Ah good spot!