CI/CD Gitlab deployment Failed - dbl command not found - heroku

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.

Related

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

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

Gitlab runner not picking jobs

I'm trying to set up a GitLab runner for a repository. I've installed and registered a runner on a remote machine. The runner in the Gitlab setting page is in the green light. Run untagged jobs has been set to true.
The pipeline is running, but all the jobs inside this pipeline are all pending.
The status of the GitLab runner on the remote machine:
And here is my simple script of .gitlab-ci.yml:
stages:
- build
- test
image: "ruby:2.6.5"
build-ruby-bundler:
stage: build
script:
- apt-get update -qq
- ruby -v
- which ruby
- gem install bundler --no-document
- bundle install --jobs $(nproc) "${FLAGS[#]}"
rubocop:
stage: test
script:
- bundle exec rubocop
I just realized, I registered the GitLab runner in user mode, which I need to register in system mode using sudo gitlab-runner register.

Travis CI Error: Chromium revision is not downloaded. Run "npm install" or "yarn install"

I have a test suite which works perfect on local setup, here is the library:
https://github.com/IbrahimTanyalcin/RafX
However I cannot get it to work on Travis CI, I keep getting:
"Chromium revision is not downloaded"
Here is my yml file:
https://github.com/IbrahimTanyalcin/RafX/blob/master/.travis.yml
language: node_js
dist: trusty
addons:
apt:
packages:
# This is required to run new chrome on old trusty
- libnss3
notifications:
email: false
cache:
directories:
- node_modules
sudo: required
node_js:
- "12.13.0"
env:
#global:
# - PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=0
# allow headful tests
before_install:
# Enable user namespace cloning
- "sysctl kernel.unprivileged_userns_clone=1"
# Launch XVFB
- "export DISPLAY=:99.0"
# - export CHROME_PATH="$(pwd)/chrome-linux/chrome"
- "sh -e /etc/init.d/xvfb start"
# wait for xvfb to boot
- sleep 3
# start your web application and listen on `localhost`
# - google-chrome-stable --headless --disable-gpu --remote-debugging-port=9222 http://localhost &
install:
- npm install
- npm install -g puppeteer --unsafe-perm=true --allow-root
# - yarn add --dev jest-puppeteer
# - yarn add puppeteer
script:
- npm run testCI
And here is the failing build
https://travis-ci.org/IbrahimTanyalcin/RafX
I commented out some of the options I tried, I pretty much checked everywhere including puppeteer and jest docs, and actually took their recommended yml file.
I also tried to apply suggestions in this thread, but of no avail: https://github.com/puppeteer/puppeteer/issues/2173
Any idea how I can solve this?
For anyone struggling with this, it seems I have found a work around, in your before install:
before_install:
- node node_modules/puppeteer/install.js
If you add these lines, you are manually invoking node to install puppeteer, I do not know why npm install fails, but this seems to solve the issue.

Share installed requirements between jobs

I have the following yml configuration file with 3 different jobs:
stages:
- build
- test
- analyze
build:
stage: build
script:
- apt-get update -qy
- apt-get install -y python3-dev python3-pip
- pip3 install -r requirements.txt
test:
stage: test
script:
- coverage run --source='.' manage.py test
cache:
paths:
- .coverage
analyze:
stage: analyze
script:
- flake8
- coverage report
In the first job I install the requirements, among which are coverage or flake8. But these tools are used in the following jobs. I have tried using 'dependencies' or 'cache', but it didn't work: only files/dirs under the project root directory can be shared, not the binaries under /user/local/bin.
I have tried to indicate another directory for pip install, but the binary is installed in /user/local/bin.
The workaround I have found is to install the dependencies in each job, but I think that this is the less optimal solution.
I think that there must be a better solution for that.
Thanks.
I just found a solution, at least for python3 (enough for me):
python3 has a built-in tool for managing virtual envs: venv
Using venv, we can create the virtual env in the project root dir, cache this dir, and enable our virtual env in each job.
variables:
VENV_NAME: "env"
cache:
paths:
- $VENV_NAME
first_job:
script:
- apt-get update -qy
- apt-get install -y python3-dev python3-pip python3-venv
- python3 -m venv $VENV_NAME
- source $VENV_NAME/bin/activate
- pip3 install -r requirements.txt
next_jobs:
script:
- source $VENV_NAME/bin/activate
- echo "hello world!"
PD: don't forget to exclude virtual env dir from coverage or other analysis tools

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

Resources