这是我第一次尝试建立管道,甚至使用任何CI / CD工具。因此,阅读Bitbucket上的文档后,我在Laravel应用程序的根目录中添加了bitbucket-pipelines.yml文件进行构建。这是文件。
image: php:7.4-fpm
pipelines:
default:
- step:
name: Build and test
caches:
- composer
script:
- apt-get update && apt-get install -qy git curl libmcrypt-dev mariadb-client ghostscript
- yes | pecl install mcrypt-1.0.3
- docker-php-ext-install pdo_mysql bcmath exif
- curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --file name=composer
- composer install
- ln -f -s .env.pipelines .env
- php artisan migrate
- ./vendor/bin/phpunit
services:
- mysql
- redis
definitions:
services:
mysql:
image: mysql:5.7
environment:
MYSQL_DATABASE: "laravel-pipeline"
MYSQL_RANDOM_ROOT_PASSWORD: "yes"
MYSQL_USER: "homestead"
MYSQL_PASSWORD: "secret"
redis:
image: redis
上面的代码在构建应用程序,运行测试等方面效果很好。但是,当我使用scp管道添加以下内容以进行部署时,我会收到一条通知,说我需要包括一个映像,或者有时通知说映射条目缩进不好。
- step:
name: Deploy to test
deployment: test
# trigger: manual # Uncomment to make this a manual deployment.
script:
- pipe: atlassian/scp-deploy:0.3.13
variables:
USER: '${remoteUser}'
SERVER: '${server}'
REMOTE_PATH: '${remote}'
LOCAL_PATH: '${BITBUCKET_CLONE_DIR}/*'
我不太了解yaml,这是我第一次使用CI / CD工具,所以我很迷路。有人可以指导我做错什么吗?
您的名称和部署缩进与脚本不同。尝试像这样将它们全部放在相同的缩进上。
- step:
name: Deploy to test
deployment: test
script:
- pipe: atlassian/scp-deploy:0.3.13
variables:
USER: '${remoteUser}'
SERVER: '${server}'
REMOTE_PATH: '${remote}'
LOCAL_PATH: '${BITBUCKET_CLONE_DIR}/*'
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句