我想在 Bitbucket 管道中运行 docker 容器。但我无法执行任何命令,因为它声称 docker 守护进程没有运行。但是,我没有找到任何方法来启动它。
INFO Running command 'which docker' in '/opt/atlassian/pipelines/agent/build'
INFO STDOUT b'/usr/bin/docker\n'
INFO STDERR b''
INFO Running command 'docker --version' in '/opt/atlassian/pipelines/agent/build'
INFO STDOUT b'Docker version 19.03.15, build 99e3ed8\n'
INFO STDERR b''
INFO Running command 'systemctl start docker' in '/opt/atlassian/pipelines/agent/build'
INFO STDOUT b''
INFO STDERR b'/bin/sh: 1: systemctl: not found\n'
INFO Running command 'sudo systemctl start docker' in '/opt/atlassian/pipelines/agent/build'
INFO STDOUT b''
INFO STDERR b'/bin/sh: 1: sudo: not found\n'
INFO Trying to remove old Docker …Run Code Online (Sandbox Code Playgroud) 我想通过匹配 Bitbucket 管道中的标签语义来触发不同的管道。通配符似乎仅适用于*匹配,但通配符模式的其他功能似乎不被采用:
+([0-9]).+([0-9]).+([0-9])
例如。这应该匹配每个标签,例如1.0.0,但不匹配其他任何标签。
关于如何实现这一目标有什么想法吗?
我不想触发任何管道,在管道脚本中进行检查并提前退出。
pipelines:
tags:
+([0-9]).+([0-9]).+([0-9]):
name: Pipeline for new semantic tag
script:
- ...
Run Code Online (Sandbox Code Playgroud)
注意:我也尝试将 glob 放在 之间",但这也不起作用。
我的管道中有一个步骤在 Bitbucket 上运行我们配置的预提交:
...
- step:
name: Passing linters
image: python:3.7-slim-stretch
script:
- pip3 install "pre-commit==2.17.0"
- apt-get update && apt-get --assume-yes install git
- pre-commit run --all-files
Run Code Online (Sandbox Code Playgroud)
没有进行任何更改,但它突然停止工作。
管道结果:
+ pre-commit run --all-files
[INFO] Initializing environment for https://github.com/psf/black.
[INFO] Initializing environment for https://github.com/psf/black:click==8.0.4.
[INFO] Initializing environment for https://github.com/pre-commit/pre-commit-hooks.
[INFO] Initializing environment for https://github.com/maximevast/pre-commit-tslint/.
[INFO] Initializing environment for https://github.com/maximevast/pre-commit-tslint/:tslint-react@4.1.0,tslint@5.20.1,typescript@4.0.2.
[INFO] Installing environment for https://github.com/psf/black.
[INFO] Once installed this environment will be reused.
[INFO] This may take a few minutes...
[INFO] …Run Code Online (Sandbox Code Playgroud) bitbucket pre-commit pre-commit-hook bitbucket-pipelines pre-commit.com
是否可以使用composer的存档功能在本地压缩项目(类似于使用zip)?例如,我尝试过composer archive my-repo/project --format=zip --file test-archive。它的工作原理是创建一个名为 的 zip 文件test-archive,但 Composer 是通过首先转到我的 satis 存储库并下载该项目的副本来实现的。
我也在我的composer.json 中定义了这个
"archive": {
"exclude": [
".*",
"!.gitignore",
"node_modules/",
"vendor/",
"www/",
"composer/",
"*.lst",
"*.yml"
]
}
Run Code Online (Sandbox Code Playgroud)
我想做的是将存档功能用作位桶管道构建过程的一部分。目标是压缩项目文件(不包括某些文件)并将它们传递到 bitbucket 存储库的下载页面。我有一个使用 zip 的工作步骤,但存档使用更好的语法来排除文件。
尝试在位桶管道中安装sass docker实例并获取错误 Failed to build gem native extension
日志显示以下内容:
gem install sass --no-user-install
Successfully installed rb-fsevent-0.10.2
Building native extensions. This could take a while...
ERROR: Error installing sass:
ERROR: Failed to build gem native extension.
Run Code Online (Sandbox Code Playgroud)
我正在使用图像 php:7.1.1
应该像我运行的脚本一样安装Ruby和Gem:
apt-get update && apt-get install -y unzip nodejs ruby-full
gem install sass --no-user-install
Run Code Online (Sandbox Code Playgroud)
提前致谢
有什么办法可以阻止 Bitbucket 管道的构建?
该过程需要超过 25 分钟吗?
.yml 文件内容是:-
image: node:8.9.4
pipelines:
default:
- step:
caches:
- node
script: # Modify the commands below to build your repository.
- if [ $BITBUCKET_BRANCH == 'master' ]; then
- npm install -g @angular/cli
- npm install -g firebase-tools
- npm install
- ng build
- firebase deploy --only hosting --token "$FIREBASE_TOKEN" --public dist
- fi
Run Code Online (Sandbox Code Playgroud) 从bitbucket管道部署我的弹性beanstalk应用程序时遇到一些麻烦.同样的代码一直没有问题,所以我最好的猜测是某种依赖问题.
(awsebcli版本3.14.1)
管道的图像是python:3.5.2
,这是失败的步骤:
- step:
name: Test Deploy
deployment: test
caches:
- pip
script:
- pip install awsebcli --upgrade
- eb init myAppName -r us-east-1 -p Python # This line started failing :'(
- eb deploy myAppName-dev-1
Run Code Online (Sandbox Code Playgroud)
和错误输出:
eb init myAppName -r us-east-1 -p Python
Traceback (most recent call last):
File "/usr/local/lib/python3.5/site-packages/pkg_resources/__init__.py", line 570, in _build_master
ws.require(__requires__)
File "/usr/local/lib/python3.5/site-packages/pkg_resources/__init__.py", line 888, in require
needed = self.resolve(parse_requirements(requirements))
File "/usr/local/lib/python3.5/site-packages/pkg_resources/__init__.py", line 779, in resolve
raise VersionConflict(dist, req).with_context(dependent_req)
pkg_resources.ContextualVersionConflict: (PyYAML 4.1 …
从这里我了解到Bitbucket Pipeline支持ifs语句。
我该如何在if语句中使用多行块?
这不计算:
script:
- if [ $BITBUCKET_BRANCH == "master" ];
then;
echo Line1
echo line2
fi;
Run Code Online (Sandbox Code Playgroud) 如何在Bitbucket管道中使用git子模块?
我正在使用Bitbucket管道来构建我的项目,并且在子模块中遇到问题,我可能没有正确配置SSH密钥。
我所做的:
生成错误:
Submodule 'dependencies/my-dependency' (git@bitbucket.org:mycompany/my-dependency.git) registered for path 'dependencies/my-dependency'
Cloning into 'dependencies/my-dependency'...
Warning: Permanently added the RSA host key for IP address '18.205.93.2' to the list of known hosts.
Permission denied (publickey).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
Clone of 'git@bitbucket.org:mycompany/my-dependency.git' into submodule path 'dependencies/my-dependency' failed
Run Code Online (Sandbox Code Playgroud)
我的yml文件
image:
name: myuser/my-image-name
username: $DOCKER_HUB_USERNAME
password: $DOCKER_HUB_PASSWORD
email: $DOCKER_HUB_EMAIL
pipelines:
branches:
pipelines-setup:
- step: …Run Code Online (Sandbox Code Playgroud) github.com 有没有像 Bitbucket Pipeline 一样的服务/功能?我实际上想将我的主分支推送到 FTP 服务器 (cpanel, apache) 。使用 Bitbucket Pipeline 真的很容易,但是在 Github 中有什么方法可以做到吗?