Search code examples
androidgitlab-cigoogle-fabricfastlane

Undefined method uploading apk with Fastlane


I'm getting an error on gitlab ci server deploying/uploading an apk to Fabric with Fastlane. The strange thing is that it is working if I run the task from my local. The Fastlane is the same version in both cases 2.123.0.

The method of the task that is failing is:

31 desc "Generate QA release notes"
32 private_lane :qa_release_notes do 
33 commit = last_git_commit 
34 short_hash = commit[:abbreviated_commit_hash] 
35 author = commit[:author] 
36 message = commit[:message] 
37 "Release notes of commit " + short_hash + " by " + author +":\n " + message 
38 end

And the error printed in the ci log is:

[15:43:34]: Error in your Fastfile at line 34
[15:43:34]: 32:  private_lane :qa_release_notes do
[15:43:34]: 33:  commit = last_git_commit
[15:43:34]: => 34:   short_hash = commit[:abbreviated_commit_hash]
[15:43:34]: 35:  author = commit[:author]
[15:43:34]: 36:  message = commit[:message]

(...)

Fastfile:34:in block (2 levels) in parsing_binding': [!] undefined method []' for nil:NilClass (NoMethodError)
    from /var/lib/gems/2.3.0/gems/fastlane-2.123.0/fastlane/lib/fastlane/lane.rb:33:in `call'

It seems the problem is with the method commit[:abbreviated_commit_hash] But I don't know what the problem is...Any idea?


Solution

  • The error was the last_git_commit was getting an empty result (as @janpio said here) because for some reason the git was missing in the Docker image.