[jira] [Commented] (NIFI-12668) Test for Git-backed Registry fails with global Git config value

2024-01-25 Thread ASF subversion and git services (Jira)


[ 
https://issues.apache.org/jira/browse/NIFI-12668?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17811060#comment-17811060
 ] 

ASF subversion and git services commented on NIFI-12668:


Commit 49702f1f510cc33c9cb52bb5b9580009a1d8afe8 in nifi's branch 
refs/heads/main from Brian Ghigiarelli
[ https://gitbox.apache.org/repos/asf?p=nifi.git;h=49702f1f51 ]

NIFI-12668 Fix conflict in Registry Git provider with gpg.format=ssh

NIFI-12667 Upgraded JGit from 6.7.0 to 6.8.0

This closes #8300

Signed-off-by: David Handermann 


> Test for Git-backed Registry fails with global Git config value
> ---
>
> Key: NIFI-12668
> URL: https://issues.apache.org/jira/browse/NIFI-12668
> Project: Apache NiFi
>  Issue Type: Improvement
>  Components: NiFi Registry
>Affects Versions: 2.0.0-M1
>Reporter: Brian Ghigiarelli
>Priority: Minor
>  Time Spent: 20m
>  Remaining Estimate: 0h
>
> The Git-backed Registry provider, GitFlowPersistenceProvider, does not 
> digitally sign commits to Git, nor does it specify the GPG configuration that 
> would be used if it were to sign commits. See 
> [GitFlowMetaData.java:478|https://github.com/apache/nifi/blob/89836f32d017d77972a4de09c4e864b0e11899a8/nifi-registry/nifi-registry-core/nifi-registry-framework/src/main/java/org/apache/nifi/registry/provider/flow/git/GitFlowMetaData.java#L478].
> When the GPG configuration is not specified, the underlying jgit library uses 
> the default value of openpgp for the GPG format when it performs the commit. 
> This works fine except when the system's global Git configuration has 
> `gpg.format` set to `ssh`. Available options are:
>  * openpgp (default)
>  * x509
>  * ssh
> The underlying jgit library does not recognize `ssh` as a valid GPG format. 
> jgit validates the GPG configuration when committing to git, whether it signs 
> the commit or not.
> This issue manifests when a user attempts to run NiFi's tests with their 
> global Git configuration has `gpg.format` set to `ssh`. It would also occur 
> if the NiFi Registry ran on a server with Git installed and configured in the 
> same manner.
> h3. Steps to reproduce
> From the root NiFi source code directory, run:
> {code:java}
> git config --global gpg.format ssh
> cd ./nifi-registry/nifi-registry-core/nifi-registry-framework
> mvn clean test{code}
> h3. Observed Failure
> {code:java}
> [ERROR] Tests run: 6, Failures: 0, Errors: 2, Skipped: 0, Time elapsed: 3.387 
> s <<< FAILURE! -- in 
> org.apache.nifi.registry.provider.flow.git.TestGitFlowPersistenceProvider
> [ERROR] 
> org.apache.nifi.registry.provider.flow.git.TestGitFlowPersistenceProvider.testLoadLargeFlow
>  -- Time elapsed: 3.273 s <<< ERROR!
> java.lang.IllegalArgumentException: Invalid value: gpg.format=ssh
>   at 
> org.eclipse.jgit.lib.DefaultTypedConfigGetter.getEnum(DefaultTypedConfigGetter.java:103)
>   at org.eclipse.jgit.lib.Config.getEnum(Config.java:453)
>   at org.eclipse.jgit.lib.GpgConfig.(GpgConfig.java:86)
>   at 
> org.eclipse.jgit.api.CommitCommand.processOptions(CommitCommand.java:662)
>   at org.eclipse.jgit.api.CommitCommand.call(CommitCommand.java:189)
>   at 
> org.apache.nifi.registry.provider.flow.git.GitFlowMetaData.commit(GitFlowMetaData.java:481)
>   at 
> org.apache.nifi.registry.provider.flow.git.GitFlowPersistenceProvider.saveFlowContent(GitFlowPersistenceProvider.java:187)
>   at 
> org.apache.nifi.registry.provider.flow.git.TestGitFlowPersistenceProvider.lambda$testLoadLargeFlow$14(TestGitFlowPersistenceProvider.java:311)
>   at 
> org.apache.nifi.registry.provider.flow.git.TestGitFlowPersistenceProvider.assertProvider(TestGitFlowPersistenceProvider.java:112)
>   at 
> org.apache.nifi.registry.provider.flow.git.TestGitFlowPersistenceProvider.testLoadLargeFlow(TestGitFlowPersistenceProvider.java:300)
>   at java.base/java.lang.reflect.Method.invoke(Method.java:580)
>   at java.base/java.util.ArrayList.forEach(ArrayList.java:1596)
>   at java.base/java.util.ArrayList.forEach(ArrayList.java:1596)
> [ERROR] 
> org.apache.nifi.registry.provider.flow.git.TestGitFlowPersistenceProvider.testLoadCommitHistories
>  -- Time elapsed: 0.008 s <<< ERROR!
> java.lang.IllegalArgumentException: Invalid value: gpg.format=ssh
>   at 
> org.eclipse.jgit.lib.DefaultTypedConfigGetter.getEnum(DefaultTypedConfigGetter.java:103)
>   at org.eclipse.jgit.lib.Config.getEnum(Config.java:453)
>   at org.eclipse.jgit.lib.GpgConfig.(GpgConfig.java:86)
>   at 
> org.eclipse.jgit.api.CommitCommand.processOptions(CommitCommand.java:662)
>   at org.eclipse.jgit.api.CommitCommand.call(CommitCommand.java:189)
>   at 
> org.apache.nifi.registry.provider.flow.git.GitFlowMetaData.commit(GitFlowMetaData.java:481)
>   at 
> 

[jira] [Commented] (NIFI-12668) Test for Git-backed Registry fails with global Git config value

2024-01-24 Thread Brian Ghigiarelli (Jira)


[ 
https://issues.apache.org/jira/browse/NIFI-12668?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17810626#comment-17810626
 ] 

Brian Ghigiarelli commented on NIFI-12668:
--

This is still an issue after upgrading to the latest version of JGit 
6.8.0.202311291450-r, per NIFI-12667.

> Test for Git-backed Registry fails with global Git config value
> ---
>
> Key: NIFI-12668
> URL: https://issues.apache.org/jira/browse/NIFI-12668
> Project: Apache NiFi
>  Issue Type: Improvement
>  Components: NiFi Registry
>Affects Versions: 2.0.0-M1
>Reporter: Brian Ghigiarelli
>Priority: Minor
>
> The Git-backed Registry provider, GitFlowPersistenceProvider, does not 
> digitally sign commits to Git, nor does it specify the GPG configuration that 
> would be used if it were to sign commits. See 
> [GitFlowMetaData.java:478|https://github.com/apache/nifi/blob/89836f32d017d77972a4de09c4e864b0e11899a8/nifi-registry/nifi-registry-core/nifi-registry-framework/src/main/java/org/apache/nifi/registry/provider/flow/git/GitFlowMetaData.java#L478].
> When the GPG configuration is not specified, the underlying jgit library uses 
> the default value of openpgp for the GPG format when it performs the commit. 
> This works fine except when the system's global Git configuration has 
> `gpg.format` set to `ssh`. Available options are:
>  * openpgp (default)
>  * x509
>  * ssh
> The underlying jgit library does not recognize `ssh` as a valid GPG format. 
> jgit validates the GPG configuration when committing to git, whether it signs 
> the commit or not.
> This issue manifests when a user attempts to run NiFi's tests with their 
> global Git configuration has `gpg.format` set to `ssh`. It would also occur 
> if the NiFi Registry ran on a server with Git installed and configured in the 
> same manner.
> h3. Steps to reproduce
> From the root NiFi source code directory, run:
> {code:java}
> git config --global gpg.format ssh
> cd ./nifi-registry/nifi-registry-core/nifi-registry-framework
> mvn clean test{code}
> h3. Observed Failure
> {code:java}
> [ERROR] Tests run: 6, Failures: 0, Errors: 2, Skipped: 0, Time elapsed: 3.387 
> s <<< FAILURE! -- in 
> org.apache.nifi.registry.provider.flow.git.TestGitFlowPersistenceProvider
> [ERROR] 
> org.apache.nifi.registry.provider.flow.git.TestGitFlowPersistenceProvider.testLoadLargeFlow
>  -- Time elapsed: 3.273 s <<< ERROR!
> java.lang.IllegalArgumentException: Invalid value: gpg.format=ssh
>   at 
> org.eclipse.jgit.lib.DefaultTypedConfigGetter.getEnum(DefaultTypedConfigGetter.java:103)
>   at org.eclipse.jgit.lib.Config.getEnum(Config.java:453)
>   at org.eclipse.jgit.lib.GpgConfig.(GpgConfig.java:86)
>   at 
> org.eclipse.jgit.api.CommitCommand.processOptions(CommitCommand.java:662)
>   at org.eclipse.jgit.api.CommitCommand.call(CommitCommand.java:189)
>   at 
> org.apache.nifi.registry.provider.flow.git.GitFlowMetaData.commit(GitFlowMetaData.java:481)
>   at 
> org.apache.nifi.registry.provider.flow.git.GitFlowPersistenceProvider.saveFlowContent(GitFlowPersistenceProvider.java:187)
>   at 
> org.apache.nifi.registry.provider.flow.git.TestGitFlowPersistenceProvider.lambda$testLoadLargeFlow$14(TestGitFlowPersistenceProvider.java:311)
>   at 
> org.apache.nifi.registry.provider.flow.git.TestGitFlowPersistenceProvider.assertProvider(TestGitFlowPersistenceProvider.java:112)
>   at 
> org.apache.nifi.registry.provider.flow.git.TestGitFlowPersistenceProvider.testLoadLargeFlow(TestGitFlowPersistenceProvider.java:300)
>   at java.base/java.lang.reflect.Method.invoke(Method.java:580)
>   at java.base/java.util.ArrayList.forEach(ArrayList.java:1596)
>   at java.base/java.util.ArrayList.forEach(ArrayList.java:1596)
> [ERROR] 
> org.apache.nifi.registry.provider.flow.git.TestGitFlowPersistenceProvider.testLoadCommitHistories
>  -- Time elapsed: 0.008 s <<< ERROR!
> java.lang.IllegalArgumentException: Invalid value: gpg.format=ssh
>   at 
> org.eclipse.jgit.lib.DefaultTypedConfigGetter.getEnum(DefaultTypedConfigGetter.java:103)
>   at org.eclipse.jgit.lib.Config.getEnum(Config.java:453)
>   at org.eclipse.jgit.lib.GpgConfig.(GpgConfig.java:86)
>   at 
> org.eclipse.jgit.api.CommitCommand.processOptions(CommitCommand.java:662)
>   at org.eclipse.jgit.api.CommitCommand.call(CommitCommand.java:189)
>   at 
> org.apache.nifi.registry.provider.flow.git.GitFlowMetaData.commit(GitFlowMetaData.java:481)
>   at 
> org.apache.nifi.registry.provider.flow.git.GitFlowPersistenceProvider.saveFlowContent(GitFlowPersistenceProvider.java:187)
>   at 
> org.apache.nifi.registry.provider.flow.git.TestGitFlowPersistenceProvider.lambda$testLoadCommitHistories$6(TestGitFlowPersistenceProvider.java:153)
>   at 
>