Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add "create-channel" command. #77

Merged
merged 3 commits into from
May 8, 2016
Merged

Add "create-channel" command. #77

merged 3 commits into from
May 8, 2016

Conversation

uglybugger
Copy link
Contributor

Rationale

The rationale behind this feature is to allow branch builds from TeamCity or other build servers to have a per-branch channel created for them.

octo.exe create-channel --server=XYZ --apiKey=API-XYZ --channel="My New Channel" --project="My Project" --lifecycle=Default --update-if-exists

Use case

Use case: a team using short-lived feature branches wants to create a different IIS binding for each branch. The current best solution appears to be to parse a release version number or a package name and extract a branch name into an output variable.

This solution would allow a much cleaner creation of a channel for any given branch. I discussed this with @michaelnoonan a while ago and offered to send a pull request if the Octopus team didn't get around to building it first. Here it is :)

Implementation

This is a fairly straight-forward wrapper over the Octopus REST API.

There's one small feature that might be noteworthy: the --update-if-exists parameter, which allows "create or update" behaviour.

@michaelnoonan
Copy link
Contributor

Nice. I can see how this will become more and more useful over time also. As part of Octopus 3.4 we are rebuilding the dashboard views so you can pivot on different axes, like showing environment/channel which would show you the latest release in each environment per channel.

After you're done with that feature branch it would be nice to easily delete the feature channel, and have all the releases get cleaned up... Food for thought.

One comment inline. :)

{
if (string.IsNullOrWhiteSpace(projectName)) throw new CommandException("Please specify a project using the parameter: --project=ProjectXYZ");
if (string.IsNullOrWhiteSpace(channelName)) throw new CommandException("Please specify a channel name using the parameter: --channel=ChannelXYZ");
if (string.IsNullOrWhiteSpace(lifecycleName)) throw new CommandException("Please specify a lifecycle name using the parameter: --lifecycle=LifecycleXYZ");
Copy link
Contributor

Choose a reason for hiding this comment

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

A null lifecycle is allowed, which is interpreted as "Use the project's default lifecycle". I think for consistency octo.exe should allow the same behaviour as the UI.

@uglybugger
Copy link
Contributor Author

I've updated the pull request to make the lifecycle name non-mandatory as per the API. It's also updated to allow for case-insensitive matches of channel and lifecycle names (again, as per the API).

@yngvebn
Copy link

yngvebn commented Aug 10, 2016

Not sure if commenting on closed issues is ok, or not, but here goes nothing :)
This feature would be extremely useful for us if it was also possible to supply version-range/tag-prefix to the create-channel, as we're attempting to get automatic release-creating from TeamCity going. As the build will publish package(s) with version 1.2.3-MYFEATURE1, the newly created channel should have a tag-regex of "MYFEATURE1", as those packages with that branch are the only ones that are valid for this release.

Maybe we're going about this the wrong way, so if you guys have any feedback or suggestions to better solutions to this, I would be extremely grateful :)

@michaelnoonan
Copy link
Contributor

Hi @yngvebn. I think it's better to talk than stay silent! https://octopus.com/support is a really good way to get help too. :)

Creating a new Channel complete with package Version Rule(s) would be great, especially now we automatically choose the best Channel for a Release based on the Packages involved... but I can see the syntax becoming tricky. Totally shooting from the hip for this example:

octo.exe create-channel --server=XYZ --apiKey=API-XYZ --channel="MYFEATURE1" --project="My Project" --lifecycle="Feature Branch Lifecycle" --versionRule="Package Step 1":"[1.0,2.0)":"MYFEATURE1" --versionRule="Package Step 2":"[1.0,2.0)":"MYFEATURE1" --update-if-exists

Regardless of the exact syntax, we would need to parse everything after the --versionRule= into the Version Range and Tag Regex parts. :)

What syntax would make the most sense to you? @uglybugger would be interested for you to weigh in also. :)

Also for context, we do have this suggestion floating around also.

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.

3 participants