diff --git a/gitops-promoter/crds/crds.yaml b/gitops-promoter/crds/crds.yaml index 769c7830..514a6f45 100644 --- a/gitops-promoter/crds/crds.yaml +++ b/gitops-promoter/crds/crds.yaml @@ -15,7 +15,7 @@ spec: versions: - additionalPrinterColumns: - jsonPath: .spec.promotionStrategyRef.name - name: Strategy + name: PromotionStrategy priority: 1 type: string - jsonPath: .status.conditions[?(@.type=="Ready")].status @@ -519,6 +519,65 @@ spec: description: Subject is the subject line of the commit message type: string type: object + note: + description: Note is the hydrator metadata from the git note attached to the hydrated commit. + properties: + author: + description: Author is the author of the dry commit that was used to hydrate the branch. + type: string + body: + description: Body is the body of the dry commit that was used to hydrate the branch without the subject. + type: string + date: + description: Date is the date of the dry commit that was used to hydrate the branch. + format: date-time + type: string + drySha: + description: DrySha is the SHA of the commit that was used as the dry source for hydration. + type: string + references: + description: References are the references to other commits, that went into the hydration of the branch. + items: + description: |- + RevisionReference contains a reference to a some information that is related in some way to another commit. For now, + it supports only references to a commit. In the future, it may support other types of references. + properties: + commit: + description: Commit contains metadata about the commit that is related in some way to another commit. + properties: + author: + description: Author is the author of the commit. + type: string + body: + description: Body is the body of the commit message, excluding the subject line, i.e. `git show --format=%b`. + type: string + date: + description: Date is the date of the commit, formatted as by `git show -s --format=%aI`. + format: date-time + type: string + repoURL: + description: RepoURL is the URL of the repository where the commit is located. + pattern: ^(https?://.*)?$ + type: string + x-kubernetes-validations: + - message: must be a valid URL + rule: self == '' || isURL(self) + sha: + description: Sha is the commit hash. + type: string + subject: + description: Subject is the subject line of the commit message, i.e. `git show --format=%s`. + type: string + type: object + type: object + type: array + repoURL: + description: RepoURL is the URL of the repository where the commit is located. + type: string + subject: + description: Subject is the subject line of the dry commit that was used to hydrate the branch. + type: string + type: object type: object conditions: description: Conditions Represents the observations of the current state. @@ -751,6 +810,65 @@ spec: description: Subject is the subject line of the commit message type: string type: object + note: + description: Note is the hydrator metadata from the git note attached to the hydrated commit. + properties: + author: + description: Author is the author of the dry commit that was used to hydrate the branch. + type: string + body: + description: Body is the body of the dry commit that was used to hydrate the branch without the subject. + type: string + date: + description: Date is the date of the dry commit that was used to hydrate the branch. + format: date-time + type: string + drySha: + description: DrySha is the SHA of the commit that was used as the dry source for hydration. + type: string + references: + description: References are the references to other commits, that went into the hydration of the branch. + items: + description: |- + RevisionReference contains a reference to a some information that is related in some way to another commit. For now, + it supports only references to a commit. In the future, it may support other types of references. + properties: + commit: + description: Commit contains metadata about the commit that is related in some way to another commit. + properties: + author: + description: Author is the author of the commit. + type: string + body: + description: Body is the body of the commit message, excluding the subject line, i.e. `git show --format=%b`. + type: string + date: + description: Date is the date of the commit, formatted as by `git show -s --format=%aI`. + format: date-time + type: string + repoURL: + description: RepoURL is the URL of the repository where the commit is located. + pattern: ^(https?://.*)?$ + type: string + x-kubernetes-validations: + - message: must be a valid URL + rule: self == '' || isURL(self) + sha: + description: Sha is the commit hash. + type: string + subject: + description: Subject is the subject line of the commit message, i.e. `git show --format=%s`. + type: string + type: object + type: object + type: array + repoURL: + description: RepoURL is the URL of the repository where the commit is located. + type: string + subject: + description: Subject is the subject line of the dry commit that was used to hydrate the branch. + type: string + type: object type: object proposed: description: Proposed is the state of the proposed branch at the time the PR was merged. @@ -1048,6 +1166,65 @@ spec: description: Subject is the subject line of the commit message type: string type: object + note: + description: Note is the hydrator metadata from the git note attached to the hydrated commit. + properties: + author: + description: Author is the author of the dry commit that was used to hydrate the branch. + type: string + body: + description: Body is the body of the dry commit that was used to hydrate the branch without the subject. + type: string + date: + description: Date is the date of the dry commit that was used to hydrate the branch. + format: date-time + type: string + drySha: + description: DrySha is the SHA of the commit that was used as the dry source for hydration. + type: string + references: + description: References are the references to other commits, that went into the hydration of the branch. + items: + description: |- + RevisionReference contains a reference to a some information that is related in some way to another commit. For now, + it supports only references to a commit. In the future, it may support other types of references. + properties: + commit: + description: Commit contains metadata about the commit that is related in some way to another commit. + properties: + author: + description: Author is the author of the commit. + type: string + body: + description: Body is the body of the commit message, excluding the subject line, i.e. `git show --format=%b`. + type: string + date: + description: Date is the date of the commit, formatted as by `git show -s --format=%aI`. + format: date-time + type: string + repoURL: + description: RepoURL is the URL of the repository where the commit is located. + pattern: ^(https?://.*)?$ + type: string + x-kubernetes-validations: + - message: must be a valid URL + rule: self == '' || isURL(self) + sha: + description: Sha is the commit hash. + type: string + subject: + description: Subject is the subject line of the commit message, i.e. `git show --format=%s`. + type: string + type: object + type: object + type: array + repoURL: + description: RepoURL is the URL of the repository where the commit is located. + type: string + subject: + description: Subject is the subject line of the dry commit that was used to hydrate the branch. + type: string + type: object type: object pullRequest: description: PullRequest is the state of the pull request that was created for this ChangeTransferPolicy. @@ -1133,6 +1310,9 @@ spec: spec: description: ScmProviderSpec defines the desired state of ScmProvider properties: + bitbucketCloud: + description: BitbucketCloud required configuration for Bitbucket Cloud as the SCM provider + type: object fake: description: Fake required configuration for Fake as the SCM provider properties: @@ -1202,8 +1382,8 @@ spec: x-kubernetes-map-type: atomic type: object x-kubernetes-validations: - - message: exactly one of the fields in [github gitlab forgejo fake] must be set - rule: '[has(self.github),has(self.gitlab),has(self.forgejo),has(self.fake)].filter(x,x==true).size() == 1' + - message: exactly one of the fields in [github gitlab forgejo bitbucketCloud fake] must be set + rule: '[has(self.github),has(self.gitlab),has(self.forgejo),has(self.bitbucketCloud),has(self.fake)].filter(x,x==true).size() == 1' status: description: ScmProviderStatus defines the observed state of ScmProvider properties: @@ -1343,6 +1523,7 @@ spec: - name type: object name: + minLength: 1 type: string phase: default: pending @@ -2100,14 +2281,14 @@ spec: required: - workQueue type: object - promotionStrategy: + gitCommitStatus: description: |- - PromotionStrategy contains the configuration for the PromotionStrategy controller, + GitCommitStatus contains the configuration for the GitCommitStatus controller, including WorkQueue settings that control reconciliation behavior. properties: workQueue: description: |- - WorkQueue contains the work queue configuration for the PromotionStrategy controller. + WorkQueue contains the work queue configuration for the GitCommitStatus controller. This includes requeue duration, maximum concurrent reconciles, and rate limiter settings. properties: maxConcurrentReconciles: @@ -2296,33 +2477,14 @@ spec: required: - workQueue type: object - pullRequest: + promotionStrategy: description: |- - PullRequest contains the configuration for the PullRequest controller, - including WorkQueue settings and pull request template configuration. + PromotionStrategy contains the configuration for the PromotionStrategy controller, + including WorkQueue settings that control reconciliation behavior. properties: - template: - description: |- - Template is the template configuration used to generate pull request titles and descriptions. - Uses Go template syntax with Sprig functions available. - properties: - description: - description: |- - Description is the template used to generate the body/description of the pull request. - Uses Go template syntax with Sprig functions available for string manipulation. - type: string - title: - description: |- - Title is the template used to generate the title of the pull request. - Uses Go template syntax with Sprig functions available for string manipulation. - type: string - required: - - description - - title - type: object workQueue: description: |- - WorkQueue contains the work queue configuration for the PullRequest controller. + WorkQueue contains the work queue configuration for the PromotionStrategy controller. This includes requeue duration, maximum concurrent reconciles, and rate limiter settings. properties: maxConcurrentReconciles: @@ -2509,17 +2671,35 @@ spec: - requeueDuration type: object required: - - template - workQueue type: object - timedCommitStatus: + pullRequest: description: |- - TimedCommitStatus contains the configuration for the TimedCommitStatus controller, - including WorkQueue settings that control reconciliation behavior. + PullRequest contains the configuration for the PullRequest controller, + including WorkQueue settings and pull request template configuration. properties: + template: + description: |- + Template is the template configuration used to generate pull request titles and descriptions. + Uses Go template syntax with Sprig functions available. + properties: + description: + description: |- + Description is the template used to generate the body/description of the pull request. + Uses Go template syntax with Sprig functions available for string manipulation. + type: string + title: + description: |- + Title is the template used to generate the title of the pull request. + Uses Go template syntax with Sprig functions available for string manipulation. + type: string + required: + - description + - title + type: object workQueue: description: |- - WorkQueue contains the work queue configuration for the TimedCommitStatus controller. + WorkQueue contains the work queue configuration for the PullRequest controller. This includes requeue duration, maximum concurrent reconciles, and rate limiter settings. properties: maxConcurrentReconciles: @@ -2706,59 +2886,551 @@ spec: - requeueDuration type: object required: + - template - workQueue type: object - required: - - argocdCommitStatus - - changeTransferPolicy - - commitStatus - - promotionStrategy - - pullRequest - - timedCommitStatus - type: object - status: - description: |- - ControllerConfigurationStatus defines the observed state of ControllerConfiguration. - - Currently, this resource does not maintain any status information as it is a configuration-only - resource. Status fields may be added in the future to track configuration validation or - controller health metrics. - type: object - type: object - served: true - storage: true - subresources: - status: {} ---- -apiVersion: apiextensions.k8s.io/v1 -kind: CustomResourceDefinition -metadata: - annotations: - controller-gen.kubebuilder.io/version: v0.19.0 - name: gitrepositories.promoter.argoproj.io -spec: - group: promoter.argoproj.io - names: - kind: GitRepository - listKind: GitRepositoryList - plural: gitrepositories - singular: gitrepository - scope: Namespaced - versions: - - additionalPrinterColumns: - - jsonPath: .spec.scmProviderRef.name - name: Provider - type: string - - jsonPath: .status.conditions[?(@.type=="Ready")].status - name: Ready - type: string - name: v1alpha1 - schema: - openAPIV3Schema: - description: GitRepository is the Schema for the gitrepositories API - properties: - apiVersion: - description: |- + timedCommitStatus: + description: |- + TimedCommitStatus contains the configuration for the TimedCommitStatus controller, + including WorkQueue settings that control reconciliation behavior. + properties: + workQueue: + description: |- + WorkQueue contains the work queue configuration for the TimedCommitStatus controller. + This includes requeue duration, maximum concurrent reconciles, and rate limiter settings. + properties: + maxConcurrentReconciles: + description: |- + MaxConcurrentReconciles defines the maximum number of concurrent reconcile operations + that can run for this controller. Higher values increase throughput but consume more + resources. Must be at least 1. + type: integer + rateLimiter: + description: |- + RateLimiter defines the rate limiting strategy for the controller's work queue. + Rate limiting controls how quickly failed reconciliations are retried and helps + prevent overwhelming external APIs or systems. + properties: + bucket: + description: |- + Bucket rate limiter uses a token bucket algorithm to control request rate. + Allows bursts while maintaining an average rate limit. + properties: + bucket: + description: |- + Bucket is the maximum number of tokens that can be accumulated in the bucket. + This defines the maximum burst size - how many operations can occur in rapid + succession before rate limiting takes effect. Must be non-negative. + type: integer + qps: + description: |- + Qps (queries per second) is the rate at which tokens are added to the bucket. + This defines the sustained rate limit for operations. Must be non-negative. + type: integer + required: + - bucket + - qps + type: object + exponentialFailure: + description: |- + ExponentialFailure rate limiter increases delay exponentially with each failure. + Standard approach for backing off when operations fail repeatedly. + properties: + baseDelay: + description: |- + BaseDelay is the initial delay after the first failure. Subsequent failures will exponentially + increase this delay (2x, 4x, 8x, etc.) until MaxDelay is reached. + Format follows Go's time.Duration syntax (e.g., "1s" for 1 second). + type: string + maxDelay: + description: |- + MaxDelay is the maximum delay between retry attempts. Once the exponential backoff reaches + this value, all subsequent retries will use this delay. + Format follows Go's time.Duration syntax (e.g., "1m" for 1 minute). + type: string + required: + - baseDelay + - maxDelay + type: object + fastSlow: + description: |- + FastSlow rate limiter provides fast retries initially, then switches to slow retries. + Useful for quickly retrying transient errors while backing off for persistent failures. + properties: + fastDelay: + description: |- + FastDelay is the delay used for the first MaxFastAttempts retry attempts. + Format follows Go's time.Duration syntax (e.g., "100ms" for 100 milliseconds). + type: string + maxFastAttempts: + description: |- + MaxFastAttempts is the number of retry attempts that use FastDelay before switching to SlowDelay. + Must be at least 1. + type: integer + slowDelay: + description: |- + SlowDelay is the delay used for retry attempts after MaxFastAttempts have been exhausted. + Format follows Go's time.Duration syntax (e.g., "10s" for 10 seconds). + type: string + required: + - fastDelay + - maxFastAttempts + - slowDelay + type: object + maxOf: + description: |- + MaxOf allows combining multiple rate limiters, where the maximum delay from all + limiters is used. This enables sophisticated rate limiting that respects multiple + constraints simultaneously (e.g., both per-item exponential backoff and global rate limits). + items: + description: |- + RateLimiterTypes defines the different algorithms available for rate limiting. + + Exactly one of the three rate limiter types must be specified: + - FastSlow: Quick retry for transient errors, then slower retry for persistent failures + - ExponentialFailure: Standard exponential backoff for repeated failures + - Bucket: Token bucket algorithm for controlling overall request rate + + See https://pkg.go.dev/k8s.io/client-go/util/workqueue for implementation details. + properties: + bucket: + description: |- + Bucket rate limiter uses a token bucket algorithm to control request rate. + Allows bursts while maintaining an average rate limit. + properties: + bucket: + description: |- + Bucket is the maximum number of tokens that can be accumulated in the bucket. + This defines the maximum burst size - how many operations can occur in rapid + succession before rate limiting takes effect. Must be non-negative. + type: integer + qps: + description: |- + Qps (queries per second) is the rate at which tokens are added to the bucket. + This defines the sustained rate limit for operations. Must be non-negative. + type: integer + required: + - bucket + - qps + type: object + exponentialFailure: + description: |- + ExponentialFailure rate limiter increases delay exponentially with each failure. + Standard approach for backing off when operations fail repeatedly. + properties: + baseDelay: + description: |- + BaseDelay is the initial delay after the first failure. Subsequent failures will exponentially + increase this delay (2x, 4x, 8x, etc.) until MaxDelay is reached. + Format follows Go's time.Duration syntax (e.g., "1s" for 1 second). + type: string + maxDelay: + description: |- + MaxDelay is the maximum delay between retry attempts. Once the exponential backoff reaches + this value, all subsequent retries will use this delay. + Format follows Go's time.Duration syntax (e.g., "1m" for 1 minute). + type: string + required: + - baseDelay + - maxDelay + type: object + fastSlow: + description: |- + FastSlow rate limiter provides fast retries initially, then switches to slow retries. + Useful for quickly retrying transient errors while backing off for persistent failures. + properties: + fastDelay: + description: |- + FastDelay is the delay used for the first MaxFastAttempts retry attempts. + Format follows Go's time.Duration syntax (e.g., "100ms" for 100 milliseconds). + type: string + maxFastAttempts: + description: |- + MaxFastAttempts is the number of retry attempts that use FastDelay before switching to SlowDelay. + Must be at least 1. + type: integer + slowDelay: + description: |- + SlowDelay is the delay used for retry attempts after MaxFastAttempts have been exhausted. + Format follows Go's time.Duration syntax (e.g., "10s" for 10 seconds). + type: string + required: + - fastDelay + - maxFastAttempts + - slowDelay + type: object + type: object + x-kubernetes-validations: + - message: at most one of the fields in [fastSlow exponentialFailure bucket] may be set + rule: '[has(self.fastSlow),has(self.exponentialFailure),has(self.bucket)].filter(x,x==true).size() <= 1' + maxItems: 3 + type: array + type: object + x-kubernetes-validations: + - message: at most one of the fields in [fastSlow exponentialFailure bucket maxOf] may be set + rule: '[has(self.fastSlow),has(self.exponentialFailure),has(self.bucket),has(self.maxOf)].filter(x,x==true).size() <= 1' + - message: at most one of the fields in [fastSlow exponentialFailure bucket] may be set + rule: '[has(self.fastSlow),has(self.exponentialFailure),has(self.bucket)].filter(x,x==true).size() <= 1' + requeueDuration: + description: |- + RequeueDuration specifies how frequently resources should be requeued for automatic reconciliation. + This creates a periodic reconciliation loop that ensures the desired state is maintained even + without external triggers. Format follows Go's time.Duration syntax (e.g., "5m" for 5 minutes). + type: string + required: + - maxConcurrentReconciles + - rateLimiter + - requeueDuration + type: object + required: + - workQueue + type: object + required: + - argocdCommitStatus + - changeTransferPolicy + - commitStatus + - gitCommitStatus + - promotionStrategy + - pullRequest + - timedCommitStatus + type: object + status: + description: |- + ControllerConfigurationStatus defines the observed state of ControllerConfiguration. + + Currently, this resource does not maintain any status information as it is a configuration-only + resource. Status fields may be added in the future to track configuration validation or + controller health metrics. + type: object + type: object + served: true + storage: true + subresources: + status: {} +--- +apiVersion: apiextensions.k8s.io/v1 +kind: CustomResourceDefinition +metadata: + annotations: + controller-gen.kubebuilder.io/version: v0.19.0 + name: gitcommitstatuses.promoter.argoproj.io +spec: + group: promoter.argoproj.io + names: + kind: GitCommitStatus + listKind: GitCommitStatusList + plural: gitcommitstatuses + singular: gitcommitstatus + scope: Namespaced + versions: + - additionalPrinterColumns: + - jsonPath: .spec.key + name: Key + type: string + - jsonPath: .spec.promotionStrategyRef.name + name: PromotionStrategy + type: string + - jsonPath: .spec.target + name: Validates + type: string + - jsonPath: .status.conditions[?(@.type=="Ready")].status + name: Ready + type: string + name: v1alpha1 + schema: + openAPIV3Schema: + description: |- + GitCommitStatus is the Schema for the gitcommitstatuses API. + + It validates commits from PromotionStrategy environments using configurable expressions + and creates CommitStatus resources with the validation results. + + Use the Target field to control which commit is validated: + - "active" (default): Validates the currently deployed commit + - "proposed": Validates the incoming commit + + The validation result is always reported on the PROPOSED commit to enable promotion gating, + regardless of which commit was validated. + + Workflow: + 1. Controller reads PromotionStrategy to get ProposedHydratedSha and ActiveHydratedSha + 2. Controller selects SHA to validate based on Target field + 3. Controller fetches commit data (subject, body, author, trailers) for selected SHA + 4. Controller evaluates expression against selected commit data + 5. Controller creates/updates CommitStatus with result attached to PROPOSED SHA + 6. PromotionStrategy checks CommitStatus on PROPOSED SHA before allowing promotion + + Common use cases: + - "Ensure active commit is not a revert before promoting" + properties: + apiVersion: + description: |- + APIVersion defines the versioned schema of this representation of an object. + Servers should convert recognized schemas to the latest internal value, and + may reject unrecognized values. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources + type: string + kind: + description: |- + Kind is a string value representing the REST resource this object represents. + Servers may infer this from the endpoint the client submits requests to. + Cannot be updated. + In CamelCase. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds + type: string + metadata: + type: object + spec: + description: spec defines the desired state of GitCommitStatus + properties: + description: + description: |- + Description is a human-readable description of this validation that will be shown in the SCM provider + (GitHub, GitLab, etc.) as the commit status description. + If not specified, defaults to empty string. + type: string + expression: + description: |- + Expression is evaluated using the expr library (github.com/expr-lang/expr) against commit data + for environments in the referenced PromotionStrategy. + The expression must return a boolean value where true indicates the validation passed. + + The commit validated is determined by the Target field: + - "active" (default): Validates the ACTIVE (currently deployed) commit + - "proposed": Validates the PROPOSED commit (what will be promoted) + + The validation result is always reported on the PROPOSED commit to enable promotion gating. + + Use Cases by Mode: + Active mode: State-based gating - validate current environment before allowing promotion + - "Don't promote until active commit has required sign-offs" + - "Verify current deployment meets compliance before next promotion" + - "Ensure active commit is not a revert before promoting" + + Proposed mode: Change-based gating - validate the incoming change itself + - "Don't promote unless new commit follows naming convention" + - "Ensure proposed commit has proper JIRA ticket reference" + - "Require specific author for proposed changes" + + Available variables in the expression context: + - Commit.SHA (string): the commit SHA being validated (active or proposed based on Target) + - Commit.Subject (string): the first line of the commit message + - Commit.Body (string): the commit message body (everything after the subject line) + - Commit.Author (string): commit author email address + - Commit.Trailers (map[string][]string): git trailers parsed from commit message + type: string + key: + description: |- + Key is the unique identifier for this validation rule. + It is used as the commit status key and in status messages. + This key is matched against PromotionStrategy's proposedCommitStatuses or activeCommitStatuses + to determine which environments this validation applies to. + maxLength: 63 + minLength: 1 + pattern: ^[a-z0-9]([-a-z0-9]*[a-z0-9])?$ + type: string + promotionStrategyRef: + description: |- + PromotionStrategyRef is a reference to the promotion strategy that this commit status applies to. + The controller will validate commits from ALL environments in the referenced PromotionStrategy + where this GitCommitStatus.Spec.Key matches an entry in either: + - PromotionStrategy.Spec.ProposedCommitStatuses (applies to all environments), OR + - Environment.ProposedCommitStatuses (applies to specific environment) + properties: + name: + description: Name is the name of the object to refer to. + type: string + required: + - name + type: object + target: + default: active + description: |- + Target specifies which commit SHA to validate with the expression. + - "active": Validates the currently active/deployed commit (default behavior) + - "proposed": Validates the proposed commit that will be promoted + + The validation result is always reported on the PROPOSED commit (for gating), but this field + controls which commit's data is used in the expression evaluation. + + Examples: + target: "active" - "Don't promote if a revert commit is detected" + target: "proposed" - "Don't promote unless new commit follows naming convention" + enum: + - active + - proposed + type: string + required: + - expression + - key + - promotionStrategyRef + type: object + status: + description: status defines the observed state of GitCommitStatus + properties: + conditions: + description: |- + Conditions represent the latest available observations of the GitCommitStatus's state. + Standard condition types include "Ready" which aggregates the status of all environments. + items: + description: Condition contains details for one aspect of the current state of this API Resource. + properties: + lastTransitionTime: + description: |- + lastTransitionTime is the last time the condition transitioned from one status to another. + This should be when the underlying condition changed. If that is not known, then using the time when the API field changed is acceptable. + format: date-time + type: string + message: + description: |- + message is a human readable message indicating details about the transition. + This may be an empty string. + maxLength: 32768 + type: string + observedGeneration: + description: |- + observedGeneration represents the .metadata.generation that the condition was set based upon. + For instance, if .metadata.generation is currently 12, but the .status.conditions[x].observedGeneration is 9, the condition is out of date + with respect to the current state of the instance. + format: int64 + minimum: 0 + type: integer + reason: + description: |- + reason contains a programmatic identifier indicating the reason for the condition's last transition. + Producers of specific condition types may define expected values and meanings for this field, + and whether the values are considered a guaranteed API. + The value should be a CamelCase string. + This field may not be empty. + maxLength: 1024 + minLength: 1 + pattern: ^[A-Za-z]([A-Za-z0-9_,:]*[A-Za-z0-9_])?$ + type: string + status: + description: status of the condition, one of True, False, Unknown. + enum: + - "True" + - "False" + - Unknown + type: string + type: + description: type of condition in CamelCase or in foo.example.com/CamelCase. + maxLength: 316 + pattern: ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])$ + type: string + required: + - lastTransitionTime + - message + - reason + - status + - type + type: object + type: array + x-kubernetes-list-map-keys: + - type + x-kubernetes-list-type: map + environments: + description: |- + Environments holds the validation results for each environment where this validation applies. + Each entry corresponds to an environment from the PromotionStrategy where the Key matches + either global or environment-specific proposedCommitStatuses. + + The controller validates the commit specified by Target ("active" or "proposed") + but the CommitStatus is always reported on the PROPOSED commit for promotion gating. + Each environment entry tracks both the ProposedHydratedSha (where status is reported) and the + ActiveHydratedSha, with TargetedSha indicating which one was actually evaluated. + items: + description: GitCommitStatusEnvironmentStatus defines the observed validation status for a specific environment. + properties: + activeHydratedSha: + description: |- + ActiveHydratedSha is the currently active (deployed) hydrated commit SHA that was validated. + This comes from the PromotionStrategy's environment status. + The expression is evaluated against THIS commit's data, not the proposed commit. + May be empty if the PromotionStrategy hasn't reconciled yet. + type: string + branch: + description: Branch is the environment branch name being validated. + type: string + expressionResult: + description: |- + ExpressionResult contains the boolean result of the expression evaluation. + Only set when the expression successfully evaluates to a boolean. + nil indicates the expression has not yet been evaluated, failed to compile, or failed to evaluate. + type: boolean + phase: + description: |- + Phase represents the current validation state of the commit. + - "pending": validation has not completed, commit data is not yet available, or SHAs are empty + - "success": expression evaluated to true, validation passed + - "failure": expression evaluated to false, validation failed, or expression compilation failed + enum: + - pending + - success + - failure + type: string + proposedHydratedSha: + description: |- + ProposedHydratedSha is the proposed hydrated commit SHA where the validation result is reported. + This comes from the PromotionStrategy's environment status. + The CommitStatus resource is created with this SHA, allowing the PromotionStrategy to gate + promotions based on the validation of the ACTIVE commit. + May be empty if the PromotionStrategy hasn't reconciled yet. + type: string + targetedSha: + description: |- + TargetedSha is the commit SHA that was actually validated by the expression. + This will match either ProposedHydratedSha or ActiveHydratedSha depending on + the Target setting ("proposed" or "active"). + This field clarifies which commit's data was used in the expression evaluation. + type: string + required: + - branch + - phase + - proposedHydratedSha + type: object + type: array + x-kubernetes-list-map-keys: + - branch + x-kubernetes-list-type: map + type: object + required: + - spec + type: object + served: true + storage: true + subresources: + status: {} +--- +apiVersion: apiextensions.k8s.io/v1 +kind: CustomResourceDefinition +metadata: + annotations: + controller-gen.kubebuilder.io/version: v0.19.0 + name: gitrepositories.promoter.argoproj.io +spec: + group: promoter.argoproj.io + names: + kind: GitRepository + listKind: GitRepositoryList + plural: gitrepositories + singular: gitrepository + scope: Namespaced + versions: + - additionalPrinterColumns: + - jsonPath: .spec.scmProviderRef.name + name: Provider + type: string + - jsonPath: .status.conditions[?(@.type=="Ready")].status + name: Ready + type: string + name: v1alpha1 + schema: + openAPIV3Schema: + description: GitRepository is the Schema for the gitrepositories API + properties: + apiVersion: + description: |- APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. @@ -2777,6 +3449,23 @@ spec: spec: description: GitRepositorySpec defines the desired state of GitRepository properties: + bitbucketCloud: + description: BitbucketCloudRepo is a repository in Bitbucket Cloud, identified by its owner and name. + properties: + name: + description: Name is the name of the repository. + maxLength: 62 + pattern: ^[a-zA-Z0-9_.-]+$ + type: string + owner: + description: Owner is the owner of the repository (can be a user or workspace). + minLength: 1 + pattern: ^[a-zA-Z0-9_-]+$ + type: string + required: + - name + - owner + type: object fake: description: FakeRepo is a placeholder for a repository in the fake SCM provider, used for testing purposes. properties: @@ -2860,8 +3549,8 @@ spec: - scmProviderRef type: object x-kubernetes-validations: - - message: exactly one of the fields in [github gitlab forgejo fake] must be set - rule: '[has(self.github),has(self.gitlab),has(self.forgejo),has(self.fake)].filter(x,x==true).size() == 1' + - message: exactly one of the fields in [github gitlab forgejo bitbucketCloud fake] must be set + rule: '[has(self.github),has(self.gitlab),has(self.forgejo),has(self.bitbucketCloud),has(self.fake)].filter(x,x==true).size() == 1' status: description: GitRepositoryStatus defines the observed state of GitRepository properties: @@ -3329,6 +4018,65 @@ spec: description: Subject is the subject line of the commit message type: string type: object + note: + description: Note is the hydrator metadata from the git note attached to the hydrated commit. + properties: + author: + description: Author is the author of the dry commit that was used to hydrate the branch. + type: string + body: + description: Body is the body of the dry commit that was used to hydrate the branch without the subject. + type: string + date: + description: Date is the date of the dry commit that was used to hydrate the branch. + format: date-time + type: string + drySha: + description: DrySha is the SHA of the commit that was used as the dry source for hydration. + type: string + references: + description: References are the references to other commits, that went into the hydration of the branch. + items: + description: |- + RevisionReference contains a reference to a some information that is related in some way to another commit. For now, + it supports only references to a commit. In the future, it may support other types of references. + properties: + commit: + description: Commit contains metadata about the commit that is related in some way to another commit. + properties: + author: + description: Author is the author of the commit. + type: string + body: + description: Body is the body of the commit message, excluding the subject line, i.e. `git show --format=%b`. + type: string + date: + description: Date is the date of the commit, formatted as by `git show -s --format=%aI`. + format: date-time + type: string + repoURL: + description: RepoURL is the URL of the repository where the commit is located. + pattern: ^(https?://.*)?$ + type: string + x-kubernetes-validations: + - message: must be a valid URL + rule: self == '' || isURL(self) + sha: + description: Sha is the commit hash. + type: string + subject: + description: Subject is the subject line of the commit message, i.e. `git show --format=%s`. + type: string + type: object + type: object + type: array + repoURL: + description: RepoURL is the URL of the repository where the commit is located. + type: string + subject: + description: Subject is the subject line of the dry commit that was used to hydrate the branch. + type: string + type: object type: object branch: description: Branch is the name of the active branch for the environment. @@ -3505,6 +4253,65 @@ spec: description: Subject is the subject line of the commit message type: string type: object + note: + description: Note is the hydrator metadata from the git note attached to the hydrated commit. + properties: + author: + description: Author is the author of the dry commit that was used to hydrate the branch. + type: string + body: + description: Body is the body of the dry commit that was used to hydrate the branch without the subject. + type: string + date: + description: Date is the date of the dry commit that was used to hydrate the branch. + format: date-time + type: string + drySha: + description: DrySha is the SHA of the commit that was used as the dry source for hydration. + type: string + references: + description: References are the references to other commits, that went into the hydration of the branch. + items: + description: |- + RevisionReference contains a reference to a some information that is related in some way to another commit. For now, + it supports only references to a commit. In the future, it may support other types of references. + properties: + commit: + description: Commit contains metadata about the commit that is related in some way to another commit. + properties: + author: + description: Author is the author of the commit. + type: string + body: + description: Body is the body of the commit message, excluding the subject line, i.e. `git show --format=%b`. + type: string + date: + description: Date is the date of the commit, formatted as by `git show -s --format=%aI`. + format: date-time + type: string + repoURL: + description: RepoURL is the URL of the repository where the commit is located. + pattern: ^(https?://.*)?$ + type: string + x-kubernetes-validations: + - message: must be a valid URL + rule: self == '' || isURL(self) + sha: + description: Sha is the commit hash. + type: string + subject: + description: Subject is the subject line of the commit message, i.e. `git show --format=%s`. + type: string + type: object + type: object + type: array + repoURL: + description: RepoURL is the URL of the repository where the commit is located. + type: string + subject: + description: Subject is the subject line of the dry commit that was used to hydrate the branch. + type: string + type: object type: object proposed: description: Proposed is the state of the proposed branch at the time the PR was merged. @@ -3819,6 +4626,65 @@ spec: description: Subject is the subject line of the commit message type: string type: object + note: + description: Note is the hydrator metadata from the git note attached to the hydrated commit. + properties: + author: + description: Author is the author of the dry commit that was used to hydrate the branch. + type: string + body: + description: Body is the body of the dry commit that was used to hydrate the branch without the subject. + type: string + date: + description: Date is the date of the dry commit that was used to hydrate the branch. + format: date-time + type: string + drySha: + description: DrySha is the SHA of the commit that was used as the dry source for hydration. + type: string + references: + description: References are the references to other commits, that went into the hydration of the branch. + items: + description: |- + RevisionReference contains a reference to a some information that is related in some way to another commit. For now, + it supports only references to a commit. In the future, it may support other types of references. + properties: + commit: + description: Commit contains metadata about the commit that is related in some way to another commit. + properties: + author: + description: Author is the author of the commit. + type: string + body: + description: Body is the body of the commit message, excluding the subject line, i.e. `git show --format=%b`. + type: string + date: + description: Date is the date of the commit, formatted as by `git show -s --format=%aI`. + format: date-time + type: string + repoURL: + description: RepoURL is the URL of the repository where the commit is located. + pattern: ^(https?://.*)?$ + type: string + x-kubernetes-validations: + - message: must be a valid URL + rule: self == '' || isURL(self) + sha: + description: Sha is the commit hash. + type: string + subject: + description: Subject is the subject line of the commit message, i.e. `git show --format=%s`. + type: string + type: object + type: object + type: array + repoURL: + description: RepoURL is the URL of the repository where the commit is located. + type: string + subject: + description: Subject is the subject line of the dry commit that was used to hydrate the branch. + type: string + type: object type: object pullRequest: description: PullRequest is the state of the pull request that was created for this environment. @@ -3890,7 +4756,7 @@ spec: - jsonPath: .status.state name: State type: string - - jsonPath: .status.ID + - jsonPath: .status.id name: ID type: string - jsonPath: .spec.sourceBranch @@ -4186,6 +5052,9 @@ spec: spec: description: ScmProviderSpec defines the desired state of ScmProvider properties: + bitbucketCloud: + description: BitbucketCloud required configuration for Bitbucket Cloud as the SCM provider + type: object fake: description: Fake required configuration for Fake as the SCM provider properties: @@ -4255,8 +5124,8 @@ spec: x-kubernetes-map-type: atomic type: object x-kubernetes-validations: - - message: exactly one of the fields in [github gitlab forgejo fake] must be set - rule: '[has(self.github),has(self.gitlab),has(self.forgejo),has(self.fake)].filter(x,x==true).size() == 1' + - message: exactly one of the fields in [github gitlab forgejo bitbucketCloud fake] must be set + rule: '[has(self.github),has(self.gitlab),has(self.forgejo),has(self.bitbucketCloud),has(self.fake)].filter(x,x==true).size() == 1' status: description: ScmProviderStatus defines the observed state of ScmProvider properties: @@ -4343,7 +5212,7 @@ spec: versions: - additionalPrinterColumns: - jsonPath: .spec.promotionStrategyRef.name - name: Strategy + name: PromotionStrategy type: string - jsonPath: .status.conditions[?(@.type=="Ready")].status name: Ready diff --git a/gitops-promoter/kcl.mod b/gitops-promoter/kcl.mod index 8c46c138..ea74f23a 100644 --- a/gitops-promoter/kcl.mod +++ b/gitops-promoter/kcl.mod @@ -1,7 +1,7 @@ [package] name = "gitops-promoter" edition = "v0.11.2" -version = "v0.18.3" +version = "v0.19.1" [dependencies] k8s = "1.32.4" diff --git a/gitops-promoter/update.sh b/gitops-promoter/update.sh index ae821258..5190aa51 100755 --- a/gitops-promoter/update.sh +++ b/gitops-promoter/update.sh @@ -4,7 +4,7 @@ set -o errexit set -o nounset set -eoux pipefail -VERSION="v0.18.3" +VERSION="v0.19.1" rm -rf v* mkdir -p crds diff --git a/gitops-promoter/v1alpha1/promoter_argoproj_io_v1alpha1_change_transfer_policy.k b/gitops-promoter/v1alpha1/promoter_argoproj_io_v1alpha1_change_transfer_policy.k index 547f149d..724e137b 100644 --- a/gitops-promoter/v1alpha1/promoter_argoproj_io_v1alpha1_change_transfer_policy.k +++ b/gitops-promoter/v1alpha1/promoter_argoproj_io_v1alpha1_change_transfer_policy.k @@ -171,6 +171,8 @@ schema PromoterArgoprojIoV1alpha1ChangeTransferPolicyStatusActive: dry hydrated : PromoterArgoprojIoV1alpha1ChangeTransferPolicyStatusActiveHydrated, default is Undefined, optional hydrated + note : PromoterArgoprojIoV1alpha1ChangeTransferPolicyStatusActiveNote, default is Undefined, optional + note """ @@ -180,6 +182,8 @@ schema PromoterArgoprojIoV1alpha1ChangeTransferPolicyStatusActive: hydrated?: PromoterArgoprojIoV1alpha1ChangeTransferPolicyStatusActiveHydrated + note?: PromoterArgoprojIoV1alpha1ChangeTransferPolicyStatusActiveNote + schema PromoterArgoprojIoV1alpha1ChangeTransferPolicyStatusActiveCommitStatusesItems0: r""" @@ -400,6 +404,97 @@ schema PromoterArgoprojIoV1alpha1ChangeTransferPolicyStatusActiveHydratedReferen _regex_match(str(repoURL), r"^(https?://.*)?$") if repoURL +schema PromoterArgoprojIoV1alpha1ChangeTransferPolicyStatusActiveNote: + r""" + Note is the hydrator metadata from the git note attached to the hydrated commit. + + Attributes + ---------- + author : str, default is Undefined, optional + Author is the author of the dry commit that was used to hydrate the branch. + body : str, default is Undefined, optional + Body is the body of the dry commit that was used to hydrate the branch without the subject. + date : str, default is Undefined, optional + Date is the date of the dry commit that was used to hydrate the branch. + drySha : str, default is Undefined, optional + DrySha is the SHA of the commit that was used as the dry source for hydration. + references : [PromoterArgoprojIoV1alpha1ChangeTransferPolicyStatusActiveNoteReferencesItems0], default is Undefined, optional + References are the references to other commits, that went into the hydration of the branch. + repoURL : str, default is Undefined, optional + RepoURL is the URL of the repository where the commit is located. + subject : str, default is Undefined, optional + Subject is the subject line of the dry commit that was used to hydrate the branch. + """ + + + author?: str + + body?: str + + date?: str + + drySha?: str + + references?: [PromoterArgoprojIoV1alpha1ChangeTransferPolicyStatusActiveNoteReferencesItems0] + + repoURL?: str + + subject?: str + + +schema PromoterArgoprojIoV1alpha1ChangeTransferPolicyStatusActiveNoteReferencesItems0: + r""" + RevisionReference contains a reference to a some information that is related in some way to another commit. For now, + it supports only references to a commit. In the future, it may support other types of references. + + Attributes + ---------- + commit : PromoterArgoprojIoV1alpha1ChangeTransferPolicyStatusActiveNoteReferencesItems0Commit, default is Undefined, optional + commit + """ + + + commit?: PromoterArgoprojIoV1alpha1ChangeTransferPolicyStatusActiveNoteReferencesItems0Commit + + +schema PromoterArgoprojIoV1alpha1ChangeTransferPolicyStatusActiveNoteReferencesItems0Commit: + r""" + Commit contains metadata about the commit that is related in some way to another commit. + + Attributes + ---------- + author : str, default is Undefined, optional + Author is the author of the commit. + body : str, default is Undefined, optional + Body is the body of the commit message, excluding the subject line, i.e. `git show --format=%b`. + date : str, default is Undefined, optional + Date is the date of the commit, formatted as by `git show -s --format=%aI`. + repoURL : str, default is Undefined, optional + RepoURL is the URL of the repository where the commit is located. + sha : str, default is Undefined, optional + Sha is the commit hash. + subject : str, default is Undefined, optional + Subject is the subject line of the commit message, i.e. `git show --format=%s`. + """ + + + author?: str + + body?: str + + date?: str + + repoURL?: str + + sha?: str + + subject?: str + + + check: + _regex_match(str(repoURL), r"^(https?://.*)?$") if repoURL + + schema PromoterArgoprojIoV1alpha1ChangeTransferPolicyStatusConditionsItems0: r""" Condition contains details for one aspect of the current state of this API Resource. @@ -486,6 +581,8 @@ schema PromoterArgoprojIoV1alpha1ChangeTransferPolicyStatusHistoryItems0Active: dry hydrated : PromoterArgoprojIoV1alpha1ChangeTransferPolicyStatusHistoryItems0ActiveHydrated, default is Undefined, optional hydrated + note : PromoterArgoprojIoV1alpha1ChangeTransferPolicyStatusHistoryItems0ActiveNote, default is Undefined, optional + note """ @@ -495,6 +592,8 @@ schema PromoterArgoprojIoV1alpha1ChangeTransferPolicyStatusHistoryItems0Active: hydrated?: PromoterArgoprojIoV1alpha1ChangeTransferPolicyStatusHistoryItems0ActiveHydrated + note?: PromoterArgoprojIoV1alpha1ChangeTransferPolicyStatusHistoryItems0ActiveNote + schema PromoterArgoprojIoV1alpha1ChangeTransferPolicyStatusHistoryItems0ActiveCommitStatusesItems0: r""" @@ -715,6 +814,97 @@ schema PromoterArgoprojIoV1alpha1ChangeTransferPolicyStatusHistoryItems0ActiveHy _regex_match(str(repoURL), r"^(https?://.*)?$") if repoURL +schema PromoterArgoprojIoV1alpha1ChangeTransferPolicyStatusHistoryItems0ActiveNote: + r""" + Note is the hydrator metadata from the git note attached to the hydrated commit. + + Attributes + ---------- + author : str, default is Undefined, optional + Author is the author of the dry commit that was used to hydrate the branch. + body : str, default is Undefined, optional + Body is the body of the dry commit that was used to hydrate the branch without the subject. + date : str, default is Undefined, optional + Date is the date of the dry commit that was used to hydrate the branch. + drySha : str, default is Undefined, optional + DrySha is the SHA of the commit that was used as the dry source for hydration. + references : [PromoterArgoprojIoV1alpha1ChangeTransferPolicyStatusHistoryItems0ActiveNoteReferencesItems0], default is Undefined, optional + References are the references to other commits, that went into the hydration of the branch. + repoURL : str, default is Undefined, optional + RepoURL is the URL of the repository where the commit is located. + subject : str, default is Undefined, optional + Subject is the subject line of the dry commit that was used to hydrate the branch. + """ + + + author?: str + + body?: str + + date?: str + + drySha?: str + + references?: [PromoterArgoprojIoV1alpha1ChangeTransferPolicyStatusHistoryItems0ActiveNoteReferencesItems0] + + repoURL?: str + + subject?: str + + +schema PromoterArgoprojIoV1alpha1ChangeTransferPolicyStatusHistoryItems0ActiveNoteReferencesItems0: + r""" + RevisionReference contains a reference to a some information that is related in some way to another commit. For now, + it supports only references to a commit. In the future, it may support other types of references. + + Attributes + ---------- + commit : PromoterArgoprojIoV1alpha1ChangeTransferPolicyStatusHistoryItems0ActiveNoteReferencesItems0Commit, default is Undefined, optional + commit + """ + + + commit?: PromoterArgoprojIoV1alpha1ChangeTransferPolicyStatusHistoryItems0ActiveNoteReferencesItems0Commit + + +schema PromoterArgoprojIoV1alpha1ChangeTransferPolicyStatusHistoryItems0ActiveNoteReferencesItems0Commit: + r""" + Commit contains metadata about the commit that is related in some way to another commit. + + Attributes + ---------- + author : str, default is Undefined, optional + Author is the author of the commit. + body : str, default is Undefined, optional + Body is the body of the commit message, excluding the subject line, i.e. `git show --format=%b`. + date : str, default is Undefined, optional + Date is the date of the commit, formatted as by `git show -s --format=%aI`. + repoURL : str, default is Undefined, optional + RepoURL is the URL of the repository where the commit is located. + sha : str, default is Undefined, optional + Sha is the commit hash. + subject : str, default is Undefined, optional + Subject is the subject line of the commit message, i.e. `git show --format=%s`. + """ + + + author?: str + + body?: str + + date?: str + + repoURL?: str + + sha?: str + + subject?: str + + + check: + _regex_match(str(repoURL), r"^(https?://.*)?$") if repoURL + + schema PromoterArgoprojIoV1alpha1ChangeTransferPolicyStatusHistoryItems0Proposed: r""" Proposed is the state of the proposed branch at the time the PR was merged. @@ -907,6 +1097,8 @@ schema PromoterArgoprojIoV1alpha1ChangeTransferPolicyStatusProposed: dry hydrated : PromoterArgoprojIoV1alpha1ChangeTransferPolicyStatusProposedHydrated, default is Undefined, optional hydrated + note : PromoterArgoprojIoV1alpha1ChangeTransferPolicyStatusProposedNote, default is Undefined, optional + note """ @@ -916,6 +1108,8 @@ schema PromoterArgoprojIoV1alpha1ChangeTransferPolicyStatusProposed: hydrated?: PromoterArgoprojIoV1alpha1ChangeTransferPolicyStatusProposedHydrated + note?: PromoterArgoprojIoV1alpha1ChangeTransferPolicyStatusProposedNote + schema PromoterArgoprojIoV1alpha1ChangeTransferPolicyStatusProposedCommitStatusesItems0: r""" @@ -1136,6 +1330,97 @@ schema PromoterArgoprojIoV1alpha1ChangeTransferPolicyStatusProposedHydratedRefer _regex_match(str(repoURL), r"^(https?://.*)?$") if repoURL +schema PromoterArgoprojIoV1alpha1ChangeTransferPolicyStatusProposedNote: + r""" + Note is the hydrator metadata from the git note attached to the hydrated commit. + + Attributes + ---------- + author : str, default is Undefined, optional + Author is the author of the dry commit that was used to hydrate the branch. + body : str, default is Undefined, optional + Body is the body of the dry commit that was used to hydrate the branch without the subject. + date : str, default is Undefined, optional + Date is the date of the dry commit that was used to hydrate the branch. + drySha : str, default is Undefined, optional + DrySha is the SHA of the commit that was used as the dry source for hydration. + references : [PromoterArgoprojIoV1alpha1ChangeTransferPolicyStatusProposedNoteReferencesItems0], default is Undefined, optional + References are the references to other commits, that went into the hydration of the branch. + repoURL : str, default is Undefined, optional + RepoURL is the URL of the repository where the commit is located. + subject : str, default is Undefined, optional + Subject is the subject line of the dry commit that was used to hydrate the branch. + """ + + + author?: str + + body?: str + + date?: str + + drySha?: str + + references?: [PromoterArgoprojIoV1alpha1ChangeTransferPolicyStatusProposedNoteReferencesItems0] + + repoURL?: str + + subject?: str + + +schema PromoterArgoprojIoV1alpha1ChangeTransferPolicyStatusProposedNoteReferencesItems0: + r""" + RevisionReference contains a reference to a some information that is related in some way to another commit. For now, + it supports only references to a commit. In the future, it may support other types of references. + + Attributes + ---------- + commit : PromoterArgoprojIoV1alpha1ChangeTransferPolicyStatusProposedNoteReferencesItems0Commit, default is Undefined, optional + commit + """ + + + commit?: PromoterArgoprojIoV1alpha1ChangeTransferPolicyStatusProposedNoteReferencesItems0Commit + + +schema PromoterArgoprojIoV1alpha1ChangeTransferPolicyStatusProposedNoteReferencesItems0Commit: + r""" + Commit contains metadata about the commit that is related in some way to another commit. + + Attributes + ---------- + author : str, default is Undefined, optional + Author is the author of the commit. + body : str, default is Undefined, optional + Body is the body of the commit message, excluding the subject line, i.e. `git show --format=%b`. + date : str, default is Undefined, optional + Date is the date of the commit, formatted as by `git show -s --format=%aI`. + repoURL : str, default is Undefined, optional + RepoURL is the URL of the repository where the commit is located. + sha : str, default is Undefined, optional + Sha is the commit hash. + subject : str, default is Undefined, optional + Subject is the subject line of the commit message, i.e. `git show --format=%s`. + """ + + + author?: str + + body?: str + + date?: str + + repoURL?: str + + sha?: str + + subject?: str + + + check: + _regex_match(str(repoURL), r"^(https?://.*)?$") if repoURL + + schema PromoterArgoprojIoV1alpha1ChangeTransferPolicyStatusPullRequest: r""" PullRequest is the state of the pull request that was created for this ChangeTransferPolicy. diff --git a/gitops-promoter/v1alpha1/promoter_argoproj_io_v1alpha1_cluster_scm_provider.k b/gitops-promoter/v1alpha1/promoter_argoproj_io_v1alpha1_cluster_scm_provider.k index dc40c7d6..166218cb 100644 --- a/gitops-promoter/v1alpha1/promoter_argoproj_io_v1alpha1_cluster_scm_provider.k +++ b/gitops-promoter/v1alpha1/promoter_argoproj_io_v1alpha1_cluster_scm_provider.k @@ -43,6 +43,8 @@ schema PromoterArgoprojIoV1alpha1ClusterScmProviderSpec: Attributes ---------- + bitbucketCloud : any, default is Undefined, optional + BitbucketCloud required configuration for Bitbucket Cloud as the SCM provider fake : PromoterArgoprojIoV1alpha1ClusterScmProviderSpecFake, default is Undefined, optional fake forgejo : PromoterArgoprojIoV1alpha1ClusterScmProviderSpecForgejo, default is Undefined, optional @@ -56,6 +58,8 @@ schema PromoterArgoprojIoV1alpha1ClusterScmProviderSpec: """ + bitbucketCloud?: any + fake?: PromoterArgoprojIoV1alpha1ClusterScmProviderSpecFake forgejo?: PromoterArgoprojIoV1alpha1ClusterScmProviderSpecForgejo diff --git a/gitops-promoter/v1alpha1/promoter_argoproj_io_v1alpha1_commit_status.k b/gitops-promoter/v1alpha1/promoter_argoproj_io_v1alpha1_commit_status.k index 79312786..1138a06c 100644 --- a/gitops-promoter/v1alpha1/promoter_argoproj_io_v1alpha1_commit_status.k +++ b/gitops-promoter/v1alpha1/promoter_argoproj_io_v1alpha1_commit_status.k @@ -72,6 +72,7 @@ schema PromoterArgoprojIoV1alpha1CommitStatusSpec: check: + len(name) >= 1 len(sha) <= 64 len(sha) >= 1 _regex_match(str(sha), r"^[a-fA-F0-9]+$") diff --git a/gitops-promoter/v1alpha1/promoter_argoproj_io_v1alpha1_controller_configuration.k b/gitops-promoter/v1alpha1/promoter_argoproj_io_v1alpha1_controller_configuration.k index bc05435e..76f0fb2a 100644 --- a/gitops-promoter/v1alpha1/promoter_argoproj_io_v1alpha1_controller_configuration.k +++ b/gitops-promoter/v1alpha1/promoter_argoproj_io_v1alpha1_controller_configuration.k @@ -56,6 +56,8 @@ schema PromoterArgoprojIoV1alpha1ControllerConfigurationSpec: change transfer policy commitStatus : PromoterArgoprojIoV1alpha1ControllerConfigurationSpecCommitStatus, default is Undefined, required commit status + gitCommitStatus : PromoterArgoprojIoV1alpha1ControllerConfigurationSpecGitCommitStatus, default is Undefined, required + git commit status promotionStrategy : PromoterArgoprojIoV1alpha1ControllerConfigurationSpecPromotionStrategy, default is Undefined, required promotion strategy pullRequest : PromoterArgoprojIoV1alpha1ControllerConfigurationSpecPullRequest, default is Undefined, required @@ -71,6 +73,8 @@ schema PromoterArgoprojIoV1alpha1ControllerConfigurationSpec: commitStatus: PromoterArgoprojIoV1alpha1ControllerConfigurationSpecCommitStatus + gitCommitStatus: PromoterArgoprojIoV1alpha1ControllerConfigurationSpecGitCommitStatus + promotionStrategy: PromoterArgoprojIoV1alpha1ControllerConfigurationSpecPromotionStrategy pullRequest: PromoterArgoprojIoV1alpha1ControllerConfigurationSpecPullRequest @@ -826,6 +830,253 @@ schema PromoterArgoprojIoV1alpha1ControllerConfigurationSpecCommitStatusWorkQueu slowDelay: str +schema PromoterArgoprojIoV1alpha1ControllerConfigurationSpecGitCommitStatus: + r""" + GitCommitStatus contains the configuration for the GitCommitStatus controller, + including WorkQueue settings that control reconciliation behavior. + + Attributes + ---------- + workQueue : PromoterArgoprojIoV1alpha1ControllerConfigurationSpecGitCommitStatusWorkQueue, default is Undefined, required + work queue + """ + + + workQueue: PromoterArgoprojIoV1alpha1ControllerConfigurationSpecGitCommitStatusWorkQueue + + +schema PromoterArgoprojIoV1alpha1ControllerConfigurationSpecGitCommitStatusWorkQueue: + r""" + WorkQueue contains the work queue configuration for the GitCommitStatus controller. + This includes requeue duration, maximum concurrent reconciles, and rate limiter settings. + + Attributes + ---------- + maxConcurrentReconciles : int, default is Undefined, required + MaxConcurrentReconciles defines the maximum number of concurrent reconcile operations + that can run for this controller. Higher values increase throughput but consume more + resources. Must be at least 1. + rateLimiter : PromoterArgoprojIoV1alpha1ControllerConfigurationSpecGitCommitStatusWorkQueueRateLimiter, default is Undefined, required + rate limiter + requeueDuration : str, default is Undefined, required + RequeueDuration specifies how frequently resources should be requeued for automatic reconciliation. + This creates a periodic reconciliation loop that ensures the desired state is maintained even + without external triggers. Format follows Go's time.Duration syntax (e.g., "5m" for 5 minutes). + """ + + + maxConcurrentReconciles: int + + rateLimiter: PromoterArgoprojIoV1alpha1ControllerConfigurationSpecGitCommitStatusWorkQueueRateLimiter + + requeueDuration: str + + +schema PromoterArgoprojIoV1alpha1ControllerConfigurationSpecGitCommitStatusWorkQueueRateLimiter: + r""" + RateLimiter defines the rate limiting strategy for the controller's work queue. + Rate limiting controls how quickly failed reconciliations are retried and helps + prevent overwhelming external APIs or systems. + + Attributes + ---------- + bucket : PromoterArgoprojIoV1alpha1ControllerConfigurationSpecGitCommitStatusWorkQueueRateLimiterBucket, default is Undefined, optional + bucket + exponentialFailure : PromoterArgoprojIoV1alpha1ControllerConfigurationSpecGitCommitStatusWorkQueueRateLimiterExponentialFailure, default is Undefined, optional + exponential failure + fastSlow : PromoterArgoprojIoV1alpha1ControllerConfigurationSpecGitCommitStatusWorkQueueRateLimiterFastSlow, default is Undefined, optional + fast slow + maxOf : [PromoterArgoprojIoV1alpha1ControllerConfigurationSpecGitCommitStatusWorkQueueRateLimiterMaxOfItems0], default is Undefined, optional + MaxOf allows combining multiple rate limiters, where the maximum delay from all + limiters is used. This enables sophisticated rate limiting that respects multiple + constraints simultaneously (e.g., both per-item exponential backoff and global rate limits). + """ + + + bucket?: PromoterArgoprojIoV1alpha1ControllerConfigurationSpecGitCommitStatusWorkQueueRateLimiterBucket + + exponentialFailure?: PromoterArgoprojIoV1alpha1ControllerConfigurationSpecGitCommitStatusWorkQueueRateLimiterExponentialFailure + + fastSlow?: PromoterArgoprojIoV1alpha1ControllerConfigurationSpecGitCommitStatusWorkQueueRateLimiterFastSlow + + maxOf?: [PromoterArgoprojIoV1alpha1ControllerConfigurationSpecGitCommitStatusWorkQueueRateLimiterMaxOfItems0] + + + check: + len(maxOf) <= 3 if maxOf + + +schema PromoterArgoprojIoV1alpha1ControllerConfigurationSpecGitCommitStatusWorkQueueRateLimiterBucket: + r""" + Bucket rate limiter uses a token bucket algorithm to control request rate. + Allows bursts while maintaining an average rate limit. + + Attributes + ---------- + bucket : int, default is Undefined, required + Bucket is the maximum number of tokens that can be accumulated in the bucket. + This defines the maximum burst size - how many operations can occur in rapid + succession before rate limiting takes effect. Must be non-negative. + qps : int, default is Undefined, required + Qps (queries per second) is the rate at which tokens are added to the bucket. + This defines the sustained rate limit for operations. Must be non-negative. + """ + + + bucket: int + + qps: int + + +schema PromoterArgoprojIoV1alpha1ControllerConfigurationSpecGitCommitStatusWorkQueueRateLimiterExponentialFailure: + r""" + ExponentialFailure rate limiter increases delay exponentially with each failure. + Standard approach for backing off when operations fail repeatedly. + + Attributes + ---------- + baseDelay : str, default is Undefined, required + BaseDelay is the initial delay after the first failure. Subsequent failures will exponentially + increase this delay (2x, 4x, 8x, etc.) until MaxDelay is reached. + Format follows Go's time.Duration syntax (e.g., "1s" for 1 second). + maxDelay : str, default is Undefined, required + MaxDelay is the maximum delay between retry attempts. Once the exponential backoff reaches + this value, all subsequent retries will use this delay. + Format follows Go's time.Duration syntax (e.g., "1m" for 1 minute). + """ + + + baseDelay: str + + maxDelay: str + + +schema PromoterArgoprojIoV1alpha1ControllerConfigurationSpecGitCommitStatusWorkQueueRateLimiterFastSlow: + r""" + FastSlow rate limiter provides fast retries initially, then switches to slow retries. + Useful for quickly retrying transient errors while backing off for persistent failures. + + Attributes + ---------- + fastDelay : str, default is Undefined, required + FastDelay is the delay used for the first MaxFastAttempts retry attempts. + Format follows Go's time.Duration syntax (e.g., "100ms" for 100 milliseconds). + maxFastAttempts : int, default is Undefined, required + MaxFastAttempts is the number of retry attempts that use FastDelay before switching to SlowDelay. + Must be at least 1. + slowDelay : str, default is Undefined, required + SlowDelay is the delay used for retry attempts after MaxFastAttempts have been exhausted. + Format follows Go's time.Duration syntax (e.g., "10s" for 10 seconds). + """ + + + fastDelay: str + + maxFastAttempts: int + + slowDelay: str + + +schema PromoterArgoprojIoV1alpha1ControllerConfigurationSpecGitCommitStatusWorkQueueRateLimiterMaxOfItems0: + r""" + RateLimiterTypes defines the different algorithms available for rate limiting. + + Exactly one of the three rate limiter types must be specified: + - FastSlow: Quick retry for transient errors, then slower retry for persistent failures + - ExponentialFailure: Standard exponential backoff for repeated failures + - Bucket: Token bucket algorithm for controlling overall request rate + + See https://pkg.go.dev/k8s.io/client-go/util/workqueue for implementation details. + + Attributes + ---------- + bucket : PromoterArgoprojIoV1alpha1ControllerConfigurationSpecGitCommitStatusWorkQueueRateLimiterMaxOfItems0Bucket, default is Undefined, optional + bucket + exponentialFailure : PromoterArgoprojIoV1alpha1ControllerConfigurationSpecGitCommitStatusWorkQueueRateLimiterMaxOfItems0ExponentialFailure, default is Undefined, optional + exponential failure + fastSlow : PromoterArgoprojIoV1alpha1ControllerConfigurationSpecGitCommitStatusWorkQueueRateLimiterMaxOfItems0FastSlow, default is Undefined, optional + fast slow + """ + + + bucket?: PromoterArgoprojIoV1alpha1ControllerConfigurationSpecGitCommitStatusWorkQueueRateLimiterMaxOfItems0Bucket + + exponentialFailure?: PromoterArgoprojIoV1alpha1ControllerConfigurationSpecGitCommitStatusWorkQueueRateLimiterMaxOfItems0ExponentialFailure + + fastSlow?: PromoterArgoprojIoV1alpha1ControllerConfigurationSpecGitCommitStatusWorkQueueRateLimiterMaxOfItems0FastSlow + + +schema PromoterArgoprojIoV1alpha1ControllerConfigurationSpecGitCommitStatusWorkQueueRateLimiterMaxOfItems0Bucket: + r""" + Bucket rate limiter uses a token bucket algorithm to control request rate. + Allows bursts while maintaining an average rate limit. + + Attributes + ---------- + bucket : int, default is Undefined, required + Bucket is the maximum number of tokens that can be accumulated in the bucket. + This defines the maximum burst size - how many operations can occur in rapid + succession before rate limiting takes effect. Must be non-negative. + qps : int, default is Undefined, required + Qps (queries per second) is the rate at which tokens are added to the bucket. + This defines the sustained rate limit for operations. Must be non-negative. + """ + + + bucket: int + + qps: int + + +schema PromoterArgoprojIoV1alpha1ControllerConfigurationSpecGitCommitStatusWorkQueueRateLimiterMaxOfItems0ExponentialFailure: + r""" + ExponentialFailure rate limiter increases delay exponentially with each failure. + Standard approach for backing off when operations fail repeatedly. + + Attributes + ---------- + baseDelay : str, default is Undefined, required + BaseDelay is the initial delay after the first failure. Subsequent failures will exponentially + increase this delay (2x, 4x, 8x, etc.) until MaxDelay is reached. + Format follows Go's time.Duration syntax (e.g., "1s" for 1 second). + maxDelay : str, default is Undefined, required + MaxDelay is the maximum delay between retry attempts. Once the exponential backoff reaches + this value, all subsequent retries will use this delay. + Format follows Go's time.Duration syntax (e.g., "1m" for 1 minute). + """ + + + baseDelay: str + + maxDelay: str + + +schema PromoterArgoprojIoV1alpha1ControllerConfigurationSpecGitCommitStatusWorkQueueRateLimiterMaxOfItems0FastSlow: + r""" + FastSlow rate limiter provides fast retries initially, then switches to slow retries. + Useful for quickly retrying transient errors while backing off for persistent failures. + + Attributes + ---------- + fastDelay : str, default is Undefined, required + FastDelay is the delay used for the first MaxFastAttempts retry attempts. + Format follows Go's time.Duration syntax (e.g., "100ms" for 100 milliseconds). + maxFastAttempts : int, default is Undefined, required + MaxFastAttempts is the number of retry attempts that use FastDelay before switching to SlowDelay. + Must be at least 1. + slowDelay : str, default is Undefined, required + SlowDelay is the delay used for retry attempts after MaxFastAttempts have been exhausted. + Format follows Go's time.Duration syntax (e.g., "10s" for 10 seconds). + """ + + + fastDelay: str + + maxFastAttempts: int + + slowDelay: str + + schema PromoterArgoprojIoV1alpha1ControllerConfigurationSpecPromotionStrategy: r""" PromotionStrategy contains the configuration for the PromotionStrategy controller, diff --git a/gitops-promoter/v1alpha1/promoter_argoproj_io_v1alpha1_git_commit_status.k b/gitops-promoter/v1alpha1/promoter_argoproj_io_v1alpha1_git_commit_status.k new file mode 100644 index 00000000..b2e6e13a --- /dev/null +++ b/gitops-promoter/v1alpha1/promoter_argoproj_io_v1alpha1_git_commit_status.k @@ -0,0 +1,281 @@ +""" +This file was generated by the KCL auto-gen tool. DO NOT EDIT. +Editing this file might prove futile when you re-run the KCL auto-gen generate command. +""" +import regex +import k8s.apimachinery.pkg.apis.meta.v1 +_regex_match = regex.match + + +schema GitCommitStatus: + r""" + GitCommitStatus is the Schema for the gitcommitstatuses API. + + It validates commits from PromotionStrategy environments using configurable expressions + and creates CommitStatus resources with the validation results. + + Use the Target field to control which commit is validated: + - "active" (default): Validates the currently deployed commit + - "proposed": Validates the incoming commit + + The validation result is always reported on the PROPOSED commit to enable promotion gating, + regardless of which commit was validated. + + Workflow: + 1. Controller reads PromotionStrategy to get ProposedHydratedSha and ActiveHydratedSha + 2. Controller selects SHA to validate based on Target field + 3. Controller fetches commit data (subject, body, author, trailers) for selected SHA + 4. Controller evaluates expression against selected commit data + 5. Controller creates/updates CommitStatus with result attached to PROPOSED SHA + 6. PromotionStrategy checks CommitStatus on PROPOSED SHA before allowing promotion + + Common use cases: + - "Ensure active commit is not a revert before promoting" + + Attributes + ---------- + apiVersion : str, default is "promoter.argoproj.io/v1alpha1", required + APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources + kind : str, default is "GitCommitStatus", required + Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds + metadata : v1.ObjectMeta, default is Undefined, optional + metadata + spec : PromoterArgoprojIoV1alpha1GitCommitStatusSpec, default is Undefined, required + spec + status : PromoterArgoprojIoV1alpha1GitCommitStatusStatus, default is Undefined, optional + status + """ + + + apiVersion: "promoter.argoproj.io/v1alpha1" = "promoter.argoproj.io/v1alpha1" + + kind: "GitCommitStatus" = "GitCommitStatus" + + metadata?: v1.ObjectMeta + + spec: PromoterArgoprojIoV1alpha1GitCommitStatusSpec + + status?: PromoterArgoprojIoV1alpha1GitCommitStatusStatus + + +schema PromoterArgoprojIoV1alpha1GitCommitStatusSpec: + r""" + spec defines the desired state of GitCommitStatus + + Attributes + ---------- + description : str, default is Undefined, optional + Description is a human-readable description of this validation that will be shown in the SCM provider + (GitHub, GitLab, etc.) as the commit status description. + If not specified, defaults to empty string. + expression : str, default is Undefined, required + Expression is evaluated using the expr library (github.com/expr-lang/expr) against commit data + for environments in the referenced PromotionStrategy. + The expression must return a boolean value where true indicates the validation passed. + + The commit validated is determined by the Target field: + - "active" (default): Validates the ACTIVE (currently deployed) commit + - "proposed": Validates the PROPOSED commit (what will be promoted) + + The validation result is always reported on the PROPOSED commit to enable promotion gating. + + Use Cases by Mode: + Active mode: State-based gating - validate current environment before allowing promotion + - "Don't promote until active commit has required sign-offs" + - "Verify current deployment meets compliance before next promotion" + - "Ensure active commit is not a revert before promoting" + + Proposed mode: Change-based gating - validate the incoming change itself + - "Don't promote unless new commit follows naming convention" + - "Ensure proposed commit has proper JIRA ticket reference" + - "Require specific author for proposed changes" + + Available variables in the expression context: + - Commit.SHA (string): the commit SHA being validated (active or proposed based on Target) + - Commit.Subject (string): the first line of the commit message + - Commit.Body (string): the commit message body (everything after the subject line) + - Commit.Author (string): commit author email address + - Commit.Trailers (map[string][]string): git trailers parsed from commit message + key : str, default is Undefined, required + Key is the unique identifier for this validation rule. + It is used as the commit status key and in status messages. + This key is matched against PromotionStrategy's proposedCommitStatuses or activeCommitStatuses + to determine which environments this validation applies to. + promotionStrategyRef : PromoterArgoprojIoV1alpha1GitCommitStatusSpecPromotionStrategyRef, default is Undefined, required + promotion strategy ref + target : str, default is "active", optional + Target specifies which commit SHA to validate with the expression. + - "active": Validates the currently active/deployed commit (default behavior) + - "proposed": Validates the proposed commit that will be promoted + + The validation result is always reported on the PROPOSED commit (for gating), but this field + controls which commit's data is used in the expression evaluation. + + Examples: + target: "active" - "Don't promote if a revert commit is detected" + target: "proposed" - "Don't promote unless new commit follows naming convention" + """ + + + description?: str + + expression: str + + key: str + + promotionStrategyRef: PromoterArgoprojIoV1alpha1GitCommitStatusSpecPromotionStrategyRef + + target?: "active" | "proposed" = "active" + + + check: + len(key) <= 63 + len(key) >= 1 + _regex_match(str(key), r"^[a-z0-9]([-a-z0-9]*[a-z0-9])?$") + + +schema PromoterArgoprojIoV1alpha1GitCommitStatusSpecPromotionStrategyRef: + r""" + PromotionStrategyRef is a reference to the promotion strategy that this commit status applies to. + The controller will validate commits from ALL environments in the referenced PromotionStrategy + where this GitCommitStatus.Spec.Key matches an entry in either: + - PromotionStrategy.Spec.ProposedCommitStatuses (applies to all environments), OR + - Environment.ProposedCommitStatuses (applies to specific environment) + + Attributes + ---------- + name : str, default is Undefined, required + Name is the name of the object to refer to. + """ + + + name: str + + +schema PromoterArgoprojIoV1alpha1GitCommitStatusStatus: + r""" + status defines the observed state of GitCommitStatus + + Attributes + ---------- + conditions : [PromoterArgoprojIoV1alpha1GitCommitStatusStatusConditionsItems0], default is Undefined, optional + Conditions represent the latest available observations of the GitCommitStatus's state. + Standard condition types include "Ready" which aggregates the status of all environments. + environments : [PromoterArgoprojIoV1alpha1GitCommitStatusStatusEnvironmentsItems0], default is Undefined, optional + Environments holds the validation results for each environment where this validation applies. + Each entry corresponds to an environment from the PromotionStrategy where the Key matches + either global or environment-specific proposedCommitStatuses. + + The controller validates the commit specified by Target ("active" or "proposed") + but the CommitStatus is always reported on the PROPOSED commit for promotion gating. + Each environment entry tracks both the ProposedHydratedSha (where status is reported) and the + ActiveHydratedSha, with TargetedSha indicating which one was actually evaluated. + """ + + + conditions?: [PromoterArgoprojIoV1alpha1GitCommitStatusStatusConditionsItems0] + + environments?: [PromoterArgoprojIoV1alpha1GitCommitStatusStatusEnvironmentsItems0] + + +schema PromoterArgoprojIoV1alpha1GitCommitStatusStatusConditionsItems0: + r""" + Condition contains details for one aspect of the current state of this API Resource. + + Attributes + ---------- + lastTransitionTime : str, default is Undefined, required + lastTransitionTime is the last time the condition transitioned from one status to another. + This should be when the underlying condition changed. If that is not known, then using the time when the API field changed is acceptable. + message : str, default is Undefined, required + message is a human readable message indicating details about the transition. + This may be an empty string. + observedGeneration : int, default is Undefined, optional + observedGeneration represents the .metadata.generation that the condition was set based upon. + For instance, if .metadata.generation is currently 12, but the .status.conditions[x].observedGeneration is 9, the condition is out of date + with respect to the current state of the instance. + reason : str, default is Undefined, required + reason contains a programmatic identifier indicating the reason for the condition's last transition. + Producers of specific condition types may define expected values and meanings for this field, + and whether the values are considered a guaranteed API. + The value should be a CamelCase string. + This field may not be empty. + status : str, default is Undefined, required + status of the condition, one of True, False, Unknown. + $type : str, default is Undefined, required + type of condition in CamelCase or in foo.example.com/CamelCase. + """ + + + lastTransitionTime: str + + message: str + + observedGeneration?: int + + reason: str + + status: "True" | "False" | "Unknown" + + $type: str + + + check: + len(message) <= 32768 + observedGeneration >= 0 if observedGeneration not in [None, Undefined] + len(reason) <= 1024 + len(reason) >= 1 + _regex_match(str(reason), r"^[A-Za-z]([A-Za-z0-9_,:]*[A-Za-z0-9_])?$") + len($type) <= 316 + _regex_match(str($type), r"^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])$") + + +schema PromoterArgoprojIoV1alpha1GitCommitStatusStatusEnvironmentsItems0: + r""" + GitCommitStatusEnvironmentStatus defines the observed validation status for a specific environment. + + Attributes + ---------- + activeHydratedSha : str, default is Undefined, optional + ActiveHydratedSha is the currently active (deployed) hydrated commit SHA that was validated. + This comes from the PromotionStrategy's environment status. + The expression is evaluated against THIS commit's data, not the proposed commit. + May be empty if the PromotionStrategy hasn't reconciled yet. + branch : str, default is Undefined, required + Branch is the environment branch name being validated. + expressionResult : bool, default is Undefined, optional + ExpressionResult contains the boolean result of the expression evaluation. + Only set when the expression successfully evaluates to a boolean. + nil indicates the expression has not yet been evaluated, failed to compile, or failed to evaluate. + phase : str, default is Undefined, required + Phase represents the current validation state of the commit. + - "pending": validation has not completed, commit data is not yet available, or SHAs are empty + - "success": expression evaluated to true, validation passed + - "failure": expression evaluated to false, validation failed, or expression compilation failed + proposedHydratedSha : str, default is Undefined, required + ProposedHydratedSha is the proposed hydrated commit SHA where the validation result is reported. + This comes from the PromotionStrategy's environment status. + The CommitStatus resource is created with this SHA, allowing the PromotionStrategy to gate + promotions based on the validation of the ACTIVE commit. + May be empty if the PromotionStrategy hasn't reconciled yet. + targetedSha : str, default is Undefined, optional + TargetedSha is the commit SHA that was actually validated by the expression. + This will match either ProposedHydratedSha or ActiveHydratedSha depending on + the Target setting ("proposed" or "active"). + This field clarifies which commit's data was used in the expression evaluation. + """ + + + activeHydratedSha?: str + + branch: str + + expressionResult?: bool + + phase: "pending" | "success" | "failure" + + proposedHydratedSha: str + + targetedSha?: str + + diff --git a/gitops-promoter/v1alpha1/promoter_argoproj_io_v1alpha1_git_repository.k b/gitops-promoter/v1alpha1/promoter_argoproj_io_v1alpha1_git_repository.k index 65df2070..c39d92da 100644 --- a/gitops-promoter/v1alpha1/promoter_argoproj_io_v1alpha1_git_repository.k +++ b/gitops-promoter/v1alpha1/promoter_argoproj_io_v1alpha1_git_repository.k @@ -43,6 +43,8 @@ schema PromoterArgoprojIoV1alpha1GitRepositorySpec: Attributes ---------- + bitbucketCloud : PromoterArgoprojIoV1alpha1GitRepositorySpecBitbucketCloud, default is Undefined, optional + bitbucket cloud fake : PromoterArgoprojIoV1alpha1GitRepositorySpecFake, default is Undefined, optional fake forgejo : PromoterArgoprojIoV1alpha1GitRepositorySpecForgejo, default is Undefined, optional @@ -56,6 +58,8 @@ schema PromoterArgoprojIoV1alpha1GitRepositorySpec: """ + bitbucketCloud?: PromoterArgoprojIoV1alpha1GitRepositorySpecBitbucketCloud + fake?: PromoterArgoprojIoV1alpha1GitRepositorySpecFake forgejo?: PromoterArgoprojIoV1alpha1GitRepositorySpecForgejo @@ -67,6 +71,31 @@ schema PromoterArgoprojIoV1alpha1GitRepositorySpec: scmProviderRef: PromoterArgoprojIoV1alpha1GitRepositorySpecScmProviderRef +schema PromoterArgoprojIoV1alpha1GitRepositorySpecBitbucketCloud: + r""" + BitbucketCloudRepo is a repository in Bitbucket Cloud, identified by its owner and name. + + Attributes + ---------- + name : str, default is Undefined, required + Name is the name of the repository. + owner : str, default is Undefined, required + Owner is the owner of the repository (can be a user or workspace). + """ + + + name: str + + owner: str + + + check: + len(name) <= 62 + _regex_match(str(name), r"^[a-zA-Z0-9_.-]+$") + len(owner) >= 1 + _regex_match(str(owner), r"^[a-zA-Z0-9_-]+$") + + schema PromoterArgoprojIoV1alpha1GitRepositorySpecFake: r""" FakeRepo is a placeholder for a repository in the fake SCM provider, used for testing purposes. diff --git a/gitops-promoter/v1alpha1/promoter_argoproj_io_v1alpha1_promotion_strategy.k b/gitops-promoter/v1alpha1/promoter_argoproj_io_v1alpha1_promotion_strategy.k index c6462987..cb68f1d3 100644 --- a/gitops-promoter/v1alpha1/promoter_argoproj_io_v1alpha1_promotion_strategy.k +++ b/gitops-promoter/v1alpha1/promoter_argoproj_io_v1alpha1_promotion_strategy.k @@ -326,6 +326,8 @@ schema PromoterArgoprojIoV1alpha1PromotionStrategyStatusEnvironmentsItems0Active dry hydrated : PromoterArgoprojIoV1alpha1PromotionStrategyStatusEnvironmentsItems0ActiveHydrated, default is Undefined, optional hydrated + note : PromoterArgoprojIoV1alpha1PromotionStrategyStatusEnvironmentsItems0ActiveNote, default is Undefined, optional + note """ @@ -335,6 +337,8 @@ schema PromoterArgoprojIoV1alpha1PromotionStrategyStatusEnvironmentsItems0Active hydrated?: PromoterArgoprojIoV1alpha1PromotionStrategyStatusEnvironmentsItems0ActiveHydrated + note?: PromoterArgoprojIoV1alpha1PromotionStrategyStatusEnvironmentsItems0ActiveNote + schema PromoterArgoprojIoV1alpha1PromotionStrategyStatusEnvironmentsItems0ActiveCommitStatusesItems0: r""" @@ -555,6 +559,97 @@ schema PromoterArgoprojIoV1alpha1PromotionStrategyStatusEnvironmentsItems0Active _regex_match(str(repoURL), r"^(https?://.*)?$") if repoURL +schema PromoterArgoprojIoV1alpha1PromotionStrategyStatusEnvironmentsItems0ActiveNote: + r""" + Note is the hydrator metadata from the git note attached to the hydrated commit. + + Attributes + ---------- + author : str, default is Undefined, optional + Author is the author of the dry commit that was used to hydrate the branch. + body : str, default is Undefined, optional + Body is the body of the dry commit that was used to hydrate the branch without the subject. + date : str, default is Undefined, optional + Date is the date of the dry commit that was used to hydrate the branch. + drySha : str, default is Undefined, optional + DrySha is the SHA of the commit that was used as the dry source for hydration. + references : [PromoterArgoprojIoV1alpha1PromotionStrategyStatusEnvironmentsItems0ActiveNoteReferencesItems0], default is Undefined, optional + References are the references to other commits, that went into the hydration of the branch. + repoURL : str, default is Undefined, optional + RepoURL is the URL of the repository where the commit is located. + subject : str, default is Undefined, optional + Subject is the subject line of the dry commit that was used to hydrate the branch. + """ + + + author?: str + + body?: str + + date?: str + + drySha?: str + + references?: [PromoterArgoprojIoV1alpha1PromotionStrategyStatusEnvironmentsItems0ActiveNoteReferencesItems0] + + repoURL?: str + + subject?: str + + +schema PromoterArgoprojIoV1alpha1PromotionStrategyStatusEnvironmentsItems0ActiveNoteReferencesItems0: + r""" + RevisionReference contains a reference to a some information that is related in some way to another commit. For now, + it supports only references to a commit. In the future, it may support other types of references. + + Attributes + ---------- + commit : PromoterArgoprojIoV1alpha1PromotionStrategyStatusEnvironmentsItems0ActiveNoteReferencesItems0Commit, default is Undefined, optional + commit + """ + + + commit?: PromoterArgoprojIoV1alpha1PromotionStrategyStatusEnvironmentsItems0ActiveNoteReferencesItems0Commit + + +schema PromoterArgoprojIoV1alpha1PromotionStrategyStatusEnvironmentsItems0ActiveNoteReferencesItems0Commit: + r""" + Commit contains metadata about the commit that is related in some way to another commit. + + Attributes + ---------- + author : str, default is Undefined, optional + Author is the author of the commit. + body : str, default is Undefined, optional + Body is the body of the commit message, excluding the subject line, i.e. `git show --format=%b`. + date : str, default is Undefined, optional + Date is the date of the commit, formatted as by `git show -s --format=%aI`. + repoURL : str, default is Undefined, optional + RepoURL is the URL of the repository where the commit is located. + sha : str, default is Undefined, optional + Sha is the commit hash. + subject : str, default is Undefined, optional + Subject is the subject line of the commit message, i.e. `git show --format=%s`. + """ + + + author?: str + + body?: str + + date?: str + + repoURL?: str + + sha?: str + + subject?: str + + + check: + _regex_match(str(repoURL), r"^(https?://.*)?$") if repoURL + + schema PromoterArgoprojIoV1alpha1PromotionStrategyStatusEnvironmentsItems0HistoryItems0: r""" History describes a particular change that was promoted by the ChangeTransferPolicy. @@ -589,6 +684,8 @@ schema PromoterArgoprojIoV1alpha1PromotionStrategyStatusEnvironmentsItems0Histor dry hydrated : PromoterArgoprojIoV1alpha1PromotionStrategyStatusEnvironmentsItems0HistoryItems0ActiveHydrated, default is Undefined, optional hydrated + note : PromoterArgoprojIoV1alpha1PromotionStrategyStatusEnvironmentsItems0HistoryItems0ActiveNote, default is Undefined, optional + note """ @@ -598,6 +695,8 @@ schema PromoterArgoprojIoV1alpha1PromotionStrategyStatusEnvironmentsItems0Histor hydrated?: PromoterArgoprojIoV1alpha1PromotionStrategyStatusEnvironmentsItems0HistoryItems0ActiveHydrated + note?: PromoterArgoprojIoV1alpha1PromotionStrategyStatusEnvironmentsItems0HistoryItems0ActiveNote + schema PromoterArgoprojIoV1alpha1PromotionStrategyStatusEnvironmentsItems0HistoryItems0ActiveCommitStatusesItems0: r""" @@ -818,6 +917,97 @@ schema PromoterArgoprojIoV1alpha1PromotionStrategyStatusEnvironmentsItems0Histor _regex_match(str(repoURL), r"^(https?://.*)?$") if repoURL +schema PromoterArgoprojIoV1alpha1PromotionStrategyStatusEnvironmentsItems0HistoryItems0ActiveNote: + r""" + Note is the hydrator metadata from the git note attached to the hydrated commit. + + Attributes + ---------- + author : str, default is Undefined, optional + Author is the author of the dry commit that was used to hydrate the branch. + body : str, default is Undefined, optional + Body is the body of the dry commit that was used to hydrate the branch without the subject. + date : str, default is Undefined, optional + Date is the date of the dry commit that was used to hydrate the branch. + drySha : str, default is Undefined, optional + DrySha is the SHA of the commit that was used as the dry source for hydration. + references : [PromoterArgoprojIoV1alpha1PromotionStrategyStatusEnvironmentsItems0HistoryItems0ActiveNoteReferencesItems0], default is Undefined, optional + References are the references to other commits, that went into the hydration of the branch. + repoURL : str, default is Undefined, optional + RepoURL is the URL of the repository where the commit is located. + subject : str, default is Undefined, optional + Subject is the subject line of the dry commit that was used to hydrate the branch. + """ + + + author?: str + + body?: str + + date?: str + + drySha?: str + + references?: [PromoterArgoprojIoV1alpha1PromotionStrategyStatusEnvironmentsItems0HistoryItems0ActiveNoteReferencesItems0] + + repoURL?: str + + subject?: str + + +schema PromoterArgoprojIoV1alpha1PromotionStrategyStatusEnvironmentsItems0HistoryItems0ActiveNoteReferencesItems0: + r""" + RevisionReference contains a reference to a some information that is related in some way to another commit. For now, + it supports only references to a commit. In the future, it may support other types of references. + + Attributes + ---------- + commit : PromoterArgoprojIoV1alpha1PromotionStrategyStatusEnvironmentsItems0HistoryItems0ActiveNoteReferencesItems0Commit, default is Undefined, optional + commit + """ + + + commit?: PromoterArgoprojIoV1alpha1PromotionStrategyStatusEnvironmentsItems0HistoryItems0ActiveNoteReferencesItems0Commit + + +schema PromoterArgoprojIoV1alpha1PromotionStrategyStatusEnvironmentsItems0HistoryItems0ActiveNoteReferencesItems0Commit: + r""" + Commit contains metadata about the commit that is related in some way to another commit. + + Attributes + ---------- + author : str, default is Undefined, optional + Author is the author of the commit. + body : str, default is Undefined, optional + Body is the body of the commit message, excluding the subject line, i.e. `git show --format=%b`. + date : str, default is Undefined, optional + Date is the date of the commit, formatted as by `git show -s --format=%aI`. + repoURL : str, default is Undefined, optional + RepoURL is the URL of the repository where the commit is located. + sha : str, default is Undefined, optional + Sha is the commit hash. + subject : str, default is Undefined, optional + Subject is the subject line of the commit message, i.e. `git show --format=%s`. + """ + + + author?: str + + body?: str + + date?: str + + repoURL?: str + + sha?: str + + subject?: str + + + check: + _regex_match(str(repoURL), r"^(https?://.*)?$") if repoURL + + schema PromoterArgoprojIoV1alpha1PromotionStrategyStatusEnvironmentsItems0HistoryItems0Proposed: r""" Proposed is the state of the proposed branch at the time the PR was merged. @@ -1028,6 +1218,8 @@ schema PromoterArgoprojIoV1alpha1PromotionStrategyStatusEnvironmentsItems0Propos dry hydrated : PromoterArgoprojIoV1alpha1PromotionStrategyStatusEnvironmentsItems0ProposedHydrated, default is Undefined, optional hydrated + note : PromoterArgoprojIoV1alpha1PromotionStrategyStatusEnvironmentsItems0ProposedNote, default is Undefined, optional + note """ @@ -1037,6 +1229,8 @@ schema PromoterArgoprojIoV1alpha1PromotionStrategyStatusEnvironmentsItems0Propos hydrated?: PromoterArgoprojIoV1alpha1PromotionStrategyStatusEnvironmentsItems0ProposedHydrated + note?: PromoterArgoprojIoV1alpha1PromotionStrategyStatusEnvironmentsItems0ProposedNote + schema PromoterArgoprojIoV1alpha1PromotionStrategyStatusEnvironmentsItems0ProposedCommitStatusesItems0: r""" @@ -1257,6 +1451,97 @@ schema PromoterArgoprojIoV1alpha1PromotionStrategyStatusEnvironmentsItems0Propos _regex_match(str(repoURL), r"^(https?://.*)?$") if repoURL +schema PromoterArgoprojIoV1alpha1PromotionStrategyStatusEnvironmentsItems0ProposedNote: + r""" + Note is the hydrator metadata from the git note attached to the hydrated commit. + + Attributes + ---------- + author : str, default is Undefined, optional + Author is the author of the dry commit that was used to hydrate the branch. + body : str, default is Undefined, optional + Body is the body of the dry commit that was used to hydrate the branch without the subject. + date : str, default is Undefined, optional + Date is the date of the dry commit that was used to hydrate the branch. + drySha : str, default is Undefined, optional + DrySha is the SHA of the commit that was used as the dry source for hydration. + references : [PromoterArgoprojIoV1alpha1PromotionStrategyStatusEnvironmentsItems0ProposedNoteReferencesItems0], default is Undefined, optional + References are the references to other commits, that went into the hydration of the branch. + repoURL : str, default is Undefined, optional + RepoURL is the URL of the repository where the commit is located. + subject : str, default is Undefined, optional + Subject is the subject line of the dry commit that was used to hydrate the branch. + """ + + + author?: str + + body?: str + + date?: str + + drySha?: str + + references?: [PromoterArgoprojIoV1alpha1PromotionStrategyStatusEnvironmentsItems0ProposedNoteReferencesItems0] + + repoURL?: str + + subject?: str + + +schema PromoterArgoprojIoV1alpha1PromotionStrategyStatusEnvironmentsItems0ProposedNoteReferencesItems0: + r""" + RevisionReference contains a reference to a some information that is related in some way to another commit. For now, + it supports only references to a commit. In the future, it may support other types of references. + + Attributes + ---------- + commit : PromoterArgoprojIoV1alpha1PromotionStrategyStatusEnvironmentsItems0ProposedNoteReferencesItems0Commit, default is Undefined, optional + commit + """ + + + commit?: PromoterArgoprojIoV1alpha1PromotionStrategyStatusEnvironmentsItems0ProposedNoteReferencesItems0Commit + + +schema PromoterArgoprojIoV1alpha1PromotionStrategyStatusEnvironmentsItems0ProposedNoteReferencesItems0Commit: + r""" + Commit contains metadata about the commit that is related in some way to another commit. + + Attributes + ---------- + author : str, default is Undefined, optional + Author is the author of the commit. + body : str, default is Undefined, optional + Body is the body of the commit message, excluding the subject line, i.e. `git show --format=%b`. + date : str, default is Undefined, optional + Date is the date of the commit, formatted as by `git show -s --format=%aI`. + repoURL : str, default is Undefined, optional + RepoURL is the URL of the repository where the commit is located. + sha : str, default is Undefined, optional + Sha is the commit hash. + subject : str, default is Undefined, optional + Subject is the subject line of the commit message, i.e. `git show --format=%s`. + """ + + + author?: str + + body?: str + + date?: str + + repoURL?: str + + sha?: str + + subject?: str + + + check: + _regex_match(str(repoURL), r"^(https?://.*)?$") if repoURL + + schema PromoterArgoprojIoV1alpha1PromotionStrategyStatusEnvironmentsItems0PullRequest: r""" PullRequest is the state of the pull request that was created for this environment. diff --git a/gitops-promoter/v1alpha1/promoter_argoproj_io_v1alpha1_scm_provider.k b/gitops-promoter/v1alpha1/promoter_argoproj_io_v1alpha1_scm_provider.k index b2ee1c9f..437de472 100644 --- a/gitops-promoter/v1alpha1/promoter_argoproj_io_v1alpha1_scm_provider.k +++ b/gitops-promoter/v1alpha1/promoter_argoproj_io_v1alpha1_scm_provider.k @@ -43,6 +43,8 @@ schema PromoterArgoprojIoV1alpha1ScmProviderSpec: Attributes ---------- + bitbucketCloud : any, default is Undefined, optional + BitbucketCloud required configuration for Bitbucket Cloud as the SCM provider fake : PromoterArgoprojIoV1alpha1ScmProviderSpecFake, default is Undefined, optional fake forgejo : PromoterArgoprojIoV1alpha1ScmProviderSpecForgejo, default is Undefined, optional @@ -56,6 +58,8 @@ schema PromoterArgoprojIoV1alpha1ScmProviderSpec: """ + bitbucketCloud?: any + fake?: PromoterArgoprojIoV1alpha1ScmProviderSpecFake forgejo?: PromoterArgoprojIoV1alpha1ScmProviderSpecForgejo