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

Viewed 2812

I have a simple pipeline config:

image: python:3.7.3

pipelines:

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

which yields the following error:

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

What should i do?

2 Answers

Here are examples to run python with bitbucket pipelines. You can change unit test according to yours.

  1. First make sure pipelines are enabled.
  2. Generate SSH.
  3. Add host key.
  4. Add variable to Deployment menu.

I'm also attach running pipelines with tags and branch.

Generate SSH from :

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

and put it to your server ~/.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

I just figured out, that i did not have "bitbucket-pipelines" enabled in the repository in the settings.

Related