BuildPackageVersionBaselineForChannel loads the deployment process template from the server, and for each step+package therein, finds the latest available version satisfying the channel version rules. Result is the list of step+package+versions to use as a baseline. The package version override proc
(octopus *octopusApiClient.Client, deploymentProcessTemplate *deployments.DeploymentProcessTemplate, channel *channels.Channel)
| 385 | // finds the latest available version satisfying the channel version rules. Result is the list of step+package+versions |
| 386 | // to use as a baseline. The package version override process takes this as an input and layers on top of it |
| 387 | func BuildPackageVersionBaselineForChannel(octopus *octopusApiClient.Client, deploymentProcessTemplate *deployments.DeploymentProcessTemplate, channel *channels.Channel) ([]*packages.StepPackageVersion, error) { |
| 388 | |
| 389 | result, err := packages.BuildPackageVersionBaseline(octopus, deploymentProcessTemplate.Packages, func(packageRef releases.ReleaseTemplatePackage, query feeds.SearchPackageVersionsQuery) (feeds.SearchPackageVersionsQuery, error) { |
| 390 | // look in the channel rules for a version filter for this step+package |
| 391 | |
| 392 | rulesLoop: |
| 393 | for _, rule := range channel.Rules { |
| 394 | for _, ap := range rule.ActionPackages { |
| 395 | if ap.PackageReference == packageRef.PackageReferenceName && ap.DeploymentAction == packageRef.ActionName { |
| 396 | // this rule applies to our step/packageref combo |
| 397 | query.PreReleaseTag = rule.Tag |
| 398 | query.VersionRange = rule.VersionRange |
| 399 | // the octopus server won't let the same package be targeted by more than one rule, so |
| 400 | // once we've found the first matching rule for our step+package, we can stop looping |
| 401 | break rulesLoop |
| 402 | } |
| 403 | } |
| 404 | } |
| 405 | |
| 406 | return query, nil |
| 407 | }) |
| 408 | |
| 409 | if err != nil { |
| 410 | return nil, err |
| 411 | } |
| 412 | |
| 413 | return result, nil |
| 414 | } |
| 415 | |
| 416 | func AskQuestions(octopus *octopusApiClient.Client, stdout io.Writer, asker question.Asker, options *executor.TaskOptionsCreateRelease) error { |
| 417 | if octopus == nil { |