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

[packagers] asdf publisher reports success even if commit isn't pushed #1582

Open
4 tasks done
haydenbaker opened this issue Jan 30, 2024 · 3 comments
Open
4 tasks done
Labels
bug Something isn't working

Comments

@haydenbaker
Copy link

haydenbaker commented Jan 30, 2024

TLDR

If a PAT used for a release doesn't have the right scopes, certain git operations may fail, but JReleaser does not fail when it should.

Task List

  • Steps to reproduce provided
  • Stacktrace (if present) provided
  • Example that reproduces the problem (link to git repository is ideal)
  • Full description of the issue provided (see below)

Steps to Reproduce

  • Set up an empty asdf repo for the asdf scripts (or in my case an already existing repo made by hand)
  • Set up release with an asdf publisher
  • Create a PAT without the workflow scope, but with repo scope
  • Run the full release
  • Observe that success is reported and that the log doesn't contain an error:
[INFO]      [asdf] pushing to haydenbaker/asdf-smithy
[DEBUG]     [asdf] pushing commit to remote
  • Observe repo doesn't have the release commit

Expected Behaviour

  • JReleaser should fail when a release commit doesn't actually get pushed

Actual Behaviour

  • No errors are reported, and commit is not actually pushed

Environment Information

  • Operating System: MacOS Ventura 13.6
  • JReleaser Version: Latest
  • JDK Version: 17

Please paste stacktraces from [out|build|target]/jreleaser/trace.log.
N/A, no traces observed. HOWEVER, I only discovered the fix when running the release with debug logs (gradle):

2024-01-30T11:32:21.784-0800 [DEBUG] [org.eclipse.jgit.transport.PacketLineIn] git< unpack ok
2024-01-30T11:32:21.784-0800 [DEBUG] [org.eclipse.jgit.transport.PacketLineIn] git< ng refs/heads/main refusing to allow a Personal Access Token to create or update workflow `.github/workflows/build.yml` without `workflow` scope

I'd assume this affects other publishers as well, but haven't tried it.

@haydenbaker haydenbaker added the bug Something isn't working label Jan 30, 2024
@haydenbaker haydenbaker changed the title asdf publisher reports success even commit isn't actually pushed asdf publisher reports success even if commit isn't actually pushed Jan 30, 2024
@haydenbaker haydenbaker changed the title asdf publisher reports success even if commit isn't actually pushed asdf publisher reports success even if commit isn't pushed Jan 30, 2024
@aalmiray aalmiray changed the title asdf publisher reports success even if commit isn't pushed [packagers] asdf publisher reports success even if commit isn't pushed Jan 30, 2024
@aalmiray
Copy link
Member

There might be an exception that's being swallowed or incorrect handling of an HTTP error.

@aalmiray
Copy link
Member

aalmiray commented Feb 8, 2024

I would have expected an error to occur at

git.push()
.setDryRun(false)
.setPushAll()
.setCredentialsProvider(credentialsProvider)
.setPushTags()
.call();
but it does not. I'm able to reproduce the problem.

I wonder if this has been fixed in a later version of JGit (6.x) in which case we must pause the upgrade til JReleaser switches its baseline to Java 11 as a minimum.

@aalmiray
Copy link
Member

aalmiray commented Feb 8, 2024

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

2 participants