Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
4.5k views
in Technique[技术] by (71.8m points)

.net - Octopus requires explicit Channel ID when creating release via API despite default channel being set

I'm using Octopus Server. At one point within my pipeline, I run a lambda function that pushes the build package to Octopus, and then attempts to create a Release within Octopus.

I'm using the .NET Octopus SDK.

Pushing the package to Octopus works smoothly.

Creating the release throws this error:

There was a problem with your request. - A channelId must be provided for a release when more than one exists for that project and no default channel has been specified.: OctopusValidationException
at Octopus.Client.OctopusClient.DispatchRequest[TResponseResource](OctopusRequest request, Boolean readResponse)
at Octopus.Client.OctopusClient.Create[TResource](String path, TResource resource, Object pathParameters)   at Octopus.Client.Repositories.ReleaseRepository.Create(ReleaseResource release, Boolean ignoreChannelRules)
at MyProject.Function.CreateRelease(ILambdaContext context, S3Entity s3Event, IOctopusSpaceRepository repositoryForSpace) in /home/runner/work/CICD/CICD/src/MyProject/Function.cs:line 113
at MyProject.Function.FunctionHandler(S3Event evnt, ILambdaContext context) in /home/runner/work/CICD/CICD/src/MyProject/Function.cs:line 84
at lambda_method(Closure , Stream , Stream , LambdaContextInternal )

... after running this:

var release = new ReleaseResource(version, "MyProjectId");
repositoryForSpace.Releases.Create(release);

The error message seems self-explanatory, and I can fix it quickly by explicitly referring to the Channel when creating the ReleaseResource, like this:

var release = new ReleaseResource(version, "MyProjectId", "MyChannelId");

But the error message seems to be a bug, because

  1. I only have one channel, and
  2. That one channel is marked as the default

So I would think that with even just ONE of those conditions true, I wouldn't receive this error. Yet, I receive it even with both conditions satisfied.

Any thoughts?


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

It sounds like this could be a bug. Can you email [email protected] with the error, your Octopus.Client version, and your Octopus Server version?


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

2.1m questions

2.1m answers

60 comments

57.0k users

...