This script fetches deployment details for a specific release version of a project in Octopus Deploy.
./octopus_deploy_details.sh \
--octopus-url <octopus_url> \
--api-key <api_key> \
--project-name <project_name> \
--release-version <release_version> \
[--no-headers] /
- --octopus-url/-u <octopus_url>: The Octopus Deploy instance URL.
- --api-key/-k <api_key>: The API key.
- --project-name/-p <project_name>: The project name.
- --release-version/-r <release_version>: The release version.
- --no-headers: Exclude the deployment header and project/release details from the output.
Using the git tag --contains <commit-hash>
command we're able to find all the tags in your Git repository that include a specific commit. This is useful when you need to determine which versions or releases of a project contain a particular change or bug fix.
For example, if a CI/CD setup creates a git tag with the template <environment>-<version>
, and names the Octopus release with the same (or similar) naming convention we can do the following steps to get the information of all deployments that contain a given commit hash.
- Get all tags containing a commit
git tag --contains <commit-hash>
- Filter git tags to only include build tags using
grep -P '^(prod-|stage-|dev-)'
- Remove environment prefix (if needed) using
sed 's/^\(prod\|stage\|dev\)-//'
- Loop the output and pass value as release version to octopus_deploy_details.sh
git tag --contains <commit-hash> \
| grep -P '^(prod-|stage-|dev-)' \
| sed 's/^\(prod\|stage\|dev\)-//' \
| while read -r release; do ./octopus_deploy_details.sh \
-u <octopus_url> \
-k <api_key> \
-p <project_name> \
-r "$release"; \
done /