Trying to get the released of a subproject

Hello Octopus deploy,
I am trying to create a new release of a master project by using octo.exe
The master project which contains a step to deploy a subproject with ‘Deploy a release from project …’

Of this project I have the following releases:
• Master project – rel=1.10
• Subproject – rel=2.5
and
• Master project – rel=1.20
• Subproject – rel=2.7

Now I want to create a new Master project release 1.11 with subproject release 2.5

I am doing this with powershell and octo.exe
When I start I know the version of the Master project but I do not know the version of the subproject.

I have used the API: ProjectDeploymentProcessSnapshot and I see in there the name of the deployed subproject, but I do not see how to get from there to the releasenumber of the subproject.

Output of $ProjectDeploymentProcessSnapshot.steps.actions.packages looks like
Id : ba430ab0-1592-4ec0-900b-b4f909ebb15f
Name :
PackageId : Projects-484
FeedId : feeds-builtin-releases
AcquisitionLocation : NotAcquired
Properties :

and PackageId: Project-484 is the ID of my subproject. But where can I find the Releasenumber (or releaseid) ?

Can you help me?

Greetings ebosman, thanks for reaching out :slight_smile: If I understand correctly, you are wanting to create a new release of the Master project, but not use the latest release of the subproject, rather specify a different one, is this correct?

Yes, that’s correct. I want to use the release of the subproject, i used before.

I’m wondering if Channels might work for you. Using the Channels feature, you can set some package version rules so that when creating the release, it will only select packages up to a certain version. Would this work for you?

No that’s not what i’m looking for.
I want to be able to find out from a given release (or maybe a given deployment) what releaseid the subproject had.
As you know, not only the package content can be changed, but also the process steps can change with an new release of a project.

I think I have already found it. I was just looking at the wrong place:
curl -X GET “http://octisodev01.isodev.loc/api/releases/Releases-63107” -H “accept: application/json”
Response body
{
“Id”: “Releases-63107”,
“Version”: “6.02.20201208-07”,
“ChannelId”: “Channels-654”,
“ReleaseNotes”: null,
“ProjectDeploymentProcessSnapshotId”: “deploymentprocess-Projects-483-s-6-7LBLS”,
“IgnoreChannelRules”: false,
“BuildInformation”: [],
“Assembled”: “2020-12-08T16:05:31.884+00:00”,
“ProjectId”: “Projects-483”,
“LibraryVariableSetSnapshotIds”: [
“variableset-LibraryVariableSets-181-s-171-G64QK”
],
“SelectedPackages”: [
{
“StepName”: “Deploy Model”,
“ActionName”: “Deploy Model”,
“Version”: “6.02.20201208-07”,
“PackageReferenceName”: “”
}
],

The Version (4 line from below) is what i’m looking for.
Thanx anyway,
Bye
Eric

Got it. Yes! I was just about to respond with a slightly different way. For the parent project, you can see it’s specific releases and then get that information, for example

$releases = Invoke-RestMethod -Method "get" -Uri ("$OctopusServerUrl/api/projects/projects-821/releases") -Headers @{"X-Octopus-ApiKey"="$ApiKey"}

$releases.Items[0].SelectedPackages

This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.