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

feat: allow generate semantic version from -commit-headlines CLI flag #113

Conversation

lemeurherve
Copy link
Contributor

@lemeurherve lemeurherve commented Aug 12, 2023

This PR allows to generate a semantic next version from a previous one without the need for a (valid) tag or commit(s) from a repository.

Use case

A helm charts repository (https://github.com/jenkins-infra/helm-charts) containing multiple unrelated git tags with a prefix corresponding to their chart name, making the tag (ex: acme-1.2.3) semantically invalid to use with -next-version=from-tag:acme-1.2.3 argument (even with a -tag-prefix="acme-" additional flag).

Example of usage

$ jx-release-version -previous-version=manual:1.2.3 -commit-headlines="feat: a feature"
1.3.0

$ jx-release-version --previous-version=from-file:helm-charts/charts/acme/Chart.yaml -commit-headlines="feat: a feature" -debug
DEBUG: jx-release-version 2.6.11-dev+8acbdc5 running in debug mode in /Users/veve/j-infra
DEBUG: Using "from-file" version reader (with "helm-charts/charts/acme/Chart.yaml")
DEBUG: Reading version from file /Users/veve/j-infra/helm-charts/charts/acme/Chart.yaml using reader helm-chart
DEBUG: Found version 0.1.2
DEBUG: Previous version: 0.1.2
DEBUG: Using "auto" version bumper (with "")
DEBUG: Trying to bump the version using semantic release first...
DEBUG: Iterating over all commits headline passed as a string
DEBUG: Parsing commit headline number 0 with message feat: stuff
DEBUG: Summary of conventional commits: semantic.conventionalCommitsSummary{conventionalCommitsCount:1, types:map[string]bool{"feat":true}, breakingChanges:false}
DEBUG: Found at least 1 new feature - incrementing minor component
DEBUG: Next version: 0.2.0
0.2.0

Works even without a git repository.

Potential improvement

Related: #84 (comment)

@jenkins-x-bot
Copy link
Collaborator

Hi @lemeurherve. Thanks for your PR.

I'm waiting for a jenkins-x-plugins member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the jenkins-x/lighthouse repository.

@sonarcloud
Copy link

sonarcloud bot commented Aug 12, 2023

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 1 Code Smell

No Coverage information No Coverage information
0.0% 0.0% Duplication

@lemeurherve
Copy link
Contributor Author

lemeurherve commented Aug 12, 2023

/assign @vbehar

(I hope you don't mind the assignment '^^)

@vbehar
Copy link
Collaborator

vbehar commented Aug 15, 2023

/ok-to-test

@vbehar
Copy link
Collaborator

vbehar commented Aug 15, 2023

/assign @vbehar

(I hope you don't mind the assignment '^^)

no don't worry it's ok, just that I'm on vacation right now, so I don't have a lot of time ;-)

@vbehar
Copy link
Collaborator

vbehar commented Aug 15, 2023

/approve

@jenkins-x-bot
Copy link
Collaborator

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: vbehar

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@vbehar
Copy link
Collaborator

vbehar commented Aug 15, 2023

/ok-to-test

@jenkins-x-bot jenkins-x-bot merged commit 07553c1 into jenkins-x-plugins:main Aug 15, 2023
1 check passed
@lemeurherve lemeurherve deleted the use-previous-version-if-no-tag branch October 2, 2023 11:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants