Using the Stage Results API in custom scripts
You can use the Stage Results API to access the results of specific stages and custom stages. This API can only be used in your custom scripts.
Customize your output to view the desired output in your Stage results. Use the following code snippets to generate various kinds of output:
-
Type
get_data result
to print which stages have saved results.$ get_data result test detect-secrets branch-protection
-
Type
get_data result <stage-name>
to print the result for a specific stage.$ get_data result detect-secrets success $ get_data result test failure
-
Iterate through the saved results:
#!/usr/bin/env bash while read -r stage; do result=$(get_data result $stage) echo "The result of '$stage' stage is: '$result'" done < <(get_data result)
On running the snippet in you console , the following output is generated:
```text {: screen}
The result of 'detect-secrets' stage is: 'success'
The result of 'branch-protection' stage is: 'success'
```