If called and no sync repo is provided in the SDM configuration, a
warning is emitted and undefined
is returned.
If the SDM configuration contains a RemoteRepoRef as the value of
the sdm.configuration.sdm.k8s.options.sync.repo
option and truthy
credentials, those are returned.
Otherwise, the code cycles through all workspaces, querying cortex
for the information it needs. If the value of the sync.repo
option is a SyncRepoRef, each workspace is queried for a repo
matching the provided sync repo. If none is found, it cycles
through all the workspaces again querying for all SCM providers and
try to clone the repo with the provided credentials or, if no
credentials are provided, the SCM provider credentials from cortex.
Once a repo is found using either method, an object is returned
with its remote repo ref and the credentials able to clone it. In
addition, the sdm
passed in will have its
sdm.configuration.sdm.k8s.options.sync.repo
andsdm.configuration.sdm.k8s.options.sync.credentials
updated
with the objects appropriate objects.
this SDM object (modified if repo credentials found)
true if sync options set and repo found or false and sync options deleted
Query cortex across all available workspaces for repo.
For each SDM provider in cortex in each workspace, try to clone the sync repo. Return the information for the first successful clone.
Create RemoteRepoRef and Credentials object from SDM and repo from
cortex. If the provided repo does not contain an org with a
provider, it returns undefined
. Otherwise it uses the SCM
provider to call scmCredentials and return its value.
Create repo slug string.
Given the SDM and an SCM, use the configured repo ref resolver to
create a RemoteRepoRef. Use the SDM Kubernetes option sync
credentials or SCM credential.secret
to create the credentials,
giving the SDM sync credentials preference. Return undefined
if
there is not enough information to created the repo credential
object.
Extract the Kubernetes option sync repo from the SDM configuration. This function should only be called if the sync repo object is defined.
Generated using TypeDoc
See if provided sync repo is a RemoteRepoRef.