Skip to content

Possibility to individualize unpacking (Azure Devops) #186

@Ayax0

Description

@Ayax0

Describe the feature

I have tried to implement a custom provider for Azure Devops. My code looks like this:

const devops: TemplateProvider = async (input, { auth }) => {
	const match =
		input.match(
			/^(?<org>[\w.-]+)\/(?<proj>[\w. ]+)\/(?<repo>[\w.]+)(?<subdir>[^#]+)?(?<ref>#[\w./@-]+)?/,
		)?.groups || {};

	return {
		name: "devops",
		version: input,
		headers: { authorization: Buffer.from(`:${auth}`).toString("base64") },
		url: `https://dev.azure.com/${match.org}/${match.proj}/_git/${match.repo}?path=${match.subdir || "/"}&version=GB${match.ref ? match.ref.slice(1) : "main"}`,
		tar: `https://dev.azure.com/${match.org}/${match.proj}/_apis/git/repositories/${match.repo}/items/items?path=${match.subdir || "/"}&versionDescriptor[version]=${match.ref ? match.ref.slice(1) : "main"}&resolveLfs=true&$format=zip&download=true`,
	};
};

The problem is that Devops only allows a download as a zip file. So the download fails because a tar.gz file is expected.

It would be good if, for example, a separate unpacking callback function could be provided by the provider so that an alternative unpacking function can be used in this case.

Additional information

  • Would you be willing to help implement this feature?

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions