我们没有在您的 bitbucket-pipelines.yml 文件中找到部署关键字



>我有一个简单的管道配置:

图片:蟒蛇:3.7.3

pipelines:
branches:
Server:
- step:
name: Test
script:
- pytest --ignore .

这将产生以下错误:

We didn't find the deployment keyword in your bitbucket-pipelines.yml file

我该怎么办?

我刚刚发现,我没有在设置的存储库中启用"位桶管道"。

以下是使用 bitbucket 管道运行 python 的示例。 您可以根据自己的情况更改单元测试。

  1. 首先确保已启用管道。
  2. 生成 SSH。
  3. 添加主机密钥。
  4. 将变量添加到"部署"菜单。

我还使用标签和分支附加正在运行的管道。

从以下位置生成 SSH:

https://bitbucket.org/<WORKSPACE>/<REPOSITORY_NAME>/admin/addon/admin/pipelines/ssh-keys

并将其放入您的服务器~/.ssh/authorized_keys

definitions: 

steps:

# Build
- step: &build
name: Install and Test
image: python:3.7.2
trigger: automatic
script:
- pip install -r requirements.txt
- python3 test.py test
# Deployment
- step: &deploy
name: Deploy Artifacts
trigger: automatic
deployment: test
script:
# Deploy New Artifact
- pipe: atlassian/scp-deploy:0.3.11
variables:
USER: <REMOTE_USER>
SERVER: <REMOTE_HOST>
REMOTE_PATH: <REMOTE_PATH>
LOCAL_PATH: $BITBUCKET_CLONE_DIR/**

# Runner
pipelines:
# Running by tags
tags:
v*:
- step: *build
- step: 
<<: *deploy
deployment: test
trigger: manual
# Running by branch
branches:
master:
- step: *build
- step:
<<: *deploy
deployment: test
trigger: automatic

最新更新