Skip to content

Conversation

@geofflamrock
Copy link
Contributor

@geofflamrock geofflamrock commented Nov 1, 2024

This PR is part of a series that adds support to the CLI for interacting with runbooks stored in Git for version controlled projects

Background

Git runbooks operate differently to runbooks stored in the Octopus database in that there are no draft/published snapshots, these are replaced with running a runbook using a Git reference such as main. This means that in order to run a runbook that uses packages or Git resources these need to be supplied as part of the run creation.

Changes

This PR moves some of the common functions for resolving package versions and Git resources from the releases/create package into their own packages.

Reducing risk

There are lots of tests for creating releases which have had only mechanical changes, these should all pass and give us confidence that this change is good. We could look to separate some of the tests for package version resolution in this PR, however I've opted to tackle that separately to give us confidence in this initial change.

// 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 process takes this as an input and layers on top of it
func BuildPackageVersionBaseline(octopus *octopusApiClient.Client, packages []releases.ReleaseTemplatePackage,
setAdditionalFeedQueryParameters func(releases.ReleaseTemplatePackage, feeds.SearchPackageVersionsQuery) (feeds.SearchPackageVersionsQuery, error)) ([]*StepPackageVersion, error) {
Copy link
Contributor Author

@geofflamrock geofflamrock Nov 1, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This function is moved over from the create releases one but has a couple of small change in it to make it generic and usable when creating Git runbooks and creating releases.

  1. It now takes in the package list directly instead of a DeploymentProcessTemplate
  2. When creating a release we need to check the channel rules for the associated package and add any additional search parameters to ensure that the version selected satisfies the rules. This parameter allows us to do that.

@geofflamrock geofflamrock marked this pull request as ready for review November 1, 2024 05:03
@geofflamrock geofflamrock changed the title Separate package version and Git resource functions from create release chore: Separate package version and Git resource functions from create release Nov 18, 2024
@geofflamrock geofflamrock requested a review from a team November 19, 2024 01:06
@geofflamrock geofflamrock merged commit 801cb05 into main Nov 19, 2024
3 checks passed
@geofflamrock geofflamrock deleted the geoffl-git-runbooks-part-1 branch November 19, 2024 03:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants