Hello. I have a working build process in TFS that creates a package for each of my projects, pushes them to Octopus, and creates a release using the steps included in the Octopus TFS extension. I would like to include a text file generated by the build server as an artifact in the release when/after it is created, so that it appears in any deployments of the release.
Is this possible? If so, how can I go about doing this? Thanks.
Further to your request for help. I’ve just realised that the step I’ve referred you to will only download the file, not turn it into an Octopus artifact.
If you want an Octopus artifact, then you’ll need another step after that which turns it into an artifact.
If you use the Run A Script step, then add this PowerShell code, it will grab the downloaded text file and add it to the deployment as an artifact:
The -Path is the folder path to the already downloaded file from the TeamCity - Download Artifact step, and the -Name is up to you i.e. the downloaded file can be given the same name as when it was downloaded or you can give it an entirely different name if you so wish.
Hi @Mark_Lamprecht, thanks for the reply. Just to be clear, I’m building with TFS (Team Foundation Server), not TeamCity. Are you saying the TeamCity Download Artifact step will also work with TFS?
So given you’re working with TFS, as long as you can put the text file generated by the release in a (shared?) folder that your Octopus server has access to, then you can still use the PowerShell…
…in a Run A Script step to grab a copy of the TFS file and save it as an Octopus artifact during deployment.
As before the -Path is the folder path to the file generated by TFS and the -Name is up to you i.e. the TFS file can be given the same name as when it was generated by TFS, or you can give it an entirely different name if you so wish.
If you’d like to know more about Octopus artifacts, then this doc should help you.
Once again, please accept my apologies for misreading your question.
I see, thanks. I can probably make that work, but it would be simpler for me to push the artifact from TFS (using the existing service connection and API key) than pull it from Octopus. I suppose there’s no way to do that?
Alright, never mind, I was able to have the build server store the file within an existing package. The PowerShell script in Octopus can now just simply extract the package and save the file as an artifact.
Hi @Mark_Lamprecht, I now have a separate issue with this process update that I’m trying to figure out. This is the script step I added to the deployment:
I have always specified the package version for all steps using the Octo.exe argument --packageVersion $(Build.BuildNumber), and also tried using --package FTDatabase:$(Build.BuildNumber) --package RTDatabase:$(Build.BuildNumber) to no avail.
Do you have any thoughts as to what the problem could be or how to fix it? Thank you.
Thanks @Mark_Lamprecht. That didn’t solve the issue, but while editing the Octopus release step I did notice that it hadn’t been changed in a long time and was a couple versions out of date. Updating it to the latest version fixed the problem. Seems like that old version didn’t actually support referenced packages. Sorry for the time-waster, but it’s all running smoothly now.
All good - that was going to be one of my next questions so I’m glad you spotted it ahead of me, and I’m also glad to hear things are working as expected!