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

feat(RELEASE-914): add collectors phase #586

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Conversation

davidmogar
Copy link
Collaborator

This change enables the execution of the collectors pipeline.

Signed-off-by: David Moreno García [email protected]

Copy link

openshift-ci bot commented Oct 13, 2024

Skipping CI for Draft Pull Request.
If you want CI signal for your change, please convert it to an actual PR.
You can still manually trigger a test run with /test all

@davidmogar
Copy link
Collaborator Author

/retest

tekton/utils.go Show resolved Hide resolved
loader/loader.go Show resolved Hide resolved
api/v1alpha1/release_types.go Outdated Show resolved Hide resolved
api/v1alpha1/release_types.go Show resolved Hide resolved
api/v1alpha1/release_types.go Show resolved Hide resolved
controllers/release/adapter.go Outdated Show resolved Hide resolved
controllers/release/adapter.go Show resolved Hide resolved
controllers/release/adapter_test.go Outdated Show resolved Hide resolved
controllers/release/adapter_test.go Outdated Show resolved Hide resolved
@@ -1465,37 +1760,206 @@ var _ = Describe("Release adapter", Ordered, func() {
BeforeEach(func() {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Couldn't this be AfterAll and BeforeAll instead of creating and deleting the pipelinerun between each run? Since no change is made before the creation

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Maybe but as we use AfterEach and BeforeEach in every single test to not condition tests within a when block, I kept it like that.

controllers/release/adapter.go Show resolved Hide resolved
controllers/release/adapter.go Outdated Show resolved Hide resolved
controllers/release/adapter.go Show resolved Hide resolved
loader/loader.go Show resolved Hide resolved
// +optional
Collectors []Collector `json:"collectors,omitempty"`
Collectors *Collectors `json:"collectors,omitempty"`
Copy link
Collaborator

Choose a reason for hiding this comment

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

this requires the RP to look like this to be able to be applied:

---
apiVersion: appstudio.redhat.com/v1alpha1
kind: ReleasePlan
metadata:
  labels:
    release.appstudio.openshift.io/auto-release: 'true'
    release.appstudio.openshift.io/standing-attribution: 'true'
  name: collect-rp
spec:
  application: rh-advisories
  collectors:
    items:
      - name: scott-test
        params:
          - name: scott
            value: tom
        timeout: 60
        type: scott-type

I don't think we want items there do we?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

We want to add a service account that is used by all the collectors so we had to add both keys, items and serviceAccountName.

Copy link
Collaborator

Choose a reason for hiding this comment

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

I think having this items key is really ugly and not intuitive as none of the lists we have in any other CRDs has you list items

var revision string
var err error

if releasePlanAdmission != nil {
Copy link
Collaborator

Choose a reason for hiding this comment

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

if you do not have a RPA, then revision is empty and the empty param value is passed....which is incorrect.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

True. Addressed.

This change enables the execution of the collectors pipeline.

Signed-off-by: David Moreno García <[email protected]>
@@ -233,7 +371,8 @@ func (a *adapter) EnsureTenantPipelineIsProcessed() (controller.OperationResult,
// EnsureManagedPipelineIsProcessed is an operation that will ensure that a managed Release PipelineRun associated to the Release
// being processed and a RoleBinding to grant its serviceAccount permissions exist. Otherwise, it will create them.
func (a *adapter) EnsureManagedPipelineIsProcessed() (controller.OperationResult, error) {
if a.release.HasManagedPipelineProcessingFinished() || !a.release.HasTenantPipelineProcessingFinished() {
if a.release.HasManagedPipelineProcessingFinished() || !a.release.HasTenantPipelineProcessingFinished() ||
!a.release.IsTenantPipelineProcessed() {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is this needed though?
If a.release.HasTenantPipelineProcessingFinished() is not true, that means hasPhaseFinished(tenantProcessedConditionType) is not true. That means the condition is nil or the condition is false and the reason isn't progressing

If a.release.IsTenantPipelineProcessed() is not true, that means isStatusConditionTrue(r.Status.Conditions, tenantProcessedConditionType) is not true. So, the condition is false or unknown. I am pretty sure we only set it to unknown with reason progressing, so this seems like the same check but maybe I am missing something

// +optional
Collectors []Collector `json:"collectors,omitempty"`
Collectors *Collectors `json:"collectors,omitempty"`
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think having this items key is really ugly and not intuitive as none of the lists we have in any other CRDs has you list items

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants