Using a custom path while using system gems is unsupported - ruby

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

Related

GitLab CI error: gem install bundler on MacOS

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.

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

Another GitLab "Can't save project. Please try again later"

I did a fresh install from source of GitLab 7.2 stable (7.2.1) and when I try to create a project I get the message:
Can't save project. Please try again later
Although, I can create users and groups just fine.
I modified the /gitlab/app/services/projects/create_service.rb to print the exception error message and it says:
undefined local variable or method `tagging_contexts' for #<Project:0xb983b318>
Searching through the gems folder, it looks like it is related to gem acts-as-taggable-on-3.4.1
The Gemfile and Gemfile.lock have that reference in place. And I also have it in the directory gitlab/vendor/bundle/ruby/2.1.0/gems.
Does anyone know why am I getting this error and how to fix it?
Information about the system:
Installation on ODROID-XU3 was based on https://gitlab.com/gitlab-org/gitlab-ce/blob/master/doc/install/installation.md and https://gitlab.com/gitlab-org/gitlab-ce/blob/master/doc/install/database_mysql.md, but I had to remove gems pg and therubyracer. Gem jquery-ui-rails I had to force version "~> 4.2.1".
Git-core and Ruby were built from source. Redis-server and Redis-tools were installed from package version 2.8.4-2.
sudo -u git -H bundle exec rake gitlab:env:info RAILS_ENV=production
[deprecated] I18n.enforce_available_locales will default to true in the future. If you really want to skip validation of your locale you can set I18n.enforce_available_locales = false to avoid this message.
System information
System: Ubuntu 14.04
Current User: git
Using RVM: no
Ruby Version: 2.1.2p95
Gem Version: 2.2.2
Bundler Version:1.7.2
Rake Version: 10.3.2
Sidekiq Version:2.17.0
GitLab information
Version: 7.2.1
Revision: ff1633f
Directory: /home/git/gitlab
DB Adapter: mysql2
URL: http://192.168.1.150
HTTP Clone URL: http://192.168.1.150/some-project.git
SSH Clone URL: git#192.168.1.150:some-project.git
Using LDAP: no
Using Omniauth: no
GitLab Shell
Version: 1.9.7
Repositories: /home/git/repositories/
Hooks: /home/git/gitlab-shell/hooks/
Git: /usr/local/bin/git
sudo -u git -H bundle exec rake gitlab:check RAILS_ENV=production
[deprecated] I18n.enforce_available_locales will default to true in the future. If you really want to skip validation of your locale you can set I18n.enforce_available_locales = false to avoid this message.
Checking Environment ...
Git configured for git user? ... yes
Checking Environment ... Finished
Checking GitLab Shell ...
GitLab Shell version >= 1.9.7 ? ... OK (1.9.7)
Repo base directory exists? ... yes
Repo base directory is a symlink? ... no
Repo base owned by git:git? ... yes
Repo base access is drwxrws---? ... yes
Satellites access is drwxr-x---? ... yes
update hook up-to-date? ... yes
update hooks in repos are links: ... can't check, you have no projects
Running /home/git/gitlab-shell/bin/check
Check GitLab API access: OK
Check directories and files:
/home/git/repositories/: OK
/home/git/.ssh/authorized_keys: OK
Test redis-cli executable: redis-cli 2.8.4
Send ping to redis server: PONG
gitlab-shell self-check successful
Checking GitLab Shell ... Finished
Checking Sidekiq ...
Running? ... yes
Number of Sidekiq processes ... 1
Checking Sidekiq ... Finished
Checking LDAP ...
LDAP is disabled in config/gitlab.yml
Checking LDAP ... Finished
Checking GitLab ...
Database config exists? ... yes
Database is SQLite ... no
All migrations up? ... yes
Database contains orphaned UsersGroups? ... no
GitLab config exists? ... yes
GitLab config outdated? ... no
Log directory writable? ... yes
Tmp directory writable? ... yes
Init script exists? ... yes
Init script up-to-date? ... yes
projects have namespace: ... can't check, you have no projects
Projects have satellites? ... can't check, you have no projects
Redis version >= 2.0.0? ... yes
Ruby version >= 2.0.0 ? ... yes (2.1.2)
Your git bin path is "/usr/local/bin/git"
Git version >= 1.7.10 ? ... yes (2.1.0)
Checking GitLab ... Finished

referencing a ruby gem from git breaks aws beanstalk deployment

I have set up my aws environment succesfully. However i am having one probelem. In my Gemfile i have the following line:
gem 'activeadmin', :github => 'gregbell/active_admin'
When i do a git aws.push i can see the following error in the aws logs:
/usr/local/share/ruby/gems/2.0/gems/bundler-1.3.5/lib/bundler/source/git.rb:177:in `rescue in load_spec_files': git://github.com/gregbell/active_admin.git (at master) is not checked out. Please run `bundle install` (Bundler::GitError)
I was able to fix that problem by creating this file: .ebextensions/ruby.config
option_settings:
- option_name: BUNDLE_DISABLE_SHARED_GEMS
value: "1"
- option_name: BUNDLE_PATH
value: "vendor/bundle"
packages:
yum:
git: []
This packages everything into vendor/bundle and my app starts correctyl.
However I have two problems with this approach:
It takes very long to deploy because it needs to install all gems every time
I am not longer able to execute commands when I ssh into the EC2 instance. For example I have to start an rpush deamon. Locally this works with bundle exec rpush development but on EC2 this results in:
bundle exec rpush
/usr/local/share/ruby/gems/2.0/gems/bundler-1.3.5/lib/bundler.rb:284: warning: Insecure world writable dir /var/app/current/vendor/bundle/bin in PATH, mode 040777
git://github.com/gregbell/active_admin.git (at master) is not checked out. Please run bundle install
Is there an other way for installing the gems correctly and at the same time using the system gems? Or if that is not possible, how can I start rpush when the gems are bundled?
Update your Gemfile.lock (bundle install&& bundle update) in your local env. and push a commit with Gemfile and Gemfile.lock. Deploy to AWS again.
Can you check if using gem 'activeadmin', 'git://github.com:gregbell/active_admin' in your Gemfile works for you?
You can also get faster deployments utilizing vendor/cache by following the instructions given here:
http://blogs.aws.amazon.com/application-management/post/Tx2XVRWSS4E971S/Locally-Packaging-Gem-Dependencies-for-Ruby-Applications-in-Elastic-Beanstalk
What solved my problem: I modified the bundle install script and added the --deployment flag

Resources