gpt4 book ai didi

docker - 如何在 gitlab-ci.yml 中使用 drush 作为服务?

转载 作者:行者123 更新时间:2023-12-02 19:27:19 25 4
gpt4 key购买 nike

根据the documentation我正在尝试在 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 updatedbdrush config-import在生产服务器上部署之前,我想在 gitlab-ci.yml 中使用 drush 作为服务。

最佳答案

drush config-import -y是一次性命令;它运行的进程将在其工作完成后停止。所以它不是一项服务,你不能把它放在 service: 中。 .gitlab-ci.yml的部分. Gitlab CI Runner 期望这些服务永远不会停止,并且如果其中一个服务死了会提示。

你能做什么?

运行 drushscript:部分。为此,您必须确保 docker 镜像 tetraweb/php:7.1drush命令可用。

image: tetraweb/php:7.1  ## this image must have drush available

script:
- drush config-import -y
- drush updatedb
...

关于docker - 如何在 gitlab-ci.yml 中使用 drush 作为服务?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55049091/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com