Getting an artifact from Octopus to TeamCity

We want to get some results from a powershell script back to TeamCity. I know I can use New-OctopusArtifact to make a file and have it available to Octopus.

Is there an easy way to get that file read by TeamCity?

We could probably make do with the full build log from Octopus. Is it possible to return that to TeamCity? It appears that the octo.exe output is a fairly truncated version of the full log.

Hi Trevor,

The Octopus REST API is probably the only option for this currently. You can list artifacts for a deployment, given its ID, using:

/api/artifacts?regarding=deployments-1234

and in each result you’ll see a Content link.

The full log’s not available from Octo.exe currently either - using the API to retrieve the full task log would be the only current option too.

Adding a --download-artifacts-to= option to Octo.exe would be awesome, but not something currently on the plan :slight_smile:

Regards,
Nick

Is there any way to get that deployment ID back through TeamCity or am I going to have to do some lookup and hunting based on environment / project name / version?

Getting artifacts back would be nice but I consider the deployment log to be fairly fundamental stuff. Any chance that could get added to the roadmap?

In order to find the log based on what’s in TeamCity I think I need to do this:

I need to embed the Octopus ProjectID in TeamCity or lookup based on slug. I can’t just use the name I had in the TeamCity build action.

GET /api/projects/[ProjectID]/releases/[build.number] to get the deployments link

GET /api/releases/releases-xxx/deployments to get the list of deployments

Then I filter that result set on environment (where I either embed the environment ID in TeamCity or look it up based on the name I provided earlier). This will get me a link to the server task.

GET /api/tasks/ServerTasks-XXX/raw Will finally get me the raw task log.

Is there a more direct route to the logs through the API based on what octo.exe can return?

Hi Trevor,

No, it sounds like the route you’re taking is the right one.

RE getting more detail from Octo.exe, it’s definitely something we’ll consider - thanks for the suggestion.

Regards,
Nick