Skip to content
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

Update XscGitInfoContext struct #1089

Open
wants to merge 10 commits into
base: dev
Choose a base branch
from

Conversation

orz25
Copy link
Contributor

@orz25 orz25 commented Feb 23, 2025

  • All tests passed. If this feature is not already covered by the tests, I added new tests.
  • All static analysis checks passed.
  • This pull request is on the dev branch.
  • I used gofmt for formatting the code before submitting the pull request.

Update AddGeneralEvent and XscGitInfoContext structs due to changes done in XSC (as part of PR view epic).
The new XscGitInfoStruct should look like this:
image

@orz25 orz25 requested a review from attiasas February 23, 2025 11:55
@orz25 orz25 added the safe to test Approve running integration tests on a pull request label Feb 23, 2025
@github-actions github-actions bot removed the safe to test Approve running integration tests on a pull request label Feb 23, 2025
@orz25 orz25 added safe to test Approve running integration tests on a pull request ignore for release Automatically generated release notes labels Feb 24, 2025
@github-actions github-actions bot removed the safe to test Approve running integration tests on a pull request label Feb 24, 2025
@orz25 orz25 added the safe to test Approve running integration tests on a pull request label Feb 24, 2025
@github-actions github-actions bot removed the safe to test Approve running integration tests on a pull request label Feb 24, 2025
@orz25 orz25 added the safe to test Approve running integration tests on a pull request label Feb 24, 2025
@github-actions github-actions bot removed the safe to test Approve running integration tests on a pull request label Feb 24, 2025
@orz25 orz25 added the safe to test Approve running integration tests on a pull request label Feb 24, 2025
@github-actions github-actions bot removed the safe to test Approve running integration tests on a pull request label Feb 24, 2025
@orz25 orz25 added the safe to test Approve running integration tests on a pull request label Feb 24, 2025
@github-actions github-actions bot removed the safe to test Approve running integration tests on a pull request label Feb 24, 2025
@orz25 orz25 added the safe to test Approve running integration tests on a pull request label Feb 24, 2025
@github-actions github-actions bot removed the safe to test Approve running integration tests on a pull request label Feb 24, 2025
Copy link
Contributor

@attiasas attiasas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice, checkout my comments

type PullRequestContext struct {
PullRequestId int `json:"pull_request_id,omitempty"`
PullRequestTitle string `json:"pull_request_title,omitempty"`
TargetBranchName string `json:"target_branch_name,omitempty"`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would extract this variable from this struct to stand at XscGitInfoContext as: Target *CommitContext
If we will want more information about the branch it will be a breaking changes at the current state.

requestContent, err := json.Marshal(event)
if err != nil {
return "", errorutils.CheckError(err)
func (vs *AnalyticsEventService) AddGeneralEvent(event XscAnalyticsGeneralEvent, xrayVersion string) (string, error) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you can also detect the version instead of getting the version as arg if you want:

xrayVersion, err := xrDetails.GetVersion()
	if err != nil {
		return errors.New("Couldn't get Xray version. Error: " + err.Error())
	}

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I first tried this option but had two thoughts:

  1. I think there’s no reason to make another API call if we already have this information.
  2. In cases when a user is using the xsc-service before it became part of Xray, the vs.XrayDetails.GetVersion() will be nil.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ignore for release Automatically generated release notes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants