Releases are tightly tied to Git tags (the tag name is the Release's de facto primary identifier), which is problematic for some use cases:
Guest users of private projects are allowed to view Releases, but not allowed to access any Git info, including the tag name. See #213016 (closed).
We have the ability to label a Release as an "upcoming Release", but these Releases still require an association to a existing Git tag, making this feature less useful.
A semantic version field would be useful when sorting and filtering Releases (see #26413 (closed)). This would allow this page to organize/group/filter Releases more intelligently, for example:
Only show major versions (X.0.0), or filter our patch versions
Only show versions for a specific major version (12.X.X)
Sort releases by version (12.0.0-alpha, 12.0.0-beta, 12.0.0, 12.0.1, 12.1.0)
Cross-over/collaboration with GitLab's Package features
GitLab's Package registry already tracks packages using a first-class "version" concept, so making Releases aware of versioning would allow some cool integrations between these two features. For example:
Automatically creating Releases when a package is published
Item #2 in the Proposal section above would require a significant amount of development work:
Use this version as the Release's primary identifier instead of the Git tag name.
In addition, we would need to come up with a transition plan for projects that have existing Releases. We already recommend using semantic versioning in our documentation, so hopefully most projects could be automatically converted by parsing the existing Releases' tag names.
Permissions and Security
This would alleviate some of issues we have regarding Guest users of private projects: #213016 (closed)
Documentation
This feature would require documentation updates, primarily on this page.
Is this a cross-stage feature?
As mentioned above, this feature could open up some opportunities to collaborate with Package.
@nfriend We do support semantic versioning for each format, but we do not currently enforce it.
If we gave users a way to use a pre-defined environment variable (or some other way) to define a semantic version tied to a release via pipelines, that would be valuable. Although, we still wouldn't be able to enforce it, when built via the client.
@nfriend, @trizzi is correct, outside of npm, there is no validation of the version value. I recall in the MR where npm validation was added, @10iocommented we could probably add the validation to the other package managers.
Automatically creating Releases when a package is published
This is a cool idea. I can only speak from very small experience, but when I was publishing ruby gems, I had a habit of tagging each gem release with a Git tag, so it absolutely makes sense to tie these together, or at least give users the option to automatically tie them together.
Merging of the Releases and the Packages page
I like this idea, but I think it will take a lot of user validation to see what they expect from each page. As a package user, I expect I would be looking for things like release notes, version tagging, etc, when I visit the package page of a project in order to consume a given package.
@nfriend this is awesome!! Thank you for putting it together.
When speaking with our users about packages, they have mentioned wanting to know and understand the correlation between packages and releases. The question I often hear from users is "is this latest version of the package the official new release I should be using, or is it an in-progress build, test, etc".
Merging of the Releases and the Packages page
I am not sure if merging the release and package data into a single page is the best choice, but I think there is a lot of cross over to consider!
If a package version was tied to a release, I know users would appreciate an indication on the package detail page that points to the rest of the release information, for example! what @sabrams follows exactly with what users have been saying.
I'd also like to point out that while this does pop up for packages, this release oriented information is more important for image-tags. A lot of them get automatically produced through CI and users would like to easily identify if the tag is specifically tied to a release.
I think tying packages and releases together could really provide a lot of the details we've talked about with packages that we aren't always able to get (commit, branch, etc) when the package isn't created with a pipeline. I mentioned this in another upcoming issue #210551 (closed).
Thanks @sabrams@icamacho@trizzi! This is some great info and really interesting discussion. Definitely something to consider and some good content for a Think BIG meeting
I wanted to reach out because we have hit a roadblock with one of our teams moving their build projects to GitLab CI. We have a dev team that requires semantic versioning for their project. They have a requirement to use incremented numerical versions in their builds. Currently, Jenkins provides this feature and GitLab does not. Below is an open issue on gitlab.org that we found that is similar to our teams' requirement. I wanted to see if there were any plans to add this feature to GitLab?
Additionally, I would be interested in any advice or best practices your team may have to address this issue with our existing version of Gitlab. We would like to sunset our Jenkins infrastructure (50 machines or so) and move them all into GitLab pipelines but this will definitely continue to come up as blocker as we migrate over more projects.
Thank you for the link, is this currently what Gitlab recommends to handle this requirement? I have found various links recommending plugins or a mixture of tags. Trying to figure out what to recommend for my teams. On this project we are currently working on we are not using a package registry, their requirement comes out of a need for semantic versioning to comply with Windows DLL requirements. Future projects will be using a package registry.
@mpower - we will be looking to implement something very similar but with the CI_JOB_TOKEN rather than personal access token. Thank you for the feedback on the package registry
Here's a large customer and prospect who is interested. The specific use case is that they are creating new packages in a local PyPI registry (not GitLab), and would like to generate a new patch-level version for every time they push an update to the registry (basically, every successful merge to master). They have no need for a Git tag, just a way to increment and manage a version number.
Would we display an error if an invalid version number (according to semver) is added (ie will we enforce it)?
Semantic versioning is so common that we should make it easy our customers to use in releases. If customers don't want to use semver would they ignore the version field?
@sean_carroll Those are great questions! Below are my opinions, but all of this is certainly up for debate.
Would we display an error if an invalid version number (according to semver) is added (ie will we enforce it)?
I think it makes sense to enforce that the version complies with the semver standard. Doing this would allow us to parse the version and do cool things like sorting/filtering as mentioned in the Sorting/filtering of Releases section in the description.
I think this feature would lose most of its value if we allowed things like Sentimental Versioning
Semantic versioning is so common that we should make it easy our customers to use in releases. If customers don't want to use semver would they ignore the version field?
Long term, I'd love to eventually replace the tag name with a version number as the de facto primary key of Releases. So selfishly, I'd prefer we make it required. It would be interesting to brainstorm scenarios where this won't work.
One of the tricky parts of making it required would be what to do with users who have existing Releases. In a lot of cases we could probably make a pretty good guess based on the tag name, but inevitably there would be some Releases based on tag names that don't map nicely to a semver string.
What about something explicit, like a "This project follows Semver" in the configuration for the project. If this is not checked, then the behavior is as today, allowing customers to opt-out.
One of the tricky parts of making it required would be what to do with users who have existing Releases.
We might even consider making this a checkbox that cannot be turned off once turned on, and a 'on date' is recorded. This would allow existing projects to move to semver without needing to update the historical tags.
@jmeshell I think we may spin a completely different issue from this one:
Sequential patch version numbers available as the variable in the GitLab CI
Users can specify in the ci yaml something like:
patch_version_of: "13.1" # name is bad and open for discussion!
Which will add the environment variable like CI_BUILD_VERSION=13.1.123 to the job. It would be automatically generated and incremented with each new run of the build job.
This variable can be used as users want it:
as semver for any package registry, or even not semver since something like "my-best-version.234" will be supported
by release-cli as the default name for releases
Note, there are a few problems with this idea:
"how to set the starting point if we already released 13.1.120 manually". I think it's ok to say "just increment the minor version when migrating to gitlab-managed versions" in the MVC.
If users use monorepo approach or just build multiple packages from one gitlab project, they will need some kind of namespaces. But that also can be out of the MVC.
There will be "holes" in the version numbers if builds fail. (that feels ok to me)
It's not guaranteed that newer version will contain newer code. But the same is true for deployments to production. So people can use the same methods to fix it, e.g. https://docs.gitlab.com/ee/ci/yaml/#resource_group
I think that kind of solution better addresses the customer requests mentioned above.
This makes a lot of sense, how could we make this "variable based version" still work if people are creating releases manually (in the UI) @vshushlin?
I think the interesting thing in this proposal is making Releases aware of the Package Version, which we could say, associate a release with a package and then take that version as the Release version... per your comment , I think it does make sense to reuse name in that context.
This makes a lot of sense, how could we make this "variable based version" still work if people are creating releases manually (in the UI) @vshushlin?
I'm not sure if we should.
In the interface, we can use a completely different approach: just find the "last semver" release, increment the last number and suggest it as the default. But it looks more like a nice UI feature which slightly improves the experience.
We already have name in the release as opposed to tag. I don't feel like adding a new version field which will serve the same function. So I'm in favor of any solution which will reuse name
@vshushlin That's a good point, we don't want to make things confusing by adding all sorts of different ways to version a Release.
Although I think I'd prefer to instead enforce a consistent naming of tag names. This might look like an option that disallows creating Releases on tags that don't conform to semantic versioning .
My reasoning is that it's nice to reserve the name field for human-readable names, i.e. "macOS Catalina", "macOS High Sierra", etc.
There are a couple of issues we should nail down before beginning any work on this issue. (Primarily, how is the version specified? Do we re-use the tag, or the name, or add a new field?)
For next steps, we should:
Decide on a direction, and create a proof-of-concept
Create an epic for this feature (first-class semantic version integration)
Use the findings from the POC to create a set of small, actionable issues, and associate them to the epic
So, setting this issue as a 1 for now, since the main output will be a single POC MR.
The proposed approach is building and maintaining a docker image based on the GitVersion Docker image to include it in our CI/CD Job templates along with similar scripts to those @DarwinJS has built on the above-guided exploration project.
We do the same with our SAST, DAST, and other features. What do you think?
@ricardoamarilla I believe the proposal is to use a new version field instead of a git tag for a Release. I believe we considered semantic-release as a tool at some point, but since we haven't implemented anything yet it would be nice to get something working regardless of the tool we chose.
The proposed approach is building and maintaining a docker image based on the GitVersion Docker image to include it in our CI/CD Job templates along with similar scripts to those @DarwinJS has built on the above-guided exploration project.
I think template would be great. In fact, we have Community contribution adding one for releases that uses the release keyword in .gitlab-ci.yml!62637 (closed) that is currently in review.
We also use the release-cli for the release keyword, so perhaps is some functionality that could be added to that CLI instead of creating another image?
@jaime, the Community contribution in !62637 (closed) is great! We can use that template to create the release. I believe it is possible to include GitVersion in the same image.
@cguitarte Could you provide more information how does the customer uses the current release functionality? How would semantic versioning support better support their use cases? (They can already create releases with semantic version tags.)
I believe the original request mentions that git tags are not visible for public repositories? And it is more challenging to create a git tag in anticipation of a future release.