Skip to content

Update Maven template to automatically build and push to the Maven Repository

Problem to solve

Java developers, using GitLab's Maven Repository for building and deploying packages need an easy to to get started and use GitLab's CI/CD pipelines. We already provide a template of gitlab-ci.yml focused on Maven, however it does not take advantage of the Maven repository for deploying and sharing packages.

Proposal

Modify the existing template for Maven of `.gitlab-ci.yml' to allow users to not only easily setup and maintain their pipelines, but to integrate with the GitLab Maven Repository for uploading and managing their Java dependencies. The template will provide the structure and order of each build and support Maven stages: validate, verify and deploy.

As with other gitlab-ci.yml templates, we will set defaults for script, stage and any expected actions.

Working Example

Maven.gitlab-ci.yml

Permissions and Security

  • Developers, Maintainers and Administrators can all pull and publish packages to the GitLab Maven Repository. This is in-line with our existing permissions.
  • We must warn users not to include secrets in publicly available projects.

Documentation

Testing

  • Test at project, group and instance level
  • Ensure permissions are working as expected

What does success look like, and how can we measure that?

Success looks like a user that is setting up Maven for the first time is able to get it up and running and configured with CI/CD quickly and easily. We can measure the number of new issues for Maven configuration and the time to resolution. We can also measure # of templates in use over time.

What is the type of buyer?

Currently the Maven Repository is only available in the Enterprise Edition, so this feature is targeted towards Premium and Ultimate customers.

Links / references

Other Potential Strategies

JFrog has a web form which allows administrators to define certain values and automatically set defaults within the settings and pom files. We could do something similar, but it goes against GitLab design principles.

Edited by Tim Rizzi