Concourse Fly CLI Examples

Published
Updated

How to view the YAML of an installed Pipeline

If you need to view the YAML of a Concourse pipeline, run the following command and it will print your pipeline’s YAML code to your console. Change targetname and pipelinename to your respective values.

fly -t targetname get-pipeline -p pipelinename

How to list targets and their aliases

fly targets

How to delete a target

Run the following, replace TARGET_ALIAS with the fly CLI target name you wish to delete:

fly -t TARGET_ALIAS delete-target

Note, in Concourse versions prior to 2019 (versions 3.14.x and older) this command will not work. You will need to delete your ~/.flyrc file and it will remove all of your Concourse targets.

Inspecting the file system with the hijack command

When building a CI/CD pipeline with Concourse, you can sometimes run into pitfalls where one or more of the steps has failed. In a situation, it can be difficult to figure out why a step is failing. To solve this, use the hijack command.

fly hijack -t main --job=hello-world/deploy

Concourse will then prompt you for the container and the step you are trying to analyze. Take note of the different types available, task, get, put, etc. as each step may have multiple types. Enter the index (number) to the left of each of the listed steps and press enter:

1: build #42, step: scan, type: task
2: build #42, step: git-repo, type: get
choose a container: 

You now are logged into the virtual container which was running the build or step within Concourse which encountered the problem or failure.

root@734f0a93-78a8-4cwj-7a7ev-:/tmp/build/0ab9213#