Octopus Deploy deploymnet into Azure Blob using Jenkins and Azure Blob Library


(siddharth) #1

Hi Team,

My Octopus Deploy will connect with Maven Artifactory as external feed.I want to choose an option of passing the version number as parameter while invoking Octopus Deploy from Jenkins for my CI CD.Could you please advise how can I achieve this? Below link says octopus Deploy takes latest version as default which I don’t want? https://octopus.com/docs/packaging-applications/package-repositories/maven-feeds

As suppose out of 10builds/deployments I want to promote the 7th version from CIT to SIT, then 7th version has to be passed as variable to Octopus deploy?

Note-I’m using Azure library to deploy and using Maven as external feed

https://library.octopusdeploy.com/step-template/actiontemplate-azure-blob-storage-upload

Second question-

If the above has some solution, I will need to deploy the package in two nodes of Azure Blob (DR’s), how can I achieve that?

Please help.

Thanks,

Siddharth


(Shannon Lewis) #2

Responded via support email


(siddharth) #3

Hi Shannon

I’m not able to see your response neither in mail nor in the topic.Where to view that?

Thanks
Siddharth


(Shannon Lewis) #4

I can see it in our outgoing mailbox. Your message was a reply to an earlier message, so the title was a bit different to the subject here. Anyway, I’ll copy the response here, it might help others that way too.

Could I just check, are you using the Jenkins extension or are you calling octo.exe from a script step yourself? You can specify a specific version for a package either way, the mechanics are just slightly different.

If you’re using the extension you can use the UI to either set the Default package version (which works if your deployment process only has 1 package or the packages are a set with matching version numbers) or to set the individual versions for the individual packages.

If you’re using octo.exe directly then what you’re after are the --defaultpackageversion or the --package options.

Both of these work if the version you’re referring to is something like 1.0.7 vs 1.0.10. I’m not an expert with Maven feeds, but my understanding is that for SNAPSHOTs within a version you can only use the current snapshot, you can’t specify an earlier snapshot.

Could I also just confirm what CIT and SIT are? We usually refer to promoting in Octopus as promotion between environments, so I’m wondering if they are environments and this is what you mean?
If they are environments, do you have Jenkins triggering the promote somehow or are you just doing that in Octopus itself?

For example, a typical process I’d use would be to have Jenkins just build the packages, push them to Octopus, and create a release in Octopus for that version. So I might have releases 1.0.7 and 1.0.10 from the earlier version number examples. I can then go to those releases in Octopus and deployment them to an environment without running anything in Jenkins.

Regarding question 2, unfortunately we don’t currently have a specific standalone step for pushing a package to Azure Blob storage. My recommendation would be to use an Azure PowerShell step in conjunction with the Packages in Script Step feature. This will let you get the package and use the Azure PowerShell cmdlets to push it to the storage account you need.

I hope that helps and if I can assist further just let me know.

Regards
Shannon


(siddharth) #5

Hi Shannon,
Thanks for your response.Let me make it clear.
I have Azure Blob storage Environmnets as CIT(single node), SIT(single node), Pre-Prod(two nodes) and PROD(two nodes).
The application is of ReactJS code and after build I will pack as zip and upload to Maven Artifactory JFrog.
My CI CD model is -Jenkins fetch the code from BitBucket and build it using yarn command,then zip and upload to artifactory.Jenkins to download the zip and using Octopus deploy, deploy to Azure Blob CIT environment first.So upto here it would be continuous Build and deploy. In a different jenkins job for SIT(next higher environment), I want to deploy the Release which is signed off in CIT.It may be the case that though I’ve tested 1.0.7 which I want to deploy to SIT but currently 1.0.10 is there in CIT. So for SIT deployment, I will pass the version to Octopus deploy to deploy into Azure SIT(no build of src here as the Release is already available in Artifactory).Is it possible?
I can use Jenkins plugins or octo.sh (linux), so for CIT build/deploymment, I think I can make a release version and then do this as that is continuous process?
Octo.sh" pack --format=zip -id=dejavu-web --basePath=“proj\dejavu\test\ats-webapp\app” --version 1.1.%BUILD_NUMBER%-WEBDEJTEST --packageversion 1.1.%BUILD_NUMBER%-WEBDEJTEST --server OCTOPUS_SERVER_IP:9010 --apiKey %OctopusApiKey%

Octo.sh" push
–package dejavu-web.1.1.%BUILD_NUMBER%-WEBDEJTEST.zip
–server http://OCTOPUS_SERVER_IP:9010
–apiKey %OctopusApiKey%

Octo.sh" create-release
–project dejavu-web
–version 1.1.%BUILD_NUMBER%-WEBDEJTEST
–packageversion 1.1.%BUILD_NUMBER%-WEBDEJTEST
–server OCTOPUS_SERVER:9010
–apiKey %OctopusApiKey% --deployto=TEST --progress

Here during Build I will create a version number and that version I will upload to artifcatory,then call Octopus deploy (inbuild or external feed) and deploy for CIT.

Please confirm if I choose Maven feed as external Repo in Octopus Deploy, still I can pass the version which I want to deploy for SIT or to make this possible I have to use in Built Octopus Deploy Repo?
Is there any way that I can directly promote or deploy by passing version number the application from CIT to SIT using command line?

I don’t want to use the Octopus Deploy UI and everything should happen via Jenkins.

Please advise.

Thanks,
Siddharh


(Shannon Lewis) #6

Hi Siddharh,

In Octopus terminology, a Release is a snapshot of the code/binaries at a point in time. You then promote that release through a lifecycle to different environments, using a Deployment.

When creating a release the package versions are specified and stored as part of the snapshot. This works equally whether the packages are coming from an external feed (e.g. Maven) or the Octopus internal feed.

In the example call you used to Octo.sh you are creating a release and then deploying it to TEST in a single command line, but it is actually 2 separate operations to Octopus. This is fine, and a common usage. You can then promote that same release (i.e. do the 2nd operation again) to a different environment using the deploy-release command, and it will use all the same package versions used when the Release was created.

Regards
Shannon


(siddharth) #7

Hi Shannon

Thanks for explaining.

So in the example-
for the SIT (next env) deployment I can use create-release command and pass/put the version number I want to deploy and that version will be deployed(1.0.7) irrespective of latest version in Repo (inbuilt/external) is 1.0.10?

Please confirm if this is correct.

If that’s true…then for external Repo I.e. Maven Feeds, Octopus Deploy will download that version 1.0.7 from repo automatically?

Thanks
Siddharth


(Shannon Lewis) #8

The key is to remember that a Release and a Deployment are separate things in Octopus.

If you specify 1.0.7 as the package version when you do the initial create-release, that version will be locked against that release version. If you then run octo deploy-release --version=1.0.7 --deployto=SIT you are asking it to deploy release number 1.0.7 to SIT. Another release (e.g. 1.0.10) could have been created in the meantime but it is a completely separate release and will not interfere with 1.0.7.

The machine doing the deployment will go looking for the version locked to the release, and if it isn’t already cached locally it will download it from the designated repo, whether that is internal or external.

Regards
Shannon


(siddharth) #9

Thank you so much Shannon.I will try this and get back you.

so here what I’m going to…
Configure Octopus Deploy to talk to Maven Atrifactory as External feed (no in built repo).
For CIT-Jenkins builds, pushes to maven artifactory then use oct create-release with passing version to deploy to CIT.
Incase I want to revert back the old version, I will use create deploy with old version to deploy to CIT.If that old version is deleted from Octopus Deploy cache then it will download automatically from external feed?

For SIT-i will use octo create deploy by passing version number to deploy.Same as above for CIT with old code version.

Please confirm and correct me If I’m wrong.

Thanks
Siddharth


(siddharth) #10

Hi Shannon

Will it be possible for you to come in a call to discuss?
I will setup a webex meeting based on your timings.I’m UK based.

Thanks
Siddharth


(Derek Campbell) #11

Hi Siddarth,

Shannon passed this over to me as I am based in the UK as a Solution Architect for Octopus.

You can schedule in some time with me here. We can jump on a zoom call with you next week if that works.

Thanks

Derek


(siddharth) #12

HI Derek,

Thank you so much.

I’m not able to select the timings from here but can we do on Tuesday 12-1PM BST? Is that ok for you?

I will send you the webex link and the bridge number so zoom doesn’t work here.

Thanks,

Siddharth