I have a PHP/Laravel project on a gitlab reo. Recently I’ve added CI/CD for it using the following .gitlab-ci.yml file
file:
stages:
- pull
- optimize
variables:
GIT_SSL_NO_VERIFY: "1"
before_script:
- git config --global http.sslVerify false
- git config --global credential.helper store
- echo "https://${CI_REPOSITORY_USER}:${CI_REPOSITORY_PASSWORD}@gitlab.com" > ~/.git-credentials
pull_job:
stage: pull
script:
- echo "Pulling the project on the server through git"
- git pull origin master
only:
- master
optimize_job:
stage: optimize
script:
- echo "Clearing the cache by optimize command.."
- php artisan optimize
As you can see, there are two stages, the first is pull
stage which passes as well, and optimize
stage which fails. The error is:
.gitlab-ci.yml returns /usr/bin/bash: line 156: php: command not found error
Base on some research, I’ve added php tag
for that stage like this:
optimize_job:
stage: optimize
script:
- echo "Clearing the cache by optimize command.."
- php artisan optimize
tags:
- php
Which cases the pipline to stuck and goes to pending
status by throwing this error:
This job is stuck because of one of the following problems. There are no active runners online, no runners for the protected branch, or no runners that match all of the job’s tags:
php
Go to project CI settings
Any idea what should I do?