Documentation ¶
Overview ¶
Copyright 2024 F. Hoffmann-La Roche AG
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright 2024 F. Hoffmann-La Roche AG
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright 2024 F. Hoffmann-La Roche AG
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Index ¶
- func Execute()
- func GetBranchesAndTagsFromRemote(repository *git.Repository, remoteName string, listOptions *git.ListOptions, ...) ([]string, []string, error)
- func GetCloneOptions(source string, sourceAuth Authentication) *git.CloneOptions
- func GetDestinationAuth(destAuth Authentication) *githttp.BasicAuth
- func GetFetchOptions(refSpec string, sourceAuth Authentication) *git.FetchOptions
- func GetListOptions(sourceAuth Authentication) *git.ListOptions
- func GitFetchBranches(sourceRemote *git.Remote, sourceAuthentication Authentication, ...) error
- func GitPlainClone(gitDirectory string, cloneOptions *git.CloneOptions, repositoryName string) (*git.Repository, error)
- func ListRemote(remote *git.Remote, listOptions *git.ListOptions, repository string) ([]*gitplumbing.Reference, error)
- func MirrorRepositories(repos []RepositoryPair)
- func MirrorRepository(messages chan MirrorStatus, source, destination string, ...)
- func ProcessError(err error, activity string, url string, allErrors *[]string)
- func PushRefs(repository *git.Repository, auth *githttp.BasicAuth, refSpecString string, ...) error
- func SetRepositoryAuth(repositories *[]RepositoryPair, defaultSettings RepositoryPair)
- func ValidateRepositories(repositories []RepositoryPair)
- type Authentication
- type MirrorStatus
- type Repository
- type RepositoryPair
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetBranchesAndTagsFromRemote ¶
func GetBranchesAndTagsFromRemote(repository *git.Repository, remoteName string, listOptions *git.ListOptions, sourceRepository string) ([]string, []string, error)
GetBranchesAndTagsFromRemote returns list of branches and tags present in remoteName of repository.
func GetCloneOptions ¶
func GetCloneOptions(source string, sourceAuth Authentication) *git.CloneOptions
GetCloneOptions returns clone options for source repository.
func GetDestinationAuth ¶
func GetDestinationAuth(destAuth Authentication) *githttp.BasicAuth
GetDestionationAuth returns authentication struct for destination git repository.
func GetFetchOptions ¶
func GetFetchOptions(refSpec string, sourceAuth Authentication) *git.FetchOptions
GetFetchOptions returns fetch options for source repository.
func GetListOptions ¶
func GetListOptions(sourceAuth Authentication) *git.ListOptions
GetListOptions returns list options for source repository.
func GitFetchBranches ¶ added in v0.0.2
func GitFetchBranches(sourceRemote *git.Remote, sourceAuthentication Authentication, repositoryName string) error
GitFetchBranches fetches all branches and is retried in case of error.
func GitPlainClone ¶ added in v0.0.2
func GitPlainClone(gitDirectory string, cloneOptions *git.CloneOptions, repositoryName string) (*git.Repository, error)
GitPlainClone clones git repository and is retried in case of error.
func ListRemote ¶ added in v0.0.2
func ListRemote(remote *git.Remote, listOptions *git.ListOptions, repository string) ([]*gitplumbing.Reference, error)
func MirrorRepositories ¶
func MirrorRepositories(repos []RepositoryPair)
MirrorRepositories ensures that branches and tags from source repository are mirrored to the destination repository for each repositoryPair.
func MirrorRepository ¶
func MirrorRepository(messages chan MirrorStatus, source, destination string, sourceAuthentication, destinationAuthentication Authentication)
MirrorRepository mirrors branches and tags from source to destination. Tags and branches no longer present in source are removed from destination.
func ProcessError ¶
ProcessError formats err and appends it to allErrors.
func PushRefs ¶ added in v0.0.2
func PushRefs(repository *git.Repository, auth *githttp.BasicAuth, refSpecString string, repositoryName string) error
PushRefs pushes refs defined in refSpecString to destination remote and is retried in case of error.
func SetRepositoryAuth ¶
func SetRepositoryAuth(repositories *[]RepositoryPair, defaultSettings RepositoryPair)
SetRepositoryAuth ensures that repositories for which the authentication settings have not been overridden, use the default authentication settings from config file.
func ValidateRepositories ¶
func ValidateRepositories(repositories []RepositoryPair)
ValidateRepositories checks for common issues with input repository data from config file.
Types ¶
type Authentication ¶
type MirrorStatus ¶
type Repository ¶
type Repository struct { RepositoryURL string `mapstructure:"repo"` Auth Authentication `mapstructure:"auth"` }
type RepositoryPair ¶
type RepositoryPair struct { Source Repository `mapstructure:"source"` Destination Repository `mapstructure:"destination"` }