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

Refactor pipelinerun resolution to clarify status #3360

Merged
merged 1 commit into from
Oct 12, 2020

Conversation

jerop
Copy link
Member

@jerop jerop commented Oct 9, 2020

Changes

Refactoring the pipelinerun resolution, the main changes are:

  • simplifying IsSuccessful, IsDone, checkParentsDone functions

  • removing inconsistencies on what Done means; it had different meanings in different functions, that is sometimes it meant that the status is:

    • not unknown, e.g:
      // IsDone returns true if the ConditionCheck's status indicates that it is done.
      func (cc *ConditionCheck) IsDone() bool {
      return !cc.Status.GetCondition(apis.ConditionSucceeded).IsUnknown()
      }
    • successful or failure, e.g:
      func (t ResolvedPipelineRunTask) IsDone() bool {
      if t.TaskRun == nil || t.PipelineTask == nil {
      return false
      }
      status := t.TaskRun.Status.GetCondition(apis.ConditionSucceeded)
      retriesDone := len(t.TaskRun.Status.RetriesStatus)
      retries := t.PipelineTask.Retries
      return status.IsTrue() || status.IsFalse() && retriesDone >= retries
    • is successful or failure or skipped, e.g:
      // checkTasksDone returns true if all tasks from the specified graph are finished executing
      // a task is considered done if it has failed/succeeded/skipped
      func (facts *PipelineRunFacts) checkTasksDone(d *dag.Graph) bool {
      for _, t := range facts.State {
      if isTaskInGraph(t.PipelineTask.Name, d) {
      if t.TaskRun == nil {
      // this task might have skipped if taskRun is nil
      // continue and ignore if this task was skipped
      // skipped task is considered part of done
      if t.Skip(facts) {
      continue
      }
      return false
      }
      if !t.IsDone() {
      return false
      }
      }
      }
      return true
      }

    updated such that done consistently means successful or failure or skipped

Submitter Checklist

These are the criteria that every PR should meet, please check them off as you
review them:

  • Includes tests (if functionality changed/added)
  • Includes docs (if user facing)
  • Commit messages follow commit message best practices
  • Release notes block has been filled in or deleted (only if no user facing changes)

See the contribution guide for more details.

Double check this list of stuff that's easy to miss:

Reviewer Notes

If API changes are included, additive changes must be approved by at least two OWNERS and backwards incompatible changes must be approved by more than 50% of the OWNERS, and they must first be added in a backwards compatible way.

Release Notes

NONE

/kind cleanup
/cc @bobcatfish

@tekton-robot tekton-robot added do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. release-note Denotes a PR that will be considered when it comes time to generate release notes. labels Oct 9, 2020
@tekton-robot tekton-robot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. release-note-none Denotes a PR that doesnt merit a release note. kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. and removed release-note Denotes a PR that will be considered when it comes time to generate release notes. labels Oct 9, 2020
@tekton-robot
Copy link
Collaborator

The following is the coverage report on the affected files.
Say /test pull-tekton-pipeline-go-coverage to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/reconciler/pipelinerun/resources/pipelinerunresolution.go 86.8% 87.0% 0.2

@jerop jerop marked this pull request as ready for review October 9, 2020 16:45
@tekton-robot tekton-robot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Oct 9, 2020
@jerop
Copy link
Member Author

jerop commented Oct 9, 2020

/test check-pr-has-kind-label

@jerop jerop changed the title Refactor pipelinerun resolution Refactor pipelinerun resolution #1 - clarify status of ResolvedPipelineRunTask Oct 9, 2020
@jerop jerop changed the title Refactor pipelinerun resolution #1 - clarify status of ResolvedPipelineRunTask Refactor pipelinerun resolution to clarify status Oct 9, 2020
@tekton-robot
Copy link
Collaborator

The following is the coverage report on the affected files.
Say /test pull-tekton-pipeline-go-coverage to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/reconciler/pipelinerun/resources/pipelinerunresolution.go 86.8% 86.7% -0.0

@jerop jerop marked this pull request as draft October 9, 2020 18:32
@jerop jerop force-pushed the graph branch 2 times, most recently from 1314c25 to 754013d Compare October 9, 2020 20:45
@tekton-robot
Copy link
Collaborator

The following is the coverage report on the affected files.
Say /test pull-tekton-pipeline-go-coverage to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/reconciler/pipelinerun/resources/pipelinerunresolution.go 86.8% 86.8% 0.0
pkg/reconciler/pipelinerun/resources/pipelinerunstate.go 70.9% 69.9% -0.9

@tekton-robot
Copy link
Collaborator

The following is the coverage report on the affected files.
Say /test pull-tekton-pipeline-go-coverage to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/reconciler/pipelinerun/resources/pipelinerunresolution.go 86.8% 86.8% 0.0
pkg/reconciler/pipelinerun/resources/pipelinerunstate.go 70.9% 69.9% -0.9

Refactoring the resolution, which includes:
- removing ambiguity on what `Done` means; it had different meanings in
different functions i.e. sometimes it meant that (1) the status is not
unknown, (2) the status is successful or failure, and (3) the status is
successful or failure or skipped -- updated so that it's consistently that
the status is successful or failure or skipped
- simplifying the function that checks if a pipelinetask is successful
@jerop jerop marked this pull request as ready for review October 9, 2020 20:57
@tekton-robot
Copy link
Collaborator

The following is the coverage report on the affected files.
Say /test pull-tekton-pipeline-go-coverage to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/reconciler/pipelinerun/resources/pipelinerunresolution.go 86.8% 86.8% 0.0
pkg/reconciler/pipelinerun/resources/pipelinerunstate.go 70.9% 69.9% -0.9

@jerop
Copy link
Member Author

jerop commented Oct 9, 2020

/test pull-tekton-pipeline-integration-tests

Copy link
Member

@vdemeester vdemeester left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/lgtm

@tekton-robot tekton-robot added the lgtm Indicates that a PR is ready to be merged. label Oct 12, 2020
@dlorenc
Copy link
Contributor

dlorenc commented Oct 12, 2020

/approve

@tekton-robot
Copy link
Collaborator

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: dlorenc

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@tekton-robot tekton-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Oct 12, 2020
@jerop
Copy link
Member Author

jerop commented Oct 12, 2020

/test pull-tekton-pipeline-integration-tests

1 similar comment
@jerop
Copy link
Member Author

jerop commented Oct 12, 2020

/test pull-tekton-pipeline-integration-tests

@tekton-robot tekton-robot merged commit 3185d05 into tektoncd:master Oct 12, 2020
@jerop jerop deleted the graph branch June 11, 2022 01:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. lgtm Indicates that a PR is ready to be merged. release-note-none Denotes a PR that doesnt merit a release note. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants