Open agaudreault opened 2 years ago
FWIW it is possible to use semantic release with the CD process, there's an example here: https://github.com/jenkinsci/conventional-commits-plugin/blob/main/.github/workflows/cd.yaml
But then that requires conventional commits which aren't really used in the Jenkins ecosystem
From what I read, using https://github.com/jenkins-x-plugins/jx-release-version would conflict with what is documented in https://www.jenkins.io/doc/developer/publishing/releasing-cd/. The conventional-commits-plugin is omitting -Dchangelist.format=%d.v%s
in maven.config and ignoring the JEP-229 version. I am curious to have the opinion of @garethjevans to know why he opted-out of the new scheme with CD.
I think it would be good to document that approach as an option to CD. It would also require some settings on the repository, such as Squash & Merge option to be enforced, and a status checks to have https://github.com/zeke/semantic-pull-requests or something similar enabled and configured. @jglick
Hi @agaudreault-jive, the reason we went with jx-release-version
in the conventional commits plugin was that we felt that there is value in providing proper semantic versions for releases. The conventional commits plugin is designed to do just that - its just that we have a dog fooding issue trying to get the plugin to trigger from github actions for the plugin release.
I could not recommend the approach taken in conventional-commits-plugin
as it runs only inside the GitHub Action workflow performing the release; builds from source (including plugin-compat-tester
and various developer workflows) will use some unrelated version number. This makes for messier Maven usage particularly in the case of components which expose an API or which might otherwise become a Maven dependency. Someone who cares about semantic versioning could write a variant of https://github.com/jenkinsci/incrementals-tools/blob/5e41c4d8dbb0d5ff0b882310f8805b6e4d792281/git-changelist-maven-extension/src/main/java/io/jenkins/tools/incrementals/git_changelist_maven_extension/Main.java#L79-L133 which follows Conventional Commit semantics walking history on the first ancestor (to the root, or some base commit with an initial version also specified in .mvn/maven.config
) so that
mvn -Dset.changelist install
would produce the desired versioned artifact. In that case jenkins-maven-cd-action
would probably handle it fine, and I expect you could in fact use the stock https://github.com/jenkinsci/.github/blob/master/workflow-templates/cd.yaml.
Tried to transfer this to https://github.com/jenkinsci/incrementals-tools/issues but that seems impossible as it is in a distinct GitHub organization?
Yeah unfortunately you can't transfer across organisations.
multi-organisation places normally work around it with a bot which re-reports it with a backlink and a comment on the side it was 'transferred' from.
Allow the developers to use the SemVer scheme with the CD workflow. It is possible to fully generate a semantic version based on the commit message and history.
For instance, if the last semantic Tag in the current branch is
1.0.0
and a commit is made starting withfeat:
, the next release will be1.1.0
. The current JEP-229 generate version numbers such as{digit}.v{hash}
that lose all meaning of changes. When a Jenkins maintainers needs to bump a plugin, it is impossible to know at a glance if it contains breaking change or not. The developers will have to do a comparison of the git history and try to find any breaking change. The proposed way to do that is to keep themajor.minor
part of the version manual, which defeat the purpose of automating the version and release process.Generating a semantic version number based on commit history has many advantages:
Tools such as Semantic Release offers many libraries to perform the automation based on existing and widely adopted conventions. The library also allows maintainers to customize release rules of their projects for their needs instead of forcing them in a box. The CI can still enforce some configuration by merging the 2 with a precedence order.
{history_depth}.v{commit_hash}
(0.vabcd1234
) semver: π«{semver}+{commit_hash}
(0.0.0+abcd1234
) semver: β{prefix}.{history_depth}.v{commit_hash}
(0.0.0.vabcd1234
) semver: π«0.0.0+abcd1234
) semver: β{wrapped_semver}-{history_depth}.v{commit_hash}
(1.0.0-0.vabcd1234
) semver: β{wrapped_semver}-{semver}+{commit_hash}
(1.0.0-0.0.0+abcd1234
) semver: βRelated to https://github.com/jenkinsci/jep/pull/383#issuecomment-1083260226