Repository

Changing your artifact or chart repository

Jenkins X lets you configure different artifact repositories. We use artifact repositories to:

  • store artifacts from some kinds of build (e.g. Java builds tend to deploy jars, pom.xml files and tarballs)
  • act as a Maven proxy to cache maven dependencies when using java/maven builds
  • implement a chart repository for releasing helm charts

Nexus

By default if you don’t make any explicit configuration then Jenkins X uses:

  • Nexus as an artifact repository to store artifacts (e.g. Java jars, pom.xml files, tarballs or npm modules etc)
  • ChartMuseum as a repository of charts

You can explicitly configure nexus via the following jx-requirements.yml file:

repository: nexus

Bucketrepo

The bucketrepo chart is a small footprint microservice that is an alternative to both Nexus and Chartmusem which can:

  • act as a Maven proxy to cache maven dependencies when using java/maven builds
  • act as an artifact repository (e.g. to deploy maven artifacts)
  • implement a chart repository for releasing helm charts

To replace nexus by bucketrepo use the following jx-requirements.yml file:

repository: bucketrepo

Then replace the nexus chart in helmfiles/jx/helmfile.yaml by:

- chart: jenkins-x/bucketrepo
  name: bucketrepo

If you also want to replace chartmuseum by bucketrepo, change jx-requirements.yml with:

apiVersion: core.jenkins-x.io/v4beta1
kind: Requirements
spec:
  ...
  cluster:
    chartRepository: http://bucketrepo.jx.svc.cluster.local/bucketrepo/charts

Another alternative for the helm chart repository is to use Github gh-pages, as explained here. Note that in that case and if you don’t have any maven artifact, you don’t need bucketrepo.

By default the local file system in the bucket repo is used to store artifacts.

To enable cloud storage for artifacts in bucketrepo you need to enable the storage.repository configuration in jx-requirements.yml, in which case a cloud bucket is used instead. See the storage section for more details.

None

If you want to disable the artifact repository (nexus) but still use ChartMuseum for charts you can use the following:

repository: none

Note that without using an artifact repository you will not be able to deploy Maven artifacts; though ChartMuseum will still be used as a repository of charts

Maven Repository

If you are using Nexus or Bucketrepo things should just work out of the box.

For other solutions try the following:

GitHub

If you want to use github packages to publish maven artifacts use the following in your jx-requirements.yml

repository: github
repositories:
  maven:
    releaseUrl: https://maven.pkg.github.com/myowner/myrepo/

    # optional if different to the above
    snapshotUrl: https://maven.pkg.github.com/myowner/mysnapshots/

Note: The pipeline user token will be used to push maven packages. It needs the “write:packages” permission, which is already set on the link to create the pipeline token so it should work.

Custom

If you want to use a custom maven repository then populate it as follows:

repository: mycustomrepo
repositories:
  maven:
    releaseUrl: https://myrepo.acme.com/releases/

    # optional if different to the above
    snapshotUrl: https://myrepo.acme.com/releases/snapshots/

Then the myrepo Secret will be used with properties username and password to generate the equivalent <server> section in your maven settings XML file:

<server>
  <id>mycustomrepo</id>
  <username>$secret.mycustomrepo.username</username>
  <password>$secret.mycustomrepo.password</password>
</server>