GitLab CI error: gem install bundler on MacOS - ruby

Using MacOS-10.14.3, there is a problem with my GitLab CI for an iOS project (using fastlane):
I try to create a gitlab-runner on my Mac and I get quite far with it, except the following error message occurs during CI-failure:
It seems that the error happens at the before_script for some reason.
Any idea what could be wrong here ?
From the fastlane page, I follow these instructions: Link
The Gitlab error seems to be related to a Ruby issue on Mac
I followed this suggestion here: I tried to re-install ruby, doing the following in a Terminal:
brew install ruby
echo 'export PATH="/usr/local/opt/ruby/bin:$PATH"' >> ~/.bash_profile
source ~/.bash_profile
But that did not help anything...
In case, interested, finding out what ruby is on my Mac:
ruby -v
ruby 2.6.2p47 (2019-03-13 revision 67232) [x86_64-darwin18]
which ruby
/usr/local/opt/ruby/bin/ruby
I use docker with image alpine:latest and I run my gitlab-runner from a Mac-Terminal with the following command:
sudo gitlab-runner run
Here is my Gemfile:
source 'https://rubygems.org'
gem 'fastlane'
gem 'cocoapods'
...and here is my gitlab-ci.yml file:
stages:
- unit_tests
- test_flight
variables:
LC_ALL: "en_US.UTF-8"
LANG: "en_US.UTF-8"
before_script:
- gem install bundler
- bundle install
unit_tests:
dependencies: []
stage: unit_tests
artifacts:
paths:
- fastlane/screenshots
- fastlane/logs
script:
- fastlane tests
tags:
- ios
test_flight_build:
dependencies: []
stage: test_flight
artifacts:
paths:
- fastlane/screenshots
- fastlane/logs
script:
- fastlane testflight
tags:
- ios
only:
- /^release-.*$/
- master
Any idea on how to change this GitLab CI File (or do anything else) so that this annoying gem install bundler error goes away ?? Any help appreciated.

Related

Using a custom path while using system gems is unsupported

Gitlab CI bundle install giving unexpected error. It was working perfectly fine till yesterday evening.
Referred to below solution but issue still persist:
bundler: Using a custom path while using system gems is unsupported
stages:
- test
cache:
key: test-app-cache
paths:
- vendor/
variables:
BUNDLE_DISABLE_SHARED_GEMS: "true"
BUNDLE_PATH__SYSTEM: "false"
deploy:
stage: test
image: "ruby:2.5"
script:
- gem update system
- gem install bundler -v 2.0.1
- bundle config --global disable_shared_gems true
- bundle install --path vendor
Skipping Git submodules setup
Checking cache for test-app-cache-9...
FATAL: file does not exist
Failed to extract cache
$ gem update system
Updating installed gems
Nothing to update
$ gem install bundler -v 2.0.1
Successfully installed bundler-2.0.1
1 gem installed
$ bundle config --global disable_shared_gems true
You have a bundler environment variable for disable_shared_gems set to "true". This will take precedence over the global value you are setting
$ bundle install --path vendor
Using a custom path while using system gems is unsupported.
path:
Set for your local app (/usr/local/bundle/config): "vendor"
Set via BUNDLE_PATH: "/usr/local/bundle"
path.system:
Set via BUNDLE_PATH__SYSTEM: true
disable_shared_gems:
Set via BUNDLE_DISABLE_SHARED_GEMS: true
Set for the current user (/root/.bundle/config): true
ERROR: Job failed: command terminated with exit code 1

gem executables will not run

Running gem install from shell script giving error even though I ruby version2.3.0 installed on my machine.
I am trying to install a gem from sh file. sh file code is as below:
cat > /tmp/install_bandshell.sh <<EOF
#!/bin/sh -e
cd /tmp
git clone git://github.com/concerto/bandshell.git
cd bandshell
gem build bandshell.gemspec
gem install *.gem
cd /
rm -rf /tmp/bandshell
EOF
chmod +x /tmp/install_bandshell.sh
/tmp/install_bandshell.sh
But when I run this sh file get error WARNING: You don't have /root/.gem/ruby/1.9.1/bin in your PATH, gem executables will not run. ERROR: Error installing bandshell-1.7.2.gem: rack requires Ruby version >= 2.2.2.
Even I install 2.3.0 gem env output
RubyGems Environment:
- RUBYGEMS VERSION: 2.5.1
- RUBY VERSION: 2.3.0 (2015-12-25 patchlevel 0) [x86_64-linux]
- INSTALLATION DIRECTORY: /usr/local/lib/ruby/gems/2.3.0/gems/
- USER INSTALLATION DIRECTORY: /root/.gem/ruby/2.3.0
- RUBY EXECUTABLE: /usr/local/bin/ruby
- EXECUTABLE DIRECTORY: /usr/local/lib/ruby/gems/2.3.0/gems/bin
- SPEC CACHE DIRECTORY: /root/.gem/specs
- SYSTEM CONFIGURATION DIRECTORY: /usr/local/etc
- RUBYGEMS PLATFORMS:
- ruby
- x86_64-linux
- GEM PATHS:
- /usr/local/lib/ruby/gems/2.3.0/gems/
- /root/.gem/ruby/2.3.0
- /usr/local/lib/ruby/gems/2.3.0
- GEM CONFIGURATION:
- :update_sources => true
- :verbose => true
- :backtrace => false
- :bulk_threshold => 1000
- REMOTE SOURCES:
- https://rubygems.org/
- SHELL PATH:
- /usr/local/sbin
- /usr/local/bin
- /usr/sbin
- /usr/bin
- /sbin
- /bin
- /usr/local/lib/ruby/gems/2.3.0/gems
From terminal, if I install this gem it works but from shell script giving above error. Please help me with this. Platform is Debian Wheezy.
I'm answering your primary question only, regarding the message. (Frankly, I don't know what's going on with your sh file, so I'm not going to address whatever other problems it causes.)
The message is a warning to you that any executables that the gem installs are not in your path. If the gem does not install any executables, then you can safely ignore the message. If it does (or you are simply unsure), then modify the path accordingly. How you do that depends on what shell you happen to be using. Since you have tagged the question with 'linux', I will guess that you are using bash; if so, add to either your ~/.profile or to ~/.bash_profile an entry similar to:
PATH="$PATH:/root/.gem/ruby/1.9.1/bin"
Now, at this point, I have to wonder - are you using ruby-1.9? You know that ruby 1.9 is obsolete, right? Actually, considering that you seem to be using Ruby 2.3.0, that's not likely. What I would suggest is to (at least temporarily) adjust your PATH as above to avoid the warning. I suspect you will still have problems, but then you can ask a new question without the WARNING that you have cited.
One last point, ignore suggestions that you should change your shebang to be other than "#!/bin/sh"; that's very unlikely to help.
Answering the WARNING: You don't have /root/.gem/ruby/1.9.1/bin in your PATH, gem executables will not run. problem...
Try add this line on your ~/.bashrc or ~/.zshrc:
export PATH="/root/.gem/ruby/1.9.1/bin:$PATH"

jekyll-multiple-languages-plugin cannot be found

I'm newbie to Ruby and Jekyll. Recently I've tried to install Jekyll Multiple Languages Plugin onto my GitLab Pages instance. I've managed to successfully add
'gem install jekyll-multiple-languages-plugin
bundle install'
into the .gitlab-ci.yml but when I try to add
gems:
jekyll-multiple-languages-plugin
into _config.yml in order to use it on the site my commit fails with the following error:
Using jekyll-watch 1.5.0
Using jekyll 3.4.3
Bundle complete! 3 Gemfile dependencies, 20 gems now installed.
Bundled gems are installed into /usr/local/bundle.
$ jekyll build -d public
Configuration file: /builds/myusername/forty-jekyll-theme/_config.yml
Dependency Error: Yikes! It looks like you don't have jekyll-multiple-languages-plugin or one of its dependencies installed. In order to use Jekyll as currently configured, you'll need to install this gem. The full error message from Ruby is: 'cannot load such file -- jekyll-multiple-languages-plugin' If you run into trouble, you can find helpful resources at https://jekyllrb.com/help/!
jekyll 3.4.3 | Error: jekyll-multiple-languages-plugin
ERROR: Job failed: exit code 1
I have used this method because any attempt to edit Gemfile ends up in commit error. I've also tried to do all presented steps except adding bundle install. In that case I get the same error, but the beginning looks like:
18 gems installed
$ gem install jekyll-multiple-languages-plugin
Successfully installed jekyll-multiple-languages-plugin-1.5.1
1 gem installed
$ jekyll build -d public
I did not manage to find the way to solve it on Stack Overflow nor other sites. For example this did not help
With the awesome support of allejo from Jekyll's IRC channel I've managed to solve the problem. Here are the steps:
I've used Gemfile. Now it looks like
source 'https://rubygems.org'
gem 'jekyll'
group :jekyll_plugins do
gem 'jekyll-multiple-languages-plugin'
end
The second modified thing was .gitlab-ci.yml (the first line - image: ruby - is also included)
image: ruby
pages:
stage: build
script:
# - gem install jekyll
- gem install bundler
# - gem install jekyll-multiple-languages-plugin
- bundle install
- bundle exec jekyll build -d public
# - jekyll build -d public
artifacts:
paths:
- public
only:
- master
It produced a bug, but it was only caused by the lack of declared language which is part of standard plugin configuration.

fluent custom plugin registration throws "Unknown output plugin"

I am trying to modify an existing Fluentd plugin and use it with my customization. So I :
git cloned the plugin repo from github. git clone <url>
Edited my changes
gem build plugin.gemspec
gem install plugin.gem
Created a config mentioning the type of plugin
Ran fluentd -c <fluend_conf.conf> -vv
And I ended up getting this in fluentd log(fluent-plugin-swift is the plugin I edited and the type of the plugin is 'swift'):
2017-03-22 15:00:27 +0000 [info]: fluent/engine.rb:126:block in configure:
gem 'fluent-plugin-swift' version '0.0.1'
2017-03-22 15:00:27 +0000 [error]: fluent/supervisor.rb:369:rescue in
main_process: config error file="fluend_conf.conf" error="Unknown output plugin
'swift'. Run 'gem search -rd fluent-plugin' to find plugins"
EDIT-1: For clarifications
I have also checked the naming convention of the plugin that is to be registered.
The plugin is present in <base_dir>/lib/fluent/plugin/.
Also the name of file is out_swift.rb. And finally
inside the file, the plugin gets registered as:
Fluent::Plugin.register_output('swift', self)
Also is there any way, I can check the list of registered plugins, and the name it uses to get registered to fluend?
NOTE:
The same had previously worked for me, I had to re-do this as someone had formatted the machine I had my changes.
Please let me what is wrong in my approach?
The problem could be with the installation path, Please check the following, :
Type gem environment
You will get to see the INSTALLATION DIRECTORY like:
RubyGems Environment:
- RUBYGEMS VERSION: 2.6.8
- RUBY VERSION: 2.4.0 (2016-12-24 patchlevel 0) [x86_64-linux]
- INSTALLATION DIRECTORY: /usr/local/lib/ruby/gems/2.4.0
- USER INSTALLATION DIRECTORY: /root/.gem/ruby/2.4.0
- RUBY EXECUTABLE: /usr/local/bin/ruby
- EXECUTABLE DIRECTORY: /usr/local/bin
- SPEC CACHE DIRECTORY: /root/.gem/specs
- SYSTEM CONFIGURATION DIRECTORY: /usr/local/etc
- RUBYGEMS PLATFORMS:
- ruby
- x86_64-linux
Go inside the INSTALLATION DIRECTORY directory, now do
cd gem/<ur_custom_plugin>
Now check whether, your files are there or not.
If not, you got your answer.
SOLUTION:
Simply copy your files to this directory and start fluentd
As the above mentioned, this may related to which gem you used to install the plugin, for my case in CentOS7, the td-agent-gem as below works:
td-agent-gem install <pluginname>
install ruby development environment
brew install rbenv
now run fluentD from ruby environment
~/.rbenv/shims/fluentd
this refers /etc/fluent/fluent.conf
Installing the plugin from ruby environment
~/.rbenv/shims/gem install fluent-plugin-rewrite-tag-filter

Commit details not show after upgrade gitlab from 6-7-stable to any other version

I have Gitlab Community Edition 6-7-stable with. When I upgrade it to any other version, I cannot see commit details at all -- error 500. As I can see, all gitlab work perfectly after upgrade, except "little" trouble above.
production.log;
Started GET "/myproject-ru/myproject_ru_rating/commit/b01d59be5ac7345c2eef984018b9cf6a1c3697e0" for 94.190.193.26 at 2014-12-15 07:36:06 -0500
Processing by Projects::CommitController#show as HTML
Parameters: {"project_id"=>"myproject-ru/myproject_ru_rating", "id"=>"b01d59be5ac7345c2eef984018b9cf6a1c3697e0"}
Completed 500 Internal Server Error in 190ms
NoMethodError (undefined method `system=' for #<Note:0xacc4548>):
app/models/project.rb:269:in `build_commit_note'
app/controllers/projects/commit_controller.rb:25:in `show'
app/controllers/application_controller.rb:59:in `set_current_user_for_thread'
root#gitlab:/home/git/gitlab# sudo -u git -H bundle exec rake gitlab:env:info RAILS_ENV=production
System information
System: Debian 7.7
Current User: git
Using RVM: no
Ruby Version: 1.9.3p545
Gem Version: 1.8.23.2
Bundler Version:1.7.9
Rake Version: 10.3.1
Sidekiq Version:2.17.0
GitLab information
Version: 6.9.2
Revision: e46b644
Directory: /home/git/gitlab
DB Adapter: mysql2
URL: http://my.git.host
HTTP Clone URL: http://my.git.host/some-project.git
SSH Clone URL: git#my.git.host:some-project.git
Using LDAP: no
Using Omniauth: no
GitLab Shell
Version: 1.9.4
Repositories: /home/git/repositories/
Hooks: /home/git/gitlab-shell/hooks/
Git: /usr/bin/git
Command
sudo -u git -H bundle exec rake gitlab:check RAILS_ENV=production
show all items green.
I tried upgrade to latest version -- problem persists.
I tried rebuild all bundles and recompile assets -- problem persists.
I tried upgrade ruby to latest version -- problem persists.
I tried set up fresh Gitlab 6-7-stable, migrate my data to it and then upgrade this installation -- problem persists.
Any ideas will be great.

Resources