Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for more cloud events #2677

Merged
merged 2 commits into from
Jun 8, 2020

Commits on Jun 8, 2020

  1. Add support for more cloud events

    Change the event type string for taskruns from dev.tekton.event.task.*
    to dev.tekton.event.taskrun.*. Since cloud events are only sent by
    pipeline resources - which are alpha - we don't need to comply with
    the beta deprecation policy for this.
    
    Extend the cloudevents module to include more event types for TaskRuns
    and event types for PipelineRuns, with unit test coverage.
    This is achieved by introducing the RunsToCompletion and
    RunsToCompletionStatus interface which are met by TaskRun, PipelineRun
    and their respective status types.
    
    At this stage there is no event producer that generates these new
    events. This is preparing the stage for the next changes where
    we will start to emit cloud events in addition to the k8s events
    we emit today.
    
    Partially addresses tektoncd#2082
    Partially addresses tektoncd#2684
    
    Signed-off-by: Andrea Frittoli <[email protected]>
    afrittoli committed Jun 8, 2020
    Configuration menu
    Copy the full SHA
    514b240 View commit details
    Browse the repository at this point in the history
  2. Make phase condition reasons part of the API

    TaskRuns and PipelineRuns use the "Reason" field to complement the
    value of the "Succeeded" condition. Those values are not part of
    the API and are even owned by the underlying resource (pod) in
    case of TaskRuns. This makes it difficult to rely on them to
    understand that the state of the resource is.
    
    In case of corev1.ConditionTrue, the reason can be used to
    distinguish between:
    - Successful
    - Successful, some parts were skipped (pipelinerun only)
    
    In case of corev1.ConditionFalse, the reason can be used to
    distinguish between:
    - Failed
    - Failed because of timeout
    - Failed because of cancelled by the user
    
    In case of corev1.ConditionUnknown, the reason can be used to
    distinguish between:
    - Just started reconciling
    - Validation done, running (or still running)
    - Cancellation requested
    
    This is implemented through the following changes:
    - Bubble-up reasons for taskrun and pipelinerun to the
      v1beta1 API, except for reason that are defined by the
      underlying resource
    - Enforce the start reason to be set during condition init
    
    This allows for an additional change in the eventing module: the
    condition before and after can be used to decide whether to send
    an event at all. If they are different, the after condition now
    contains enough information to send the event.
    
    The cloudevent module is extended with ability to send the correct
    event based on both status and reason.
    afrittoli committed Jun 8, 2020
    Configuration menu
    Copy the full SHA
    84fbdb4 View commit details
    Browse the repository at this point in the history