qcastel / github-actions-maven-release

Release your Java application and publish artifacts
129 stars 38 forks source link

missing -Dgpg.skip when releasing without GPG support ? #24

Closed laurentleseigneur closed 3 years ago

laurentleseigneur commented 3 years ago

hi,

I'm using v1.12.15 with this config:

     - uses: qcastel/github-actions-maven-release@v1.12.15
        with:
          release-branch-name: "main"
          git-release-bot-name: "release-bot"
          git-release-bot-email: "release-bot@github.com"
          skip-perform: true
          gpg-enabled: false
          access-token: ${{ secrets.GITHUB_TOKEN }}

and log confirms my config :

Run qcastel/github-actions-maven-release@v1.12.15
/usr/bin/docker run --name e4c1b42ad92aca492cae3928844dd936cc_ab9f1a --label 5588e4 --workdir /github/workspace --rm -e INPUT_RELEASE-BRANCH-NAME -e INPUT_GIT-RELEASE-BOT-NAME -e INPUT_GIT-RELEASE-BOT-EMAIL -e INPUT_SKIP-PERFORM -e INPUT_GPG-ENABLED -e INPUT_ACCESS-TOKEN -e INPUT_GPG-KEY-ID -e INPUT_GPG-KEY -e INPUT_GPG-PASSPHRASE -e INPUT_SSH-PRIVATE-KEY -e INPUT_SSH-PASSPHRASE -e INPUT_MAVEN-REPO-SERVER-ID -e INPUT_MAVEN-REPO-SERVER-USERNAME -e INPUT_MAVEN-REPO-SERVER*** INPUT_MAVEN-ARGS -e INPUT_MAVEN-PROJECT-FOLDER -e INPUT_MAVEN-OPTIONS -e INPUT_DOCKER-REGISTRY-ID -e INPUT_DOCKER-REGISTRY-USERNAME -e INPUT_DOCKER-REGISTRY*** INPUT_VERSION-MAJOR -e INPUT_VERSION-MINOR -e INPUT_M2-HOME-FOLDER -e GPG_ENABLED -e GPG_KEY_ID -e GPG_KEY -e GPG_PASSPHRASE -e SSH_PRIVATE_KEY -e SSH_ROOT_FOLDER -e SSH_PASSPHRASE -e MAVEN_REPO_SERVER_ID -e MAVEN_REPO_SERVER_USERNAME -e MAVEN_REPO_SERVER_PASSWORD -e MAVEN_PROJECT_FOLDER -e MAVEN_ARGS -e MAVEN_OPTION -e DOCKER_REGISTRY_ID -e DOCKER_REGISTRY_USERNAME -e DOCKER_REGISTRY_PASSWORD -e M2_HOME_FOLDER -e GIT_RELEASE_BOT_NAME -e GIT_RELEASE_BOT_EMAIL -e SKIP_PERFORM -e GITREPO_ACCESS_TOKEN -e VERSION_MAJOR -e VERSION_MINOR -e RELEASE_BRANCH_NAME -e HOME -e GITHUB_JOB -e GITHUB_REF -e GITHUB_SHA -e GITHUB_REPOSITORY -e GITHUB_REPOSITORY_OWNER -e GITHUB_RUN_ID -e GITHUB_RUN_NUMBER -e GITHUB_RETENTION_DAYS -e GITHUB_ACTOR -e GITHUB_WORKFLOW -e GITHUB_HEAD_REF -e GITHUB_BASE_REF -e GITHUB_EVENT_NAME -e GITHUB_SERVER_URL -e GITHUB_API_URL -e GITHUB_GRAPHQL_URL -e GITHUB_WORKSPACE -e GITHUB_ACTION -e GITHUB_EVENT_PATH -e GITHUB_ACTION_REPOSITORY -e GITHUB_ACTION_REF -e GITHUB_PATH -e GITHUB_ENV -e RUNNER_OS -e RUNNER_TOOL_CACHE -e RUNNER_TEMP -e RUNNER_WORKSPACE -e ACTIONS_RUNTIME_URL -e ACTIONS_RUNTIME_TOKEN -e ACTIONS_CACHE_URL -e GITHUB_ACTIONS=true -e CI=true -v "/var/run/docker.sock":"/var/run/docker.sock" -v "/home/runner/work/_temp/_github_home":"/github/home" -v "/home/runner/work/_temp/_github_workflow":"/github/workflow" -v "/home/runner/work/_temp/_runner_file_commands":"/github/file_commands" -v "/home/runner/work/connector-bdm-generation/connector-bdm-generation":"/github/workspace" 5588e4:c1b42ad92aca492cae3928844dd936cc  "release-github-actions.sh"
Last release-bot commit: 
Current commit: ea15c2924e56917e870a12bf8e351f11701271df
INFO - M2 folder '/root/.m2' not empty. We therefore will beneficy from the CI cache
Current branch: main
Release branch name: main
We are on the release branch
Using SSH folder /root/.ssh
Using M2 repository folder /root/.m2
/root/.m2 is empty, this means we didn't hit a potential M2 cache :(
Git checkout branch main
Already on 'main'
Your branch is up to date with 'origin/main'.
Git reset hard to ea15c2924e56917e870a12bf8e351f11701271df
HEAD is now at ea15c29 disable GPG and fix docker image version
Setup git user name to 'release-bot'
Setup git user email to 'release-bot@github.com'
GPG_ENABLED 'false'
GPG signing is not enabled
No SSH key defined
Move to folder ./
Git repo access token defined and no SSH setup. We then use the git repo access token via maven release to commit in the repo.
Do mvn release:prepare with options  -Dusername=*** and arguments 

but my build fails with this message, so I understand the release:prepare fails event if GPG sign is disabled

    13:11:05,026 [INFO] 
    13:11:05,030 [INFO] --- maven-gpg-plugin:1.1:sign (sign-artifacts) @ connector-bdm-generation ---
    13:11:05,059 [INFO] ------------------------------------------------------------------------
    13:11:05,067 [INFO] BUILD FAILURE
    13:11:05,068 [INFO] ------------------------------------------------------------------------
    13:11:05,072 [INFO] Total time:  50.758 s
    13:11:05,074 [INFO] Finished at: 2021-03-01T13:11:05Z
    13:11:05,076 [INFO] ------------------------------------------------------------------------
Error: 11:05,081 [ERROR] Failed to execute goal org.apache.maven.plugins:maven-gpg-plugin:1.1:sign (sign-artifacts) on project connector-bdm-generation: Cannot obtain passphrase in batch mode -> [Help 1]
Error: 11:05,088 [ERROR] 
Error: 11:05,089 [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
Error: 11:05,092 [ERROR] Re-run Maven using the -X switch to enable full debug logging.
Error: 11:05,095 [ERROR] 
Error: 11:05,096 [ERROR] For more information about the errors and possible solutions, please read the following articles:
Error: 11:05,100 [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException
13:11:05,148 [INFO] ------------------------------------------------------------------------
13:11:05,150 [INFO] BUILD FAILURE
13:11:05,150 [INFO] ------------------------------------------------------------------------
13:11:05,152 [INFO] Total time:  01:05 min
13:11:05,153 [INFO] Finished at: 2021-03-01T13:11:05Z
13:11:05,153 [INFO] ------------------------------------------------------------------------
Error: 5,155 [ERROR] Failed to execute goal org.apache.maven.plugins:maven-release-plugin:2.4.1:prepare (default-cli) on project connector-bdm-generation: Maven execution failed, exit code: '1' -> [Help 1]
Error: 5,156 [ERROR] 
Error: 5,156 [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
Error: 5,156 [ERROR] Re-run Maven using the -X switch to enable full debug logging.
Error: 5,157 [ERROR] 
Error: 5,157 [ERROR] For more information about the errors and possible solutions, please read the following articles:
Error: 5,157 [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException

while reading https://github.com/qcastel/docker-maven-release/blob/master/release.sh, is a maven arg missing -Dgpg.skipwhen calling realease:prepare ?

qcastel commented 3 years ago

In theory I tackled already that using https://github.com/qcastel/docker-maven-release/blob/master/settings.xml#L28

Not sure why maven is still trying to enable GPG.

Trying -Dgpg.skip is not a bad idea though, just as a way to troubleshoot. Can you try setting up that value using one of those two otions: https://github.com/qcastel/github-actions-maven-release#maven-options ?

qcastel commented 3 years ago

I just tried: https://github.com/qcastel/github-actions-maven-release-sample/commit/f249502cd08bce61eb9b1ad986702bf3b678f1fc

and it looks to work on this repo: https://github.com/qcastel/github-actions-maven-release-sample/commits/master

Noticed you are using maven plugin 2.4.1, maybe try to upgrade to 2.5.3 at the occasion

qcastel commented 3 years ago

btw @laurentleseigneur I did publish https://quentincastel86.medium.com/release-your-maven-project-using-github-actions-51beba1e4834 recently, maybe interest you

laurentleseigneur commented 3 years ago

thanks for your quick response @qcastel and your nice article!

finally, i chose to add explicit skip in pom.xml for this project in order to keep the same behaviour in my IDE. this now works as expected

<plugin>                                        
    <groupId>org.apache.maven.plugins</groupId> 
    <artifactId>maven-gpg-plugin</artifactId>   
    <version>1.6</version>                      
    <configuration>                             
        <skip>true</skip>                       
    </configuration>                            
</plugin>                                       

I can do a PR in your doc to explain this

qcastel commented 3 years ago

Yes, that would be awesome! Probably in the section where it explains how to setup the GPG key etc

laurentleseigneur commented 3 years ago

added this in #34

qcastel commented 3 years ago

perfect, merged!

Thanks for your contribution @laurentleseigneur !