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

Introducing Workspaces into pipelines #793

Closed
wants to merge 20 commits into from
Closed

Introducing Workspaces into pipelines #793

wants to merge 20 commits into from

Conversation

bhanurp
Copy link
Collaborator

@bhanurp bhanurp commented Jul 2, 2023

  • 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.

@yahavi yahavi added new feature Automatically generated release notes safe to test Approve running integration tests on a pull request labels Nov 7, 2023
@github-actions github-actions bot removed the safe to test Approve running integration tests on a pull request label Nov 7, 2023
Copy link
Member

@yahavi yahavi left a comment

Choose a reason for hiding this comment

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

@bhanurp
Good work!
I reviewed your code and added some comments. I think a second round of code review is needed after fixing the issues.

Important -

  1. Ensure the tests are not failing
  2. Add all new methods in manager.go to the README

pipelines/manager.go Outdated Show resolved Hide resolved
Comment on lines +161 to +164
workspacesResponseStatus, err := sm.WorkspacePollSyncStatus()
if err != nil {
return nil, err
}
Copy link
Member

Choose a reason for hiding this comment

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

Can this login be inside workspaceService.GetWorkspacePipelines? Let's try to keep the manager clean.

pipelines/manager.go Outdated Show resolved Hide resolved
pipelines/manager.go Outdated Show resolved Hide resolved
pipelines/manager.go Outdated Show resolved Hide resolved
}

func TestWorkspaceValidationWhenPipelinesResourcesAreNotValid(t *testing.T) {

Copy link
Member

Choose a reason for hiding this comment

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

Suggested change

Copy link
Member

Choose a reason for hiding this comment

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

Please remove all "if"s from the tests. Use only "assert" or "require".

This file needs to be reviewed again after this change.

tests/pipelinesworkspaces_test.go Outdated Show resolved Hide resolved
Copy link
Member

Choose a reason for hiding this comment

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

Let's avoid using the word "pip" for JFrog pipelines in this and other JFrog CLI components. You can name this file "pipe".

)

func TestPipelinesWorkspaceService(t *testing.T) {
t.Run("test trigger pipelines workspace when resources are not valid", TestWorkspaceValidationWhenPipelinesResourcesAreNotValid)
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
t.Run("test trigger pipelines workspace when resources are not valid", TestWorkspaceValidationWhenPipelinesResourcesAreNotValid)
initPipelinesTest(t)
t.Run("test trigger pipelines workspace when resources are not valid", TestWorkspaceValidationWhenPipelinesResourcesAreNotValid)

pipelines/services/run.go Outdated Show resolved Hide resolved
pipelines/services/types.go Outdated Show resolved Hide resolved
pipelines/services/validate.go Outdated Show resolved Hide resolved
httpDetails := vs.getHttpDetails()

// Query params
m := make(map[string]string, 0)
Copy link
Member

Choose a reason for hiding this comment

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

What is "m"?

Comment on lines +61 to +68
if nil != resp && resp.StatusCode == http.StatusOK {
log.Info("Processing resources yaml response ")
log.Info(string(body))
err = processValidatePipResourceResponse(body)
if err != nil {
log.Error("Failed to process resources validation response")
}
}
Copy link
Member

Choose a reason for hiding this comment

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

You already check the status code in CheckResponseStatusWithBody. Please also consider nil before "CheckResponseStatusWithBody".

pipelines/services/validate.go Outdated Show resolved Hide resolved
pipelines/services/validate.go Outdated Show resolved Hide resolved
pipelines/services/validate.go Outdated Show resolved Hide resolved
func (vs *ValidateService) constructValidateAPIURL(qParams map[string]string, apiPath string) string {
uri, err := url.Parse(vs.ServiceDetails.GetUrl() + apiPath)
if err != nil {
log.Error("Failed to parse pipelines fetch run status url")
Copy link
Member

Choose a reason for hiding this comment

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

Please return an error here

@eyalbe4
Copy link
Contributor

eyalbe4 commented Apr 5, 2024

Closing this PR for now.

@eyalbe4 eyalbe4 closed this Apr 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
new feature Automatically generated release notes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants