gitlab ci mysql_php-Gitlab CI:在阶段之间保留MySQL数据
根據(jù)Gitlab問題頁面:Share service between build stages.Gitlab-CI的設(shè)置方式如下:
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
盡管已經(jīng)存在7個月了,但該問題目前仍未解決.從MysqL獲取數(shù)據(jù)的問題也是一個問題,因為服務(wù)無法裝載卷(我不相信有任何計劃可以添加此功能),因此數(shù)據(jù)被卡在MysqL容器內(nèi).
因此,您可以通過以下兩種方式處理此問題:
>在同一工作中進(jìn)行設(shè)置和測試
>創(chuàng)建一個已經(jīng)添加了所有數(shù)據(jù)的sql docker(不好的做法,但是如果需要的話)
>在設(shè)置中創(chuàng)建轉(zhuǎn)儲并共享為工件,然后通過測試重新加載該數(shù)據(jù)
編輯:添加一條注釋,將expire_in組件用于工件可能是有用的,因為您不想存儲一堆數(shù)據(jù),您可能永遠(yuǎn)不需要.
編輯2:
經(jīng)過研究后,我找到了gitlab的this.您可以執(zhí)行以下操作:
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/
總結(jié)
以上是生活随笔為你收集整理的gitlab ci mysql_php-Gitlab CI:在阶段之间保留MySQL数据的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: [转载] Java中变量与常量
- 下一篇: jmeter提取mysql返回值_jme