-
Notifications
You must be signed in to change notification settings - Fork 142
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
Add Release Bundle exists API #1066
Conversation
96eff3c
to
dc16e8e
Compare
55ea80f
to
3a2a5e1
Compare
3a2a5e1
to
176e497
Compare
97a13e6
to
35dfcac
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.
I got a little confused if this is a check for RBV1 / V2 check, Or endpoint to check weather a release bundle exists. ( maybe it's the same meaning but i got confused )
This also effect the location of the code, if it should be on v1 or v2.
And also the name of the function, IsRV2? \ exists?
Can we clarify what is the use case and name the functions to be more clear?
conflictErrorMessage = "Bundle already exists" | ||
ReleaseBundleImportRestApiEndpoint = "api/release/import/" | ||
octetStream = "application/octet-stream" | ||
ReleaseBundleExistInRbV2RestApiEndpoint = "lifecycle/api/v2/release_bundle/existence" |
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.
As this is a lifecycle endpoint, And RBV2 is under "lifecycle", let's move the relevant code to lifecycle-services.
It is indeed confusing because this is the code for V1.
httpClientsDetails := rs.ArtDetails.CreateHttpClientDetails() | ||
project = "project=" + project | ||
|
||
rtUrl := strings.Replace(rs.ArtDetails.GetUrl(), "/artifactory", "", 1) |
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.
Once we transition to the V2 code, we should no longer need to manually remove the Artifactory endpoint; we can simply append the new endpoint.
35dfcac
to
f7f636c
Compare
f7f636c
to
2682d3b
Compare
2682d3b
to
aab504a
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.
Looks good!
Please let's edit the function call & filename, and then update the README and explain each parameter even if it seems self explanatory.
lifecycle/services/is_exists.go
Outdated
isExistInRbV2Endpoint = "api/v2/release_bundle/existence" | ||
) | ||
|
||
func (rbs *ReleaseBundlesService) IsExists(projectName, releaseBundleNameAndVersion string) (bool, error) { |
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 we change this to releaseBundleExists(projectName,rbName,rbVersion)
?
Once it's done, update the readme with a detailed example for each parameter.
Afterward the call will look like this:
exists, err := serviceManager.releaseBundleExists(projectName,rbName,rbVersion)
6b6e8d6
to
43a9bff
Compare
README.md
Outdated
@@ -232,6 +232,7 @@ | |||
- [Export Release Bundle Archive](#export-release-bundle-archive) | |||
- [Import Release Bundle Archive](#import-release-bundle-archive) | |||
- [Remote Delete Release Bundle](#remote-delete-release-bundle) | |||
- [Check if Release Bundle exists in V2](#check-if-rb-exists-in-v2) |
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.
- [Check if Release Bundle exists in V2](#check-if-rb-exists-in-v2) | |
- [Check if Release Bundle exists ](#check-rb-exists) |
lifecycle/services/is_exists.go
Outdated
isExistInRbV2Endpoint = "api/v2/release_bundle/existence" | ||
) | ||
|
||
func (rbs *ReleaseBundlesService) ReleaseBundleExists(projectName, rbName, rbVersion string) (bool, error) { |
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.
Since projectName is optional, let change it to rbName,rbVersion,projectName
README.md
Outdated
#### check-if-rb-exists-in-v2 | ||
|
||
```go | ||
|
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 let's add a comment explaining that project is optional and can be empty.
43a9bff
to
0c53bde
Compare
0c53bde
to
5afdcd9
Compare
5afdcd9
to
f48a152
Compare
f48a152
to
5fe7d80
Compare
Waiting for the CLI PR to be ready to merge. |
📗 Scan Summary
|
at 🎯 Static Application Security Testing (SAST) VulnerabilityFull descriptionVulnerability Details
OverviewSSH Keys Past Expiration is a vulnerability that occurs when SSH keys Vulnerable examplepackage main
import (
"golang.org/x/crypto/ssh"
"net"
)
func main() {}
func insecureIgnoreHostKey() {
_ = &ssh.ClientConfig{
User: "username",
Auth: []ssh.AuthMethod{nil},
HostKeyCallback: ssh.InsecureIgnoreHostKey(),
}
} In this example, the Remediationpackage main
import (
"golang.org/x/crypto/ssh"
"net"
)
func main() {}
func secureHostKeyCallback() {
publicKeyBytes, _ := ioutil.ReadFile("allowed_hostkey.pub")
publicKey, _ := ssh.ParsePublicKey(publicKeyBytes)
_ = &ssh.ClientConfig{
User: "username",
Auth: []ssh.AuthMethod{nil},
HostKeyCallback: ssh.FixedHostKey(publicKey),
}
} By using allowed host keys and proper host key verification, we can |
… RBV2.
Implemented a new API endpoint to check if a release bundle exists in RBV2