2

I use Drone CI for handling CI/CD process. I am working on a use case where I take input variables and run different pipelines according to the key value pair. Inputs to the deploy pipeline.

Currently in my pipeline I use Ansible Plugin to push the changes to the destination. Something like this

- name: pipeline1
  image: plugins/ansible:3
  environment:
    <<: *creds
  settings:
    playbook: .ci/.ansible/playbook.yml
    inventory: .ci/.ansible/inventory
    user: admin_user
    private_key:
      from_secret: admin_key
    become: true
    verbosity: 3
  when:
    KEY1 = True
    
- name: pipeline2
  image: plugins/ansible:3
  environment:
    <<: *creds
  settings:
    playbook: .ci/.ansible/playbook.yml
    inventory: .ci/.ansible/inventory
    user: admin_user
    private_key:
      from_secret: admin_key
    become: true
    verbosity: 3
  when:
    KEY2 = True
.
.
.

How can I deploy such a pipeline? when keyword does not have any example in this regard

Pratiksha
  • 23
  • 6

1 Answers1

0

As per drone conditions documentation (https://docs.drone.io/pipeline/conditions/) you can't use environments in when block. Only repos/promotions could be used there.

In your case you can try to use dependencies for steps, via depends_on parameter in parallelism (https://discourse.drone.io/t/how-to-setup-parallel-pipeline-steps-1-0/3251)