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

Task to create changelog PR fails if commit has more than one commit #440

Open
johlju opened this issue Sep 6, 2023 · 0 comments
Open
Labels
enhancement The issue is an enhancement request. help wanted The issue is up for grabs for anyone in the community.

Comments

@johlju
Copy link
Collaborator

johlju commented Sep 6, 2023

Problem description

When the same commit hadhaveseveral tags on it. Example for DFSDsc

PS > git tag -l --points-at 89db2baa582d6774e5cc5ac2096eabf5ecf29dd2
5.0.0-preview0001
v4.5.0-preview0002
v5.0.0
v5.0.0-preview0001

Verbose logs

2023-09-01T07:01:49.1303439Z ##[section]Starting: Send Changelog PR
2023-09-01T07:01:49.1309842Z ==============================================================================
2023-09-01T07:01:49.1310004Z Task         : PowerShell
2023-09-01T07:01:49.1310082Z Description  : Run a PowerShell script on Linux, macOS, or Windows
2023-09-01T07:01:49.1310234Z Version      : 2.226.2
2023-09-01T07:01:49.1310323Z Author       : Microsoft Corporation
2023-09-01T07:01:49.1310522Z Help         : https://docs.microsoft.com/azure/devops/pipelines/tasks/utility/powershell
2023-09-01T07:01:49.1310665Z ==============================================================================
2023-09-01T07:01:49.3031161Z Generating script.
2023-09-01T07:01:49.3040605Z ========================== Starting Command Output ===========================
2023-09-01T07:01:49.3068768Z [command]/usr/bin/pwsh -NoLogo -NoProfile -NonInteractive -Command . '/home/vsts/work/_temp/b69bf612-bdf9-47a9-bd09-8510c9e29132.ps1'
2023-09-01T07:01:49.7857182Z [pre-build] Starting Build Init
2023-09-01T07:01:49.8031734Z [pre-build] Prepending '/home/vsts/work/1/s/output/RequiredModules' folder to PSModulePath
2023-09-01T07:01:49.8402092Z [pre-build] Prepending '/home/vsts/work/1/s/output' folder to PSModulePath
2023-09-01T07:01:49.8472876Z [build] Starting build with InvokeBuild.
2023-09-01T07:01:50.0448489Z [build] Parsing defined tasks
2023-09-01T07:01:50.0476336Z [build] Loading Configuration from /home/vsts/work/1/s/build.yaml
2023-09-01T07:01:51.2213307Z Importing tasks from module Sampler
2023-09-01T07:01:51.3621010Z 	 Loading Build-Module.ModuleBuilder.build.Sampler.ib.tasks...
2023-09-01T07:01:51.3621688Z 	 Loading ChocolateyPackage.build.Sampler.ib.tasks...
2023-09-01T07:01:51.3625625Z 	 Loading Clean.ModuleBuilder.build.Sampler.ib.tasks...
2023-09-01T07:01:51.3626716Z 	 Loading Create_Changelog_Branch.build.Sampler.ib.tasks...
2023-09-01T07:01:51.3627554Z 	 Loading Create_Release_Git_Tag.build.Sampler.ib.tasks...
2023-09-01T07:01:51.3627960Z 	 Loading DeployAll.PSDeploy.build.Sampler.ib.tasks...
2023-09-01T07:01:51.3628239Z 	 Loading DscResource.Test.build.Sampler.ib.tasks...
2023-09-01T07:01:51.3628477Z 	 Loading generateHelp.PlatyPS.build.Sampler.ib.tasks...
2023-09-01T07:01:51.3628724Z 	 Loading GuestConfig.build.Sampler.ib.tasks...
2023-09-01T07:01:51.3629165Z 	 Loading Invoke-Pester.pester.build.Sampler.ib.tasks...
2023-09-01T07:01:51.3629411Z 	 Loading JaCoCo.coverage.build.Sampler.ib.tasks...
2023-09-01T07:01:51.3640723Z 	 Loading release.module.build.Sampler.ib.tasks...
2023-09-01T07:01:51.3641790Z 	 Loading Set-SamplerTaskVariable...
2023-09-01T07:01:51.3642636Z 	 Loading SetPsModulePath.build.Sampler.ib.tasks...
2023-09-01T07:01:51.7503438Z Importing tasks from module Sampler.GitHubTasks
2023-09-01T07:01:52.2806821Z 	 Loading New-Release.GitHub.build.Sampler.GitHubTasks.ib.tasks...
2023-09-01T07:01:52.4164158Z Importing tasks from module DscResource.DocGenerator
2023-09-01T07:01:52.6457022Z 	 Loading Task.Generate_Conceptual_Help...
2023-09-01T07:01:52.6461336Z 	 Loading Task.Generate_Wiki_Content...
2023-09-01T07:01:52.6461976Z 	 Loading Task.Publish_GitHub_Wiki_Content...
2023-09-01T07:01:52.7352284Z Adding Workflow from configuration:
2023-09-01T07:01:52.7452416Z   +-> pack
2023-09-01T07:01:52.7489860Z   +-> hqrmtest
2023-09-01T07:01:52.7512624Z   +-> .
2023-09-01T07:01:52.7571448Z   +-> publish
2023-09-01T07:01:52.7597823Z   +-> build
2023-09-01T07:01:52.7631320Z   +-> test
2023-09-01T07:01:52.7639184Z [build] Executing requested workflow: Create_ChangeLog_GitHub_PR
2023-09-01T07:01:52.7928012Z �[96mBuild Create_ChangeLog_GitHub_PR /home/vsts/work/1/s/build.ps1�[0m
2023-09-01T07:01:52.7940523Z �[90mRedefined task '.'.�[0m
2023-09-01T07:01:52.8165814Z 
2023-09-01T07:01:52.8166645Z ===============================================================================
2023-09-01T07:01:52.8197251Z �[96m			CREATE CHANGELOG GITHUB PR�[0m
2023-09-01T07:01:52.8505771Z �[90m�[0m
2023-09-01T07:01:52.8506657Z -------------------------------------------------------------------------------
2023-09-01T07:01:52.8513060Z �[90m  /Create_ChangeLog_GitHub_PR�[0m
2023-09-01T07:01:52.8513875Z �[90m  /home/vsts/work/1/s/output/RequiredModules/Sampler.GitHubTasks/0.3.4/tasks/New-Release.GitHub.build.ps1:181�[0m
2023-09-01T07:01:52.8514389Z 
2023-09-01T07:01:52.9025652Z 	Project Name               = 'DFSDsc'
2023-09-01T07:01:52.9327997Z 	Source Path                = '/home/vsts/work/1/s/source'
2023-09-01T07:01:52.9414187Z 	Output Directory           = '/home/vsts/work/1/s/output'
2023-09-01T07:01:52.9426848Z 	Release Notes path         = '/home/vsts/work/1/s/output/ReleaseNotes.md'
2023-09-01T07:01:52.9448560Z 	Built Module Subdirectory  = '/home/vsts/work/1/s/output/'
2023-09-01T07:01:52.9472052Z 	Module Manifest Path (src) = '/home/vsts/work/1/s/source/DFSDsc.psd1'
2023-09-01T07:01:52.9529368Z 	Versioned Output Directory = 'True'
2023-09-01T07:01:52.9652146Z 	Built Module Manifest      = '/home/vsts/work/1/s/output/DFSDsc/5.0.0/DFSDsc.psd1'
2023-09-01T07:01:52.9707687Z 	Built Module Base          = '/home/vsts/work/1/s/output/DFSDsc/5.0.0'
2023-09-01T07:01:52.9891881Z 	Module Version             = '5.0.0'
2023-09-01T07:01:52.9918140Z 	Module Version Folder      = '5.0.0'
2023-09-01T07:01:52.9933236Z 	Pre-release Tag            = ''
2023-09-01T07:01:53.0006936Z 	Built Module Root Script   = ''
2023-09-01T07:01:53.0048644Z 	PSModulePath               = '/home/vsts/work/1/s/output;
2023-09-01T07:01:53.0049659Z 	                              /home/vsts/work/1/s/output/RequiredModules;
2023-09-01T07:01:53.0050145Z 	                              /home/vsts/.local/share/powershell/Modules;
2023-09-01T07:01:53.0056359Z 	                              /usr/local/share/powershell/Modules;
2023-09-01T07:01:53.0060279Z 	                              /opt/microsoft/powershell/7/Modules;'
2023-09-01T07:01:53.0065382Z 
2023-09-01T07:01:53.0386853Z Changelog Path                 = '/home/vsts/work/1/s/CHANGELOG.md'
2023-09-01T07:01:53.0485234Z �[90m	...Set GitHubFilesToAdd to CHANGELOG.md�[0m
2023-09-01T07:01:53.0519033Z �[90m	...Set GitHubConfigUserName to dscbot�[0m
2023-09-01T07:01:53.0573990Z �[90m	...Set GitHubConfigUserEmail to [email protected]�[0m
2023-09-01T07:01:53.0623899Z �[90m	...Set UpdateChangelogOnPrerelease to False�[0m
2023-09-01T07:01:53.3294430Z From https://github.com/dsccommunity/DFSDsc
2023-09-01T07:01:53.3295474Z  * branch            main       -> FETCH_HEAD
2023-09-01T07:01:53.3474325Z HEAD is up to date.
2023-09-01T07:01:53.3620708Z �[90mgit rev-parse origin/main�[0m
2023-09-01T07:01:53.3820984Z �[90mgit tag -l --points-at 89db2baa582d6774e5cc5ac2096eabf5ecf29dd2�[0m
2023-09-01T07:01:53.3967733Z �[90m5.0.0-preview0001|v4.5.0-preview0002|v5.0.0|v5.0.0-preview0001�[0m
2023-09-01T07:01:53.4022388Z �[92mUpdating the ChangeLog for release 5.0.0-preview0001 v5.0.0�[0m
2023-09-01T07:01:53.4023283Z �[90mCreating branch updateChangelogAfter5.0.0-preview0001 v5.0.0�[0m
2023-09-01T07:01:53.4132645Z fatal: 'updateChangelogAfter5.0.0-preview0001 v5.0.0' is not a valid branch name
2023-09-01T07:01:53.4149475Z �[90mUpdating Changelog file�[0m
2023-09-01T07:01:53.5451560Z �[91mError trying to create ChangeLog Pull Request. Ignoring.�[0m
2023-09-01T07:01:53.5452469Z �[91m No changes detected in current release, exiting.�[0m
2023-09-01T07:01:53.5559879Z �[96mDone /Create_ChangeLog_GitHub_PR 00:00:00.7384084�[0m
2023-09-01T07:01:53.5692838Z �[92mBuild succeeded. 1 tasks, 0 errors, 0 warnings 00:00:03.6110094�[0m
2023-09-01T07:01:53.7308104Z ##[section]Finishing: Send Changelog PR


### How to reproduce

This code failed since it found a release tag (v5.0.0) but since the command returned more than one tag it got the wrong name for the branch so it failed there and stopped.

### Expected behavior

Not to fail the task.

### Current behavior

Task throws error.

### Suggested solution

This code need to have logic to handle multiple tags and understand that the highest release tag is more important than any preview tag.

https://github.com/gaelcolas/Sampler/blob/a14049c5241e75f52270d292c026d67dac173a92/.build/tasks/Create_Changelog_Branch.build.ps1#L182-L206

### Operating system the target node is running

```text
n/a

PowerShell version and build the target node is running

n/a

Module version used

latest
@johlju johlju added enhancement The issue is an enhancement request. help wanted The issue is up for grabs for anyone in the community. labels Sep 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement The issue is an enhancement request. help wanted The issue is up for grabs for anyone in the community.
Projects
None yet
Development

No branches or pull requests

1 participant