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

local_user is nil in CircleCI #34

Closed
mochizukikotaro opened this issue Apr 2, 2018 · 3 comments
Closed

local_user is nil in CircleCI #34

mochizukikotaro opened this issue Apr 2, 2018 · 3 comments

Comments

@mochizukikotaro
Copy link
Contributor

mochizukikotaro commented Apr 2, 2018

Hi!
I used capistrano-slackify in CircleCI 2.0, and encountered below error.

00:00 slack:notify_failed
      Notifying Slack of deploy failed
bundler: failed to load command: cap (/home/circleci/repo/vendor/bundle/ruby/2.4.0/bin/cap)
NoMethodError: undefined method `strip' for nil:NilClass

https://github.com/onthebeach/capistrano-slackify/blob/master/lib/capistrano/tasks/slackify.cap#L64

In CircleCI, local_user is nil.
So, I added Environment Variable USER in CircleCI. But it was difficult to notice this cause.

I am thinking of a pull request like below,

capistrano-slackify/lib/capistrano/tasks/slackify.cap

- set :slack_user, -> { local_user.strip }
+ set :slack_user, -> { local_user.to_s.strip }

what do you think about it? Please tell me any other good ideas.
Thanks!

@seenmyfate
Copy link
Contributor

Hi @mochizukikotaro, thanks for the report - that would be a good approach for me. Capistrano sets this value to ENV["USER"] || ENV["LOGNAME"] || ENV["USERNAME"] if it hasn't been explicitly set, so treating it always as string here seems like something that would inevitably trip us up at some point.

@mochizukikotaro
Copy link
Contributor Author

mochizukikotaro commented Apr 4, 2018

Hi @seenmyfate, thanks!
I made pull request. #35

@seenmyfate
Copy link
Contributor

seenmyfate commented Apr 4, 2018

@mochizukikotaro thanks for the quick turn around! This is now available on Rubygems as v2.10.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants