gitlab ci mysql_php-Gitlab CI:在阶段之间保留MySQL数据

根据Gitlab问题页面:Share service between build stages.Gitlab-CI的设置方式如下:

each job is run in each job is run independently of the others,

including potentially running on different machines. And the services

are run locally on each runner. There’s no way for one job to access a

service on a different runner. On GitLab.com,we even recycle the

machine after each job runs so the services would all be destroyed.

@markpundsack

尽管已经存在7个月了,但该问题目前仍未解决.从MysqL获取数据的问题也是一个问题,因为服务无法装载卷(我不相信有任何计划可以添加此功能),因此数据被卡在MysqL容器内.

因此,您可以通过以下两种方式处理此问题:

>在同一工作中进行设置和测试

>创建一个已经添加了所有数据的sql docker(不好的做法,但是如果需要的话)

>在设置中创建转储并共享为工件,然后通过测试重新加载该数据

编辑:添加一条注释,将expire_in组件用于工件可能是有用的,因为您不想存储一堆数据,您可能永远不需要.

编辑2:

经过研究后,我找到了gitlab的this.您可以执行以下操作:

services:

- MysqL

variables:

# Configure MysqL service (https://hub.docker.com/_/MysqL/)

MysqL_DATABASE: hello_world_test

MysqL_ROOT_PASSWORD: MysqL

connect:

image: MysqL

script:

- echo "SELECT 'OK';" | MysqL --user=root --password="$MysqL_ROOT_PASSWORD" --host=MysqL "$MysqL_DATABASE"

- SOME DATABASE DUMPING

artifacts:

when: on_success

paths:

- /var/lib/MysqL/

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值