根据文献资料的说法,我试图在gitlab-ci.yml中添加drush。
这是我的gitlab-ci.yml的顶部
image: tetraweb/php:7.1
services:
- drush/drush:8
但很明显,这项服务并没有正常启动:
Running with gitlab-runner 10.8.0 (079aad9e)
on docker-runner 8a1645e0
Using Docker executor with image teamdesk/toolbox:7.2 ...
Starting service drush/drush:8 ...
Pulling docker image drush/drush:8 ...
Using docker image sha256:646ef48a637011d5bf97ed3021e280d583aa966e63fceea478d9be8dc5ea2902 for drush/drush:8 ...
Waiting for services to be up and running...
*** WARNING: Service runner-8a1645e0-project-35-concurrent-0-drush__drush-0 probably didn't start properly.
Health check error:
exit code 1
Health check container logs:
2019-03-07T16:51:12.703254779Z No HOST or PORT
如果我尝试以下几点:
services:
- name: drush/drush:8
command: ["drush", "config-import -y"]
我得到:
Running with gitlab-runner 10.8.0 (079aad9e)
on docker-runner e0df35ff
Using Docker executor with image teamdesk/toolbox:7.2 ...
Starting service drush/drush:8 ...
Pulling docker image drush/drush:8 ...
Using docker image sha256:646ef48a637011d5bf97ed3021e280d583aa966e63fceea478d9be8dc5ea2902 for drush/drush:8 ...
Waiting for services to be up and running...
*** WARNING: Service runner-e0df35ff-project-35-concurrent-0-drush__drush-0 probably didn't start properly.
Health check error:
exit code 1
Health check container logs:
2019-03-08T08:37:07.739033180Z No HOST or PORT
Service container logs:
2019-03-08T08:37:07.398595623Z The drush command 'drush config-import -y' could not be found. Run [error]
2019-03-08T08:37:07.398686996Z `drush cache-clear drush` to clear the commandfile cache if you have
2019-03-08T08:37:07.398695300Z installed new extensions.
由于我需要在生产服务器上部署之前运行drush updatedb
和drush config-import
,所以我想在gitlab-ci.yml中使用drush作为服务。
发布于 2019-03-07 09:44:59
drush config-import -y
是一个一次性命令;一旦它的工作完成,它运行的进程就会停止。因此,它不是一个服务,您不能将它放在.gitlab-ci.yml
的.gitlab-ci.yml
部分。Gitlab CI Runner希望这些服务永远不会停止,如果其中一个服务死了,就会抱怨。
你能做什么?
在drush
部分运行script:
。为此,您必须确保停靠者映像tetraweb/php:7.1
有可用的drush
命令。
image: tetraweb/php:7.1 ## this image must have drush available
script:
- drush config-import -y
- drush updatedb
...
https://stackoverflow.com/questions/55049091
复制相似问题