Drone

For loop/recursively run a command

say I have a repository with the following structure:

.
├── book
│  ├── adder
│  ├── branches
...

how would I write a pipeline that cds into each directory and runs cargo check? I have the following so far:

kind: pipeline
type: kubernetes

steps:
  - image: rust:1.45.0-alpine3.12
    commands:
      - cd book/<each folder here>
      - cargo check

thanks!

You would need to write a bash command that executes the cargo command in every subdirectory. Here is a Stackoverflow thread that proposes a few solutions:

1 Like

that worked great, I didn’t know you could write whatever shell commands in the .drone.yml including for loops etc! thank you.