Jenkins to Octopus

Without OctoPack or Octo.exe, Can I deploy and publish the packages from Jenkins to Octopus using only Nuget.exe?

Hi,

Thanks for reaching out. Nuget.exe will only allow you to push package to the Package Repository, but not trigger deployments.

Is there a specific reason why you don’t wanna use Octo.exe? This one allows you to pack your app, push the package, create and deploy a release.

Thanks,
Dalmiro

HI Dalmiro,
Thank you for the reply, I don’t want to use Octopack as I have to install it to my Visual Studio Project. So, I am left with two options one is Nuget.exe and other one is Octo.exe. Base on your response, it seems like I have to choose Octo.exe
This is completely new to me. Can you please help how to proceed on how to create pacakges, deploy and publish it in octopus from Jenkins?
Can you provide any reference doc or link to use? as most of the references, I found are on OctoPack.
Thanks,
Sameera

Few more details to add, Jenkins is on a different server that triggers the builds when there is a code change from kiln. If this note is not important, Please ignore

Hi Sameera,

We do have great documentation about Octo.exe!

The commands you wanna pay attention to are:

Disclaimer: There is a Jenkins plugin around, but since we don’t maintain it is now quite outdated and at this point I can’t recommend you to fully use it. That said, If you decide to get your hands on it to update it, we’d be more than welcome to accept your PRs and even mention it in our documentation. You can find more about it here: http://docs.octopusdeploy.com/display/OD/Jenkins

Best regards,
Dalmiro

Hi Dalmiro,
Thank you for the information. This helps me a lot.
-Sam

Hi Dalmiro,
I have set up my website to do the following:
compile the code in Jenkins
pack and push the packages to octopus and
deploy the release of the project in different environments in Octopus
Inshort,I have done the following:
Whenever a new code is pushed --> Jenkins compile the code --> create and deploy a release in Octopus

But instead of doing this, is there any way that I could trigger a release from octopus and tell jenkins to complile the code(like below)
I just want octopus to create a release in my chosen environment at any point of time
Octopus-> select environment -> click on octopus-> tell jenkins to compile the code --> create and deploy a release in different web servers

Can you please give me a few details or some doc on how to do work on the above scenario?

Thanks,
Sam

Hi Sam,

Thanks for reaching out. This isn’t really a common practice, as usually Octopus comes after the build server, and not before in the whole Lifecycle. But there’s really nothing stopping you from having an Octopus Project with a Powershell Script step that calls a command line app/API to trigger your Jenkin builds.

Dalmiro

Hi Dalmiro,
I am able to trigger everything from octopus. Thank you so much for your help. It always helped me complete my task. But, we have some changes that we would like to make wen packing the packages. The document page below is no longer opening. Have I missed something?


Can you please provide me the updated link. I have tried searching but couldn’t find out. I am attaching the page

Capture.zip (6 KB)

Hi Sam,

Our doc site is currently down unfortunately because of some datacenter issues of our hosting company. Deep apologies for this.

If you want to check all the available options when using Octo.exe to pack an application, simply run Octo.exe help pack, which will show you the exact same info that we show in our docs.

Let me know if that works for you.

Dalmiro

Hi Dalmiro.
Thank you. For now, it works but may I know when will be the site up and running?
Thanks,
Sam

I recommend you to follow this thread to get notified when the doc site is back up: http://help.octopusdeploy.com/discussions/problems/50669-documentation-site-is-down

Thank you Dalmiro:)

Hi Dalmiro,
Can you please help me find the answers for the following questions:

  1. I would like to change the version value in the web config. Instead of using the varaible that would set a value from the octopus, Is there any way I could increment the version number automatically, every time I create and deploy the release?
  2. When I deploy the package, Octopus pushes the package to the tentacle/applicaitons/development/PackageId folder with a release number, Will i be able to leave the last 5 releases from the latest and remove the rest of the releases from octopus. It saves the space.
    3.Right now, when i Deploy, I am using the “update IIS path” option to update the physical path of the site to the latest binaries. Is there any way that I could deploy the binaries to the root folder instead of the tentacle folder.(I dont want to copy from the tentacle folder to the root folder. It uses all the disk space)
  3. Octo.exe packs the entire solution. So, I need to use ms build to create binaries separately and make sure octo.exe to pack only binaries instead of the whole solution. Is there any way that I could pack binaries using octo.exe without creating binaries separately?

Hi,

I would like to change the version value in the web config. Instead of using the varaible that would set a value from the octopus, Is there any way I could increment the version number automatically, every time I create and deploy the release?

I’m not sure I understand what you are trying to do here. Which value do you want to put on the web.config? The Octopus Release version? Another value you are grabbing from someplace else?

When I deploy the package, Octopus pushes the package to the tentacle/applicaitons/development/PackageId folder with a release number, Will i be able to leave the last 5 releases from the latest and remove the rest of the releases from octopus. It saves the space.

We have an entire feature called “Retention Policies” dedicated to this. You can check it out here: https://octopus.com/docs/administration/retention-policies

Octo.exe packs the entire solution. So, I need to use ms build to create binaries separately and make sure octo.exe to pack only binaries instead of the whole solution. Is there any way that I could pack binaries using octo.exe without creating binaries separately?

I’m not sure what you mean by “Pack binaries without creating them separately”. If you stick with Octo.exe then there no way around having to create the binaries (compile) with MSBuild first. I might have gotten that sentence completely wrong, so feel free to explain this a bit more :slight_smile:

You can think of Octo.exe pack as a really dumb packer. It’ll only pack whatever is in the folder you point it to without much ceremony. So the key here is to have MSBuild sending the output of the build to a path of your choice, and then aiming Octo.exe pack to that same path.

Thanks!

Dalmiro

Hi Dalmiro

Thank you for your reply.
Your previous answers have clarified all the questions about the back up and octo pack.
Please clarify the following:
1.I meant the version number in the app settings of the config file





Right now, I am using the setting “configuration variable” to update it. I am looking for a way to increment the value automatically?

2.Right now, when i Deploy, I am using the “update IIS path” option to update the physical path of the site to the latest binaries. Is there any way that I could deploy the binaries to the root folder instead of the tentacle folder.(I dont want to copy from the tentacle folder to the root folder. It uses all the disk space)
Thank you once again

Sam

Hi Sam,

1.I meant the version number in the app settings of the config file. Right now, I am using the setting “configuration variable” to update it. I am looking for a way to increment the value automatically?

Hmm this one is tricky. You could do something like this:

  1. Enable the feature Scripts in Package Steps and put the below code as a PRE deploy script
Set-OctopusVariable -Value $NewVersion -Name Version
  1. Set the XML line to <add key="Version" value="#{Version}" /> in your config file.
  2. Enable the feature Substitute Variables in Files and set that config file as a target to be subtituted.

This will create an Octopus variable called which will then be used to replace #{Version} in your config file.

This does not resolve your need to auto increment the value, because at that point there’s no way to know the current value on the config file to then increase it by 1. If you could somehow figure out the current value in the config, you could change the script in (1) to this:

[int]$currentVersion = "" #this is where you have to figure out how to get the current version

[int]$NewVersion = $currentVersion + 1

Set-OctopusVariable -Value $NewVersion -Name Version

2.Right now, when i Deploy, I am using the “update IIS path” option to update the physical path of the site to the latest binaries. Is there any way that I could deploy the binaries to the root folder instead of the tentacle folder.(I dont want to copy from the tentacle folder to the root folder. It uses all the disk space)

By Root folder you mean a fixed folder where your site is pointing to, and by Tentacle folder you mean the folder where Octopus drops the files by default (like C:\Octopus\Applications\Dev\Testapp\1.0.15). Correct?

If the above is accurate, then all you need to do is use the Custom Installation Directory feature on your IIS step which will:

  • Extract the package on the path you want
  • Re-point the website to that same path on each deployment.

Hope that helps,
Dalmiro

Thank you Dalmiro:)))))))

Hi,
I just would like to let you know that the the latest version of Octopus(3.12.8) gives the following error when deploying the package to a web server
System.NotSupportedException: Unknown header: 335549442
Error
at SharpCompress.Common.Zip.ZipHeaderFactory.ReadHeade
at SharpCompress.Common.Zip.SeekableZipHeaderFactory.
at SharpCompress.Archives.Zip.ZipArchive.
at SharpCompress.LazyReadOnlyCollection`

I just downloaded 3.12.0 version of octopus and deployment works fine.
Can you please why it happens in the latest version of Octopus.

Thanks,
Sam

Hi Sam,

I have moved your most recent comment into its own thread as it appears to be a new issue that needs to be investigated. We are able to faster assign and manage new issues when they are on their own threads :slight_smile:

Vanessa