Faraday::Connection without adapter has been made. CICD on Gitlab - heroku

everything was going well, before this morning, I'm totally new to cicd and things like that so I write this to deploy my app to heroku
`'API deploy':
stage: deploy back
image: ruby:latest
script:
- apt-get update -qy
- apt-get install -y ruby-dev
- gem install dpl
- cd back
- dpl --provider=heroku --app=$HEROKU_BACK --api-key=$HEROKU_API_KEY --skip_cleanup
only:
refs:
- main
changes:
- back/**/*
- .gitlab-ci.yml`
And I receive this:
An attempt to run a request with a Faraday::Connection without adapter has been made. (RuntimeError)
Please set Faraday.default_adapter or provide one when initializing the connection.
I really don't know how to do it and whats going on as I say yesterday all was good.
Update: It's seems due to the current update Faraday-2.0.0

I faced the same problem today. Apparently there is some problem in the latest version of FARADAY, at the moment. I solved it this way: add manual installation of the previous version of the dependency to your .gitlab.yml, and everything will work. Have a nice day.
before_script:
- apt-get update -qy
- apt-get install -y ruby-dev
- gem install dpl
- gem install faraday -v 1.8.0

I add the step below and it works fine
- gem install faraday -v 1.8.0

Related

How to install latest Ruby on Gitlab config for Docker

Here's how my config looks like:
deploy_hybrid:
stage: deploy
before_script:
- apt update -qq
- apt install ruby-full -qq
- gem install cocoapods
- pod repo update
However, it's always installing Ruby 2.1
WARNING: apt does not have a stable CLI interface yet. Use with
caution in scripts. The following extra packages will be installed:
libruby2.1 libtcl8.5 libtcltk-ruby libtk8.5 libxft2 libxss1 ri ruby
ruby-dev ruby2.1 ruby2.1-dev ruby2.1-doc ruby2.1-tcltk
rubygems-integration

CI/CD Gitlab deployment Failed - dbl command not found

The pipeline .gitlab-ci.yml code successfully works till yesterday, but today i got the error which says “dpl command not found”
the below is my .gitlab-ci.yml file
image: node:8.9.3
stages:
- job1
- test
- production
job1:
stage: job1
script: "ls -l"
test:
stage: test
script:
- npm install
production:
type: deploy
stage: production
image: ruby:latest
script:
- apt-get update -qy
- apt-get install -y ruby-dev
- gem install dpl
- dpl --provider=heroku --app=quailapp --api-key=$HEROKU_PRODUCTION_API_KEY
only:
- master
This is the log Generated,
Setting up rake (10.5.0-2) ...
Setting up libruby2.3:amd64 (2.3.3-1+deb9u2) ...
Setting up ruby2.3 (2.3.3-1+deb9u2) ...
Setting up ruby2.3-dev:amd64 (2.3.3-1+deb9u2) ...
Setting up ruby-dev:amd64 (1:2.3.3) ...
Setting up ruby (1:2.3.3) ...
Processing triggers for libc-bin (2.24-11+deb9u3) ...
$ gem install dpl
Successfully installed dpl-1.9.6
1 gem installed
$ dpl --provider=heroku --app=quailapp --api-key=$HEROKU_PRODUCTION_API_KEY
/bin/bash: line 68: dpl: command not found
ERROR: Job failed: exit code 1
please help me for finding the solution.
Same here, Issuing the command to install dpl with verbosity: gem install dpl --verbose I've been able to see something weird:
/usr/local/bundle/bin/dpl
Successfully installed dpl-1.9.6
1 gem installed
I don't know why but it is installed in a non-default path. As a workaround I've added the /usr/local/bundle/bin in $PATH environment variable issuing the following command:
export PATH=$PATH:/usr/local/bundle/bin
It works for me and my gitlab ci pipelines are now working again.
BTW, It would be great to know why it has changed suddenly...
Same problem here. I think, it's a problem in docker image. See https://github.com/docker-library/ruby/pull/209
They made some changes and broke path for gems binaries. We have to wait until they merge fix.
UPDATE:
It's already merged and their fix works for me.

Ruby gems with C extensions not building in Ubuntu

I'm trying to base a Dockerfile off of Heroku's new heroku/heroku:18 image (which uses Ubuntu 18.04) and running into some issues that I didn't have in their very old heroku/cedar:14 base image, I believe due to them having different preinstalled packages. (I updated the base image to heroku/heroku:18 because I want to use the webpacker gem and in Cedar-14 I was getting: Webpacker requires Node.js >= 6.0.0 and you are using 0.10.25. If there's an easy way to install a newer Node in the older base image I'd love to hear it!)
My problem is that no gems with C extensions (like puma, pg, msgpack, etc. etc.) install successfully with this new base Docker image. The error messages vary slightly from gem to gem but all generally say:
The compiler failed to generate an executable file. (RuntimeError)
You have to install development tools first.
Various GitHub issues with similar problems have had me try:
apt-get installing:
build-essential
libpq-dev
libssl-dev
openssl
libssl1.0-dev
gcc
gcc-5
automake
make
Using heroku/heroku:18-build instead of heroku/heroku:18
None of these solutions solves the issue.
For reference, here are the relevant parts of my Dockerfile:
FROM heroku/heroku:18
RUN apt-get update && apt-get install -y nodejs --no-recommends
RUN (mkdir -p /ruby && cd /ruby && curl https://s3-external-1.amazonaws.com/heroku-buildpack-ruby/heroku-18/ruby-2.5.0.tgz -s -o - | tar xzf - --no-same-owner)
ENV GEM_HOME=/ruby/gems GEM_PATH=/ruby/gems
RUN gem install bundler
RUN bundle install

Gitlab: gem not found

I am trying to deploy our app to Heroku and our settings in .gitlab-ci.yml looks like
staging_heroku:
stage: deploy
script:
- git remote add heroku https://heroku:$STAGING_HEROKU_KEY#git.heroku.com/staging-myapp.git
- git push -f heroku master
This is what we see in logs
Cloning repository...
Cloning into '/builds/org/project'...
Checking out 340111af as dev/feature1...
Skipping Git submodules setup
Downloading artifacts for maven-build (17234382)...
Downloading artifacts from coordinator... ok id=17234382 responseStatus=200 OK token=2YSHdANA
/bin/sh: eval: line 46: apt-get: not found
$ apt-get update -yqqq
ERROR: Job failed: exit code 127
These runners do not even have apt-get and so I can not install gem.
I even tried git command, but even that is not found. Can someone help?
You need to install ruby and ruby-dev first! (and rubygems-integration for Debian 8)
staging:
type: deploy
script:
- apt-get update -yq
- apt-get install -y ruby ruby-dev rubygems-integration
- gem install dpl
- dpl --provider=heroku --app=teeth-taroko --api-key=$HEROKU_STAGING_API_KEY
only:
- develop

Any other ways to install Heroku except gem install

gem install heroku failed with following message and I have tried the solution here, but it failed also. Is there any other way I can install Heroku?
WARNING: RubyGems 1.2+ index not found for: http://gems.rubyforge.org/
RubyGems will revert to legacy indexes degrading performance.
ERROR: could not find gem heroku locally or in a repository.
Heroku now offers a standalone client, called the Heroku Toolbelt. Check out https://toolbelt.heroku.com/ for current installation instructions.
you should be able to bypass the problem by downloading the heroku gem from rubygems.org and install from the local copy.
go to http://rubygems.org/gems/heroku and click the download link to download version 1.8.5
then move into the download folder and do a gem install --local heroku-1.8.5.gem ,but follow the instruction to install the dependency first
Updating the gem to version 1.3.6 seem solve the problem.
However, gem update --system does not work on Ubuntu platforms, and apt-get install rubygems1.8 always bring you to version 1.2.0.
Here is the trick to update your gems to latest one,1.3.6, by the time of writing:
sudo gem install rubygems-update
sudo update_rubygems
And the credit goes here.
Finally, by all means avoid installing the gems manually, my experience taught me.
Seems like your Rubygems version is not up to date.
Try sudo gem update --system and/or sudo gem install rubygems-update; sudo update_rubygems before trying to install the heroku gem.
Alternately, if you're running Debian and cannot use gem update --system, try installing a version of rubygems that is >1.2 from backports. I used aptitude -t lenny-backports install rubygems and then rubygems could actually access the online repository.
To install Heroku in all currently supported versions of Ubuntu open the terminal and type:
sudo snap install --classic heroku
This installs the heroku snap package successfully, and it is the recommended way of installing Heroku CLI in Ubuntu at the Heroku Dev Center website. When this was posted sudo snap install --classic heroku installs the latest version of Heroku.

Resources