Documentation
¶
Index ¶
- func AreCommitStatusesPassing(commitStatuses []promoterv1alpha1.ChangeRequestPolicyCommitStatusPhase) bool
- func GetChangeTransferPolicyName(promotionStrategyName, environmentBranch string) string
- func GetEnvironmentByBranch(promotionStrategy promoterv1alpha1.PromotionStrategy, branch string) (int, *promoterv1alpha1.Environment)
- func GetGitRepositoryFromObjectKey(ctx context.Context, k8sClient client.Client, objectKey client.ObjectKey) (*promoterv1alpha1.GitRepository, error)
- func GetPullRequestName(repoOwner, repoName, pcProposedBranch, pcActiveBranch string) string
- func GetScheme() *runtime.Scheme
- func GetScmProviderAndSecretFromRepositoryReference(ctx context.Context, k8sClient client.Client, controllerNamespace string, ...) (promoterv1alpha1.GenericScmProvider, *v1.Secret, error)
- func GetScmProviderFromGitRepository(ctx context.Context, k8sClient client.Client, ...) (promoterv1alpha1.GenericScmProvider, error)
- func HandleReconciliationResult(ctx context.Context, startTime time.Time, obj StatusConditionUpdater, ...)
- func InheritNotReadyConditionFromObjects[T StatusConditionUpdater](parent StatusConditionUpdater, notReadyReason promoterConditions.CommonReason, ...)
- func KubeSafeLabel(name string) string
- func KubeSafeUniqueName(ctx context.Context, name string) string
- func RenderStringTemplate(templateStr string, data any, options ...string) (string, error)
- func TruncateString(str string, length int) string
- func TruncateStringFromBeginning(str string, length int) string
- func UpsertChangeTransferPolicy(policies []promoterv1alpha1.ChangeTransferPolicy, ...) []promoterv1alpha1.ChangeTransferPolicy
- func UpsertChangeTransferPolicyList(slice []promoterv1alpha1.ChangeTransferPolicy, ...) []promoterv1alpha1.ChangeTransferPolicy
- type StatusConditionUpdater
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AreCommitStatusesPassing ¶ added in v0.6.0
func AreCommitStatusesPassing(commitStatuses []promoterv1alpha1.ChangeRequestPolicyCommitStatusPhase) bool
AreCommitStatusesPassing checks if all commit statuses in the provided slice are in the success phase.
func GetChangeTransferPolicyName ¶
GetChangeTransferPolicyName returns a name for the ChangeTransferPolicy based on the promotion strategy name and environment branch.
func GetEnvironmentByBranch ¶
func GetEnvironmentByBranch(promotionStrategy promoterv1alpha1.PromotionStrategy, branch string) (int, *promoterv1alpha1.Environment)
GetEnvironmentByBranch returns the index and the Environment object for a given branch in the PromotionStrategy.
func GetGitRepositoryFromObjectKey ¶ added in v0.1.0
func GetGitRepositoryFromObjectKey(ctx context.Context, k8sClient client.Client, objectKey client.ObjectKey) (*promoterv1alpha1.GitRepository, error)
GetGitRepositoryFromObjectKey returns the GitRepository object from the repository reference
func GetPullRequestName ¶
GetPullRequestName returns a name for the pull request based on the repository owner, repository name, proposed branch, and active branch. This combination should make the PR name unique.
func GetScheme ¶ added in v0.10.0
GetScheme returns a scheme with all the necessary types added to it. This is used to use same scheme in both controller and test suite.
func GetScmProviderAndSecretFromRepositoryReference ¶
func GetScmProviderAndSecretFromRepositoryReference(ctx context.Context, k8sClient client.Client, controllerNamespace string, repositoryRef promoterv1alpha1.ObjectReference, obj metav1.Object) (promoterv1alpha1.GenericScmProvider, *v1.Secret, error)
GetScmProviderAndSecretFromRepositoryReference retrieves the ScmProvider and its associated Secret from a GitRepository reference.
func GetScmProviderFromGitRepository ¶
func GetScmProviderFromGitRepository(ctx context.Context, k8sClient client.Client, repositoryRef *promoterv1alpha1.GitRepository, obj metav1.Object) (promoterv1alpha1.GenericScmProvider, error)
GetScmProviderFromGitRepository retrieves the ScmProvider from the GitRepository reference.
func HandleReconciliationResult ¶ added in v0.8.0
func HandleReconciliationResult( ctx context.Context, startTime time.Time, obj StatusConditionUpdater, client client.Client, recorder record.EventRecorder, err *error, )
HandleReconciliationResult handles reconciliation results for any object with status conditions.
func InheritNotReadyConditionFromObjects ¶ added in v0.13.0
func InheritNotReadyConditionFromObjects[T StatusConditionUpdater](parent StatusConditionUpdater, notReadyReason promoterConditions.CommonReason, childObjs ...T)
InheritNotReadyConditionFromObjects sets the Ready condition of the parent to False if any of the child objects are not ready. This will override any existing Ready condition on the parent.
All child objects must be non-nil.
func KubeSafeLabel ¶
KubeSafeLabel Creates a safe label buy truncating from the beginning of 'name' to a max of 63 characters, if the name starts with a hyphen it will be removed. We truncate from beginning so that we can keep the unique hash at the end of the name.
func KubeSafeUniqueName ¶
KubeSafeUniqueName Creates a safe name by replacing all non-alphanumeric characters with a hyphen and truncating to a max of 255 characters, then appending a hash of the name.
func RenderStringTemplate ¶ added in v0.1.0
RenderStringTemplate renders a string template with the provided data.
func TruncateString ¶
TruncateString truncates a string to a specified length. If the length is less than or equal to 0, it returns an empty string.
func TruncateStringFromBeginning ¶
TruncateStringFromBeginning truncates from front of string. For example, if the string is "abcdefg" and length is 3, it will return "efg".
func UpsertChangeTransferPolicy ¶
func UpsertChangeTransferPolicy(policies []promoterv1alpha1.ChangeTransferPolicy, policy promoterv1alpha1.ChangeTransferPolicy) []promoterv1alpha1.ChangeTransferPolicy
UpsertChangeTransferPolicy adds or updates a ChangeTransferPolicy in the slice.
func UpsertChangeTransferPolicyList ¶
func UpsertChangeTransferPolicyList(slice []promoterv1alpha1.ChangeTransferPolicy, insertList ...[]promoterv1alpha1.ChangeTransferPolicy) []promoterv1alpha1.ChangeTransferPolicy
UpsertChangeTransferPolicyList adds or updates a list of ChangeTransferPolicies in the slice.