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

[Bug][gitextractor] Unable to disable CollectDeployment #7611

Closed
2 of 3 tasks
lukayeh opened this issue Jun 12, 2024 · 1 comment · Fixed by #7612
Closed
2 of 3 tasks

[Bug][gitextractor] Unable to disable CollectDeployment #7611

lukayeh opened this issue Jun 12, 2024 · 1 comment · Fixed by #7612
Assignees
Labels
component/plugins This issue or PR relates to plugins pr-type/bug-fix This PR fixes a bug type/bug This issue is a bug

Comments

@lukayeh
Copy link

lukayeh commented Jun 12, 2024

Search before asking

  • I had searched in the issues and found no similar issues.

What happened

i’d like to disable the gitlab-collectDeployment but having difficulties doing so via environments variables:

                "plugin": "gitlab",
                "subtasks": [
                    "CollectDeployment",

this is what I’m using:
ENABLE_SUBTASKS_BY_DEFAULT="gitlab:CollectDeployment:false"

What do you expect to happen

CollectDeployments phase is removed from transform.

How to reproduce

set:
ENABLE_SUBTASKS_BY_DEFAULT="gitlab:CollectDeployment:false

Anything else

we had a look at the source (even v1.0.0-beta6) the Gilab plugin blueprint creation bypasses this function:
https://github.com/apache/incubator-devlake/blob/v1.0.0-beta6/backend/helpers/pluginhelper/api/pipeline_plan.go#L60
The above function utilises the ENABLE_SUBTASKS_BY_DEFAULT to enable or disable subtasks for the plugin. No other part of the code utilises that environment variable.

The Gitlab plugin bypasses MakePipelinePlanTask in the helper by calling MakePipelinePlanSubtasks helper instead which is what is ultimately called by MakePipelinePlanTask:
https://github.com/apache/incubator-devlake/blob/v1.0.0-beta6/backend/plugins/gitlab/api/blueprint_v200.go#L127

Version

v0.21.0@ac4f7fe

Are you willing to submit PR?

  • Yes I am willing to submit a PR!

Code of Conduct

@lukayeh lukayeh added the type/bug This issue is a bug label Jun 12, 2024
@d4x1 d4x1 self-assigned this Jun 12, 2024
@dosubot dosubot bot added component/plugins This issue or PR relates to plugins pr-type/bug-fix This PR fixes a bug labels Jun 12, 2024
Copy link

dosubot bot commented Jun 12, 2024

Hello @lukayeh! I'm here to help you with any bugs, questions, and contributions for the DevLake project. Let me know how I can assist you!

The issue you're encountering is due to the GitLab plugin directly calling MakePipelinePlanSubtasks instead of MakePipelinePlanTask, which processes the ENABLE_SUBTASKS_BY_DEFAULT environment variable.

To address this, you can modify the GitLab plugin's blueprint creation process to use MakePipelinePlanTask instead of MakePipelinePlanSubtasks. This change will ensure that the ENABLE_SUBTASKS_BY_DEFAULT environment variable is respected.

Here's a potential modification to the blueprint_v200.go file:

// Replace the direct call to MakePipelinePlanSubtasks with MakePipelinePlanTask
subtasks, err := helper.MakePipelinePlanTask("gitlab", subtaskMetas, scopeConfig.Entities, options)
if err != nil {
    return nil, err
}

This change will ensure that the CollectDeployment subtask can be disabled using the ENABLE_SUBTASKS_BY_DEFAULT environment variable.

After making this change, you can set the environment variable as follows:

export ENABLE_SUBTASKS_BY_DEFAULT="gitlab:CollectDeployment:false"

Then, restart the DevLake service to apply the changes:

  • For Docker Compose, run docker-compose down and docker-compose up -d.
  • For Helm, run helm upgrade devlake devlake/devlake --recreate-pods.

This should remove the CollectDeployment phase from the transformation process as expected [1][2].

To continue talking to Dosu, mention @dosu.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component/plugins This issue or PR relates to plugins pr-type/bug-fix This PR fixes a bug type/bug This issue is a bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants