gaelcolas / Sampler

Module template with build pipeline and examples, including DSC elements.
MIT License
171 stars 42 forks source link

Compatibility with Azure DevOps Repos: Decouple git tagging from Sampler.GitHubTasks #351

Closed raandree closed 2 years ago

raandree commented 2 years ago

When having the code not on GitHub but on Azure DevOps Server / Service, the git version tags are not being created. This is as the task Create_ChangeLog_GitHub_PR takes care of this and this task does not work with any non-GitHub code repository.

I want to suggest to move the git tagging into a separate task that runs with any git repository. Personal access tokens should be used for authentication. The following works for GitHub, Azure DevOps Service and Azure DevOps Server.

$patBase64 = [Convert]::ToBase64String([Text.Encoding]::ASCII.GetBytes(('{0}:{1}' -f 'PAT', $PAT)))
Invoke-Utility git config http.extraheader "Authorization: Basic $patBase64"

What do you think about this?

johlju commented 2 years ago

I think @gaelcolas intention was to have a Sampler.AzDOTasks and Sampler.GitlabTasks and so on... But if it possible to make this generic (not just for AzDO and GitHub) then it could be okay to move out. But I let us get @gaelcolas input first. 🙂

gaelcolas commented 2 years ago

How far have you got with this @raandree :)

johlju commented 2 years ago

I think it is the task Publish_release_to_GitHub that creates the preview tag by creating a release on GitHub (which connects to a tag). I guessing we need to create a new task that just creates the preview tag since AzDo does not support registering releases to tags. Task name could be Create_preview_release_git_tag?

Though we also need a new task to send in the changelog PR, task name Create_ChangeLog_PR? To support sending in a PR branch to an Azure Repo, it will be a stripped down version of the existing task Create_ChangeLog_GitHub_PR.

We should have both new tasks in a new module Sampler.AzDOTasks 🤔

johlju commented 2 years ago

The PR https://github.com/gaelcolas/Sampler/pull/380 and PR https://github.com/gaelcolas/Sampler/pull/381 will add a task that creates preview release tags and push a bramch, and the module https://github.com/SynEdgy/Sampler.AzureDevOpsTasks will soon contain a task that creates a PR (todo is to create the actual PR from the branch from PR https://github.com/gaelcolas/Sampler/pull/381).

johlju commented 2 years ago

The new module https://github.com/SynEdgy/Sampler.AzureDevOpsTasks have now been release as a preview.