Issues icon indicating copy to clipboard operation
Issues copied to clipboard

Build information doesn't support package ids with './'

Open felixi-octopus opened this issue 10 months ago • 1 comments

Severity

No response

Version

2020.3

Latest Version

I could reproduce the problem in the latest build

What happened?

Attempting to create build information with ./ in the package id results in a

There was a problem with your request.

 - The package ID contains invalid characters. Examples of valid package IDs include 'MyPackage' and 'MyPackage.Sample'.

There are scenarios where build information can be associated with packages that have a ./ in it eg. A package can have an id of ./package-name when it does not have an Azure Dev Ops organization

Reproduction

Using LINQPad, set apiKey and server

<Query Kind="Statements">
  <NuGetReference>Octopus.Client</NuGetReference>
  <Namespace>Microsoft.Extensions.DependencyInjection</Namespace>
  <Namespace>System.Net.Http</Namespace>
  <Namespace>System.Text.Json</Namespace>
  <Namespace>System.Threading.Tasks</Namespace>
  <Namespace>Octopus.Client</Namespace>
  <Namespace>Octopus.Client.Model</Namespace>
  <Namespace>Octopus.Client.Model.BuildInformation</Namespace>
  <Namespace>Octopus.Client.Model.IssueTrackers</Namespace>
  <IncludeAspNet>true</IncludeAspNet>
</Query>



var apiKey = "API-";
var server = "";

var client = new OctopusClient(new OctopusServerEndpoint(server, apiKey));
var global = client.Repository;


var spaceRepository = client.Repository.ForSpace(client.Repository.Spaces.FindByName("Default"));

spaceRepository.BuildInformationRepository.Push(
	packageId: "Te./t",
	version: "1.0.0",
	octopusMetadata: new OctopusBuildInformation()
	{
		Branch = "refs/heads/main",
		BuildEnvironment = "Production",
		BuildNumber = "1",
		BuildUrl = "https://build.server.com/Samples.BuildInformation/1",
		VcsCommitNumber = "100",
		VcsRoot = "https://github.com/TestOrg/Samples.BuildInformation",
		VcsType = "Git",
		Commits = new[] {
			new Commit
			{
				Id = "f61aa91b0204c796be1b77e983240229e203914e",
				Comment = "Fixes #1"
			}

		}
	},
	OverwriteMode.OverwriteExisting
);

Error and Stacktrace

No response

More Information

No response

Workaround

No response

felixi-octopus avatar Dec 09 '24 04:12 felixi-octopus