Skip to main content
Version: 0.22.0

Git Repositories and Resources Enterprise

During the pull request creation, to authenticate using Git, you will need to select the git repository where the pull request will be created.

The default git repository selected in the UI

Depending on the action performed on the resource (creation/deletion/editing), the default git repository selected in the UI is determined in the following order:

  1. the repository used to initially create the resource found in the templates.weave.works/create-request annotation (in the case of editing or deleting of resources)

    metadata:
    annotations:
    templates.weave.works/create-request: "{...\"parameter_values\":{...\"url\":\"https://github.com/weave-example-org/weave-demo\"}"
  2. the first repository found with a weave.works/repo-role: default annotation

    metadata:
    annotations:
    weave.works/repo-role: default
  3. the flux-system repository

    metadata:
    name: flux-system
    namespace: flux-system
  4. the first repository in the list of git repositories that the user has access to

In the case of deletion and editing, if the resource repository is found amongst the git repositories that the user has access to, it will be preselected and the selection will be disabled. If it is not found, the user will be able to choose a new repository.

In the case of tenants, its recommended the weave.works/repo-role: default is added to an appropriate git repository.

Overriding the calculated git repository HTTPS URL

The system will try and automatically calculate the correct HTTPS API endpoint to create a Pull Request against. For example, if the git repository URL is ssh://git@github.com/org/repo.git, the system will try and convert it to https://github.com/org/repo.git.

However it is not always possible to accurately derive this URL. An override can be specified to set the correct URL instead. For example the ssh url may be ssh://git@interal-ssh-server:2222/org/repo.git and the correct HTTPS url may be https://gitlab.example.com/org/repo.git.

In this case we set the override via the weave.works/repo-https-url annotation on the GitRepository object:

apiVersion: source.toolkit.fluxcd.io/v1beta1
kind: GitRepository
metadata:
name: repo
namespace: flux-system
annotations:
weave.works/repo-https-url: https://gitlab.example.com/org/repo.git
spec:
interval: 1m
url: ssh://git@interal-ssh-server:2222/org/repo.git

The pull request will then be created against the correct HTTPS API.

The above also applies to the creation of applications.