I am trying to setup a drone config to only run tasks when files within that path have changed for that pull request have changed.
Is this possible?
I have tried this method, but it still runs the pipeline anyway
---
kind: pipeline
name: pr-terraform-plan-digital-dev
type: kubernetes
trigger:
event:
- pull_request
branch:
- master
when:
event:
- pull_request
path:
include:
- terraform/infrastructure/digital_dev/**
concurrency:
limit: 1
steps:
- name: Fetch and Merge
image: plugins/git
commands:
- "#!/bin/bash"
- "git fetch origin"
- "git checkout ${DRONE_SOURCE_BRANCH}"
- "git merge origin/${DRONE_TARGET_BRANCH}"
- name: Terraform Plan
image: terraform pull: always
commands:
- "echo $${CLOUD_CREDS} > /keyfile.json"
- export GOOGLE_APPLICATION_CREDENTIALS="/keyfile.json"
- cd terraform/infrastructure/digital_dev/
- sops --decrypt terraform.tfvars.enc.env > terraform.tfvars
- terraform init
- terraform plan
environment:
CLOUD_CREDS:
from_secret: dev_ci_creds
---
kind: pipeline
name: pr-terraform-plan-devtools
type: kubernetes
trigger:
event:
- pull_request
branch:
- master
when:
event:
- pull_request
path:
include:
- terraform/infrastructure/devtools/**
concurrency:
limit: 1
steps:
- name: Fetch and Merge
image: plugins/git
commands:
- "#!/bin/bash"
- "git fetch origin"
- "git checkout ${DRONE_SOURCE_BRANCH}"
- "git merge origin/${DRONE_TARGET_BRANCH}"
- name: Terraform Plan
image: terraform
pull: always
commands:
- "echo $${CLOUD_CREDS} > /keyfile.json"
- cd terraform/infrastructure/devtools/
- sops --decrypt terraform.tfvars.enc.env > terraform.tfvars
- terraform init
- terraform plan
environment:
CLOUD_CREDS:
from_secret: dev_ci_creds
---
kind: secret
name: dev_ci_creds
get:
path: dev-terraform-service-account
name: ci_creds
Thanks for any help in advance