Build Information

Hi,

here it is. I just extracted the two stages (push package and Release & Deploy)

//Stage to push build information using Octo.exe.

echo “Pushing build informaiton, please wait…”
def checkoutVars = checkout([$class: ‘GitSCM’, userRemoteConfigs: [[credentialsId: env.APP_GIT_CREDENTIAL_ID, url: env.APP_GIT_REPOSITORY]]])
env.GIT_URL = checkoutVars.GIT_URL
env.GIT_COMMIT = checkoutVars.GIT_COMMIT

echo “Git url is : ${GIT_URL}”
echo “build url is : ${BUILD_URL}”

def data = [
“BuildEnvironment”:“Jenkins”,
“Branch”:"${BRANCH_NAME}",
“BuildNumber”:"${BUILD_NUMBER}",
“BuildUrl”:"${BUILD_URL}",
“VcsType”:“Git”,
“VcsRoot”:"${GIT_URL}",
“VcsCommitNumber”:"${GIT_COMMIT}",
“Commits”:[
[
“Id”:"${GIT_COMMIT}",
“Comment”:"${COMMIT_COMMENT}"
]
]
]
def json = JsonOutput.toJson(data)
json = JsonOutput.prettyPrint(json)
writeFile(file:‘buildInfo.json’, text: json)

bat “${OCTOPACK} build-information --package-id=TMS --version=${vNumber}-${versionSuffix} --file=${WORKSPACE}\buildInfo.json --server=${OCKTOPUS_SERVER} --apiKey=${OCTOPUS_API_KEY} --space=Victor-US”

//Stage to create release and deploy. The thing I want to clear is these: releaseNotesFile: ‘’, releaseNotesSource: ‘scm’

octopusCreateRelease additionalArgs: ‘’, channel: ‘bug-fix’, cancelOnTimeout: false,deploymentTimeout: ‘00:15:00’,environment: ‘DEV-1’,deployThisRelease: true, project: ‘TMS’, releaseNotes: true, releaseNotesFile: ‘’, releaseNotesSource: ‘scm’, releaseVersion: “${vNumber}-${versionSuffix}”, serverId: ‘OctopusDeploy’, spaceId: ‘Spaces-2’, tenant: ‘’, jenkinsUrlLinkback: true,tenantTag: ‘’, toolId: ‘Octocli’, variables: ‘’

Hi,

Would it be possible to have the output of the buildinfo file sent via email so I can attempt to reproduce it on my end? Which version of octopus server are you running?

Thanks,
Jeremy

Hi,

attached the buildinfo file and we are running Octopus Deploy version 2019.13.7

Regards,

buildInfo.json (496 Bytes)

Hi @endashaw.adane,

The buildinfo file looks good at first glance.

Two things we can try here:

  1. Remove passing a release notes with the jenkins pipeline entirely, this is overwriting the one we created within the project settings. That’s why we’re getting two sets of release notes depending on where its created.
  2. In what order are you pushing the package, pushing build info, creating release? If possible, can you do the order Push build info, push package, create release?

Please let me know if you can try those and report back with the results.

Thanks,
Jeremy

Hi @Jeremy Miller

I tried both cases: remove the line passing releaseNotes and change the order. in both cases got the following
image.png

Hi @endashaw.adane,

I took a look at the jenkins code and it looks like if you are creating releases with the jenkins Octopus plugin step, it will wipe out the release notes template you’ve set in the portal. It looks like you will need to include the release notes file with the information you want within it if you want to create the release using that step.

It does look like you will have to pass this information along with the additional args and the releasenotesfile. https://octopus.com/docs/octopus-rest-api/octopus-cli/create-release

  --releaseNotes=VALUE   [Optional] Release Notes for the new release.
                         Styling with Markdown is supported.
  --releaseNoteFile, --releaseNotesFile=VALUE
                         [Optional] Path to a file that contains Release
                         Notes for the new release. Supports Markdown
                         files.

Can you please do some testing with that rather than the release notes template in the portal and see if you can get it outputting the way you like?

The “Release created by…” will always be there if you create the release with Jenkins, but the stuff you add with the arguments will be below that.

Please let me know what you think.

Thanks,
Jeremy

@jeremy.miller
Good point. Let me try that

@jeremy.miller,

Thanks again! I am able to create the release file and push it to Octopus Deploy. here is the look.


I need to work on formatting. supposed to be displayed like this.

Release Changes
Release 9.24-29-bau-3b3aa6d

Changes in this release:
MHSBAU-1234 Load release notes from file

Hi @endashaw.adane,

You’re very welcome! Thanks for the update. I believe you should be able to use markdown. I believe </br> is a new line in markdown.

For what it’s worth, the engineers are discussing adding branch support in Jenkins, but I’m not sure when that will be.

Please let me know if you have any other questions regarding this.

Thanks,
Jeremy

@jeremy.miller
So, before closing this thread, there might be many pre-release notes before the actual deployment to production. Is there an option in Octopus to show all releases in release notes when deploying to PROD?
e.g.
Release Changes
Release: 9.24-30-bau-90b8171
Changes in this release
MHSBAU-3456- add release note
Release: 9.24-31-9578126
Changes in this release
MHSBAU-1234- update something

Hey @endashaw.adane,

In my experimentation I found an option within Jenkins that I think might be causing the release notes template in the project to be overwritten.

Do you have these options ticked? In my testing I left them un-ticked and I was able to use the release notes template within the octopus project settings that you pasted above to perfection.

If you don’t want to create a releasenotesfile and attach it with your release and instead use the one you have in the project, you could untick those and create the release in jenkins without them.

I did a test and pasted your release notes template into a release note file and included that, and it worked as well.

Here is my setup and results:

Please let me know how either option goes for you.

Edit: If you are talking about changes rolled up to an environment since the last deploy to that environment, you would be looking for our deployment.changes variable I believe. There is documentation on that here: https://octopus.com/docs/releases/deployment-notes

Thanks,
Jeremy

@jeremy.miller
Yes. now it is working. thanks! I am using multi-branch pipeline project and I don’t have screen like that to uncheck the boxes. but that gives me a clue and get the correct script from pipeline syntax. Now I put the release template on the project and create the release …and working fine. something was fishy before.
Now I am checking the deployment notes

I really appreciate your help!

Hey @endashaw.adane,

You’re very welcome! Thanks for the update that it’s working.

I hope you have a great rest of your week.

Best,
Jeremy

Hi @endashaw.adane

Version 3.1.0 of the plugin now supports pushing branch information (GitHub issue)

Please try it out!

Cheers,
Frank

Hi,

thanks for the update! I’ll check it out

Regards,

Hi,

I’ve tried the Version 3.1.0 but here is what I got in build information page

the branch name is not displayed

Regards,

Hey,

Thanks for the screenshot. What does your current buildinfo file in Jenkins look like now? Would you be able to attach the new one?

Please let me know.

Thanks,
Jeremy

Hi,

sorry if I missunerstood you

Currently, I create buildinfo file and use octo.exe’s build-information to push it to octopus. I’ve attached sample file

So, when I heard about OctopusDeploy 3.1 plugin, I switched to OctopusPushBuildInformation and shared you what I got. There is no buildinfo file in this case.

Regards,

buildInfo.json (501 Bytes)

Hi,

If you turn on verbose logging with the PushBuildInfo step, you should see the JSON it creates within the build log. Is that what you attached, or the one you manually make?

Thanks,
Jeremy

Oh that is the one i created manually. Let me enable the verbose logging and run it again. I’ll get back to you