kestra-io / plugin-git

Apache License 2.0
3 stars 4 forks source link

Manage NullPointerException when namespaceFiles.enabled property is not true #96

Open bellec1u opened 1 month ago

bellec1u commented 1 month ago

What changes are being made and why?

Manage the case when the property namespaceFiles.enabled is not true.

The objective of this pull request is to be able to not commit the namespace files to a git repository.

[!NOTE] This case can be reached by using false as value.

So maybe the main issue seems coming from the @PluginProperty annotation as lombok set it at null ? Why not using native boolean ?

Moreover, I'm not able to exclude them via namespaceFiles.exclude

Example:

- id: test
  type: io.kestra.plugin.get.Push
  namespaceFiles:
    enabled: false
  ...

Execution result:

java.long.NullPointerException: Cannot invoke "java.lang.Boolean.booleanValue()" because the return value of "io.kestra.core.models.tasks.NamespaceFiles.getEnabled()" is null

How the changes have been QAed?

tasks:
  - id: working_directory
    type: io.kestra.plugin.core.flow.WorkingDirectory
    tasks:

    - id: pull
      type: io.kestra.plugin.git.Clone
      url: "{{ my_repo_url }}"
      branch: "{{ my_branch }}"
      username: "{{ my_username}}"
      password: "{{ my_password }}"

  # do some tasks in order to do changes on the git repository files

    - id: push
      type: io.kestra.plugin.git.Push
      namespaceFiles:
        enabled: false
      flows:
        enabled: false
      branch: "{{ my_branch }}"
      username: "{{ my_username}}"
      password: "{{ my_password }}"
      commitMessage: "{{ my_commit_message }}"