apache / incubator-devlake

Apache DevLake is an open-source dev data platform to ingest, analyze, and visualize the fragmented data from DevOps tools, extracting insights for engineering excellence, developer experience, and community growth.
https://devlake.apache.org/
Apache License 2.0
2.57k stars 514 forks source link

[Bug][Jenkins] MavenModuleSet should be treated as a scope #7598

Closed sstojak1 closed 3 months ago

sstojak1 commented 3 months ago

Search before asking

What happened

The logic for categorizing Devlake Remote Scopes has changed in version v1.0.0-beta5. Previously, the default category was "scope," but now it is "group." This change has led to issues, such as hudson.maven.MavenModuleSet Jenkins project type being treated as a group instead of a scope. As a result, you cannot add a new Devlake Remote Scope because it's incorrectly categorized as a group.

What do you expect to happen

I expect that hudson.maven.MavenModuleSet Jenkins project is not categorized as group by Devlake

How to reproduce

Create a new Maven Project in Jenkins and try to add it through Devlake: image

Anything else

No response

Version

v1.0.0-beta11

Are you willing to submit PR?

Code of Conduct

dosubot[bot] commented 3 months ago

Hello @sstojak1! I'm here to help you with any bugs, questions, or contributions you have for the project. Let's work together to resolve the issue you've encountered.

To ensure that the hudson.maven.MavenModuleSet Jenkins project type is not incorrectly categorized as a group instead of a scope in DevLake version v1.0.0-beta11, you need to correctly configure the scope in the scope_config_api.go file.

Here is an example of how you can create a scope configuration for Jenkins:

func CreateScopeConfig(input *plugin.ApiResourceInput) (*plugin.ApiResourceOutput, errors.Error) {
    return dsHelper.ScopeConfigApi.Post(input)
}

Ensure that the scopeConfig parameter in the CreateScopeConfig function correctly identifies hudson.maven.MavenModuleSet as a scope. This involves setting the appropriate fields in the models.JenkinsScopeConfig structure.

Example of defining the JenkinsScopeConfig model:

package models

type JenkinsScopeConfig struct {
    ID            int    `json:"id"`
    ConnectionId  int    `json:"connectionId"`
    ScopeType     string `json:"scopeType"` // Ensure this field correctly identifies the scope type
    ScopeName     string `json:"scopeName"`
    // Add other necessary fields
}

Ensure the ScopeType field correctly identifies hudson.maven.MavenModuleSet as a scope. This way, when you create or update a scope configuration, it will be correctly categorized.

Example usage:

{
    "connectionId": 1,
    "scopeType": "hudson.maven.MavenModuleSet",
    "scopeName": "My Maven Project"
}

Additionally, according to the DevLake domain layer schema, Jenkins jobs are categorized under the CI/CD domain as cicd_scopes. Ensure that hudson.maven.MavenModuleSet is correctly mapped to a cicd_scope in the domain layer schema:

#### cicd_scopes

The entity to filter or group 'cicd_pipelines'.

- For Jenkins: a Jenkins job is converted to a cicd_scope

By following these steps, you can ensure that hudson.maven.MavenModuleSet is correctly categorized as a scope in DevLake [1][2].

To continue talking to Dosu, mention @dosu.

klesh commented 3 months ago

Lovely

klesh commented 3 months ago

I like the report-and-fix vibe here. 👍