Using "try" to run a task which might fail without stopping pipeline

Hi,
I have a task which does linting on the source code and I want it to be able to flag up warnings without breaking the entire pipeline.
So I thought I would use the “try” step to run this task, but I can’t work out how to write that yaml. Is this actually possible?
I’d be very grateful if someone can explain how to use “try” in this scenario.

thanks
Paul

Hello,
what did you try (pun unintended)? Looking at https://concourse-ci.org/try-step.html#try there is an example that seems what you are looking for.

hi, thanks.

I tried various things like:

  task:
    try:
  .....
         run:
             path: scripts/lint_all.sh
  .....

also swapping the try to other places like this:

  try:
    task:

I also tried putting the “try” at the top, under “plan:”.

It’s the task which I want concourse to try and run, and allow to fail, without the rest of the pipeline failing.

Try wrapping the try step in a do

jobs:
- name: foo
  plan:
  - do:
    try:
      task:
1 Like

sorry for delay in replying, I had to get started on something else, so I will come back and confirm this works. cheers.

thanks, using the do-try-task construct worked!!!