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

passphraseServerId appears not to be set (or is different to the default) #129

Closed
3 tasks
zcourts opened this issue Mar 2, 2021 · 9 comments
Closed
3 tasks
Assignees
Labels
bug Something isn't working

Comments

@zcourts
Copy link

zcourts commented Mar 2, 2021

Description:
When using the maven-gpg-plugin during publishing of an artifact the action fails with:

[INFO] gpg: Sorry, no terminal at all requested - can't get input
[INFO] [INFO] ------------------------------------------------------------------------
[INFO] [INFO] BUILD FAILURE
[INFO] [INFO] ------------------------------------------------------------------------

I've seen issue #91 and the config snippet is included as listed there and in the project's README.
I had to manually set:

                    <passphraseServerId>gpg.passphrase</passphraseServerId>

Which as far as I understand should be the default.

Task version:
v1

Platform:

  • [x ] Ubuntu
  • macOS
  • Windows

Runner type:

  • [ x] Hosted
  • Self-hosted

Repro steps:
Use the plugin like this:

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-gpg-plugin</artifactId>
                <version>1.6</version>
                <configuration>
                    <!-- Prevent gpg from using pinentry programs -->
                    <gpgArguments>
                        <arg>--pinentry-mode</arg>
                        <arg>loopback</arg>
                    </gpgArguments>
                </configuration>
                <executions>
                    <execution>
                        <id>sign-artifacts</id>
                        <phase>verify</phase>
                        <goals>
                            <goal>sign</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>

Notice <passphraseServerId>gpg.passphrase</passphraseServerId> is not included.
In a subsequent step run:

      - name: Publish
        run: |
          git config --global user.email "[email protected]"
          git config --global user.name "Hypi Github Action"
          mvn -e -B -DscmCommentPrefix="[skip ci]" -DpushChanges=false release:prepare && \
          mvn -e -B -DscmCommentPrefix="[skip ci]" -DpushChanges=false release:perform -DlocalCheckout=true

Expected behavior:
mvn release:{prepare,perform} should work without having to set passphraseServerId to the default value.

Actual behavior:

passphraseServerId must be set to gpg.passphrase in pom.xml for the release to succeed.

@zcourts zcourts added bug Something isn't working needs triage labels Mar 2, 2021
@dmitry-shibanov
Copy link
Contributor

Hello @zcourts. Could you pease provide some more information about the issue ?

  • If I understood well, you want to specify passphraseServerId in the settings.xml file to skip it in pom.xml ?
  • Could you please provide some documentation about setting passphraseServerId in settings.xml file, because we're not experts in gpg plugin and maven publishing. For now I can see examples with setting passphraseServerId in pom.xml.

@andrebrait
Copy link

@dmitry-shibanov I'm experiencing the same, but setting passphraseServerId in the pom.xml (see below) does nothing for me. I keep getting gpg: Sorry, no terminal at all requested - can't get input.

                    <plugin>
                        <artifactId>maven-gpg-plugin</artifactId>
                        <configuration>
                            <passphraseServerId>gpg.passphrase</passphraseServerId> <!-- this can be omitted and the outcome is the same -->
                            <gpgArguments>
                                <arg>--pinentry-mode</arg>
                                <arg>loopback</arg>
                            </gpgArguments>
                        </configuration>
                        <executions>
                            <execution>
                                <id>sign-artifacts</id>
                                <phase>verify</phase>
                                <goals>
                                    <goal>sign</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>

Here's my workflow file:

https://github.com/elasticsoftwarefoundation/elasticactors/blob/71f222dfb7280cec42bd22ee7bea79867fa1d9be/.github/workflows/maven-publish.yml

@andrebrait
Copy link

It also happens with the task tag v2

@andrebrait
Copy link

andrebrait commented Apr 21, 2021

Update: I think that's because you must set settings-path: ${{ github.workspace }} in the action configuration and then pass --settings $GITHUB_WORKSPACE/settings.xml to maven.

It seems the main use-case for this action (a runner shared by multiple projects) is the one least focused on in the documentation.

@andrebrait
Copy link

Apparently you also need to specify the key to be used by maven-gpg-plugin with the keyname configuration.

Personally, I ended up just choosing to use the sign-maven-plugin instead of the maven-gpg-plugin

@dmitry-shibanov
Copy link
Contributor

Hello @zcourts , just gentle ping.
Hello @andrebrait. Documentation was updated, could you please take a look at it. If you see any possible improvements, Could you please tell us about it.

@dmitry-shibanov
Copy link
Contributor

Hello everyone. For now I'm closing the issue. If you have additional information, feel free to reopen it.

@zcourts
Copy link
Author

zcourts commented Jun 16, 2021

This got buried in hundreds of notifications.

  1. Its not that I want to set it but that by default it should have a value I believe of ${gpg.keyname} which means in settings.xml I can set gpg.keyname and have that picked up but for some reason this default variable isn't set when run in this action or it is being set to something else therefore I'm unable to set it in settings.xml
  2. I'm not an expert on the plugin myself, normally I've just configured and used it so this was the first time I had to dig into it https://maven.apache.org/plugins/maven-gpg-plugin/usage.html describes this parameter though not in any useful detail I suspect.

I don't have access to the project at the moment to remind myself what the final resolution was but I think I just provided that element in the config with the variable. No need to re-open there's a workaround and also the alternative sign-maven-plugin mentioned above

@caroso-de
Copy link

Just in case anyone else stumbles across this discussion looking for an answer to gpg: Sorry, no terminal at all requested - can't get input: in my case the problem simply was an outdated maven-gpg-plugin. The README works perfectly well for me now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants