-
Notifications
You must be signed in to change notification settings - Fork 41
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
KONFLUX-5971&STONEINTG-996: set intg test status in git according to build PLR and snapshot creation status #962
Conversation
Signed-off-by: Hongwei Liu <[email protected]>
2857143
to
f47f020
Compare
status/reporter_gitlab.go
Outdated
if err != nil { | ||
r.logger.Error(err, "failed to get PAC token from snapshot", | ||
"snapshot.NameSpace", snapshot.Namespace, "snapshot.Name", snapshot.Name) | ||
r.logger.Error(err, "failed to get PAC token from object", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@dirgim Sorry for the later response. I meant to get the kind of object in this type of log or error message. But the Object
in "k8s.io/apimachinery/pkg/apis/meta/v1" doesn't support GetKind() function. Thanks!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I did some search and test and foundd the TypeMeta is lost when transforming data, and I plan to define a function to get object type as below. Thank you.
func GetObjectKind(obj metav1.Object) string {
if _, ok := obj.(*applicationapiv1alpha1.Snapshot); ok {
return "Snapshot"
}
if _, ok := obj.(*tektonv1.PipelineRun); ok {
return "PipelineRun"
}
return ""
}
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #962 +/- ##
=======================================
Coverage ? 64.23%
=======================================
Files ? 49
Lines ? 6316
Branches ? 0
=======================================
Hits ? 4057
Misses ? 1900
Partials ? 359 ☔ View full report in Codecov by Sentry. |
f47f020
to
25a41f4
Compare
c9cde5a
to
94b98c8
Compare
scenarioContext := scenarioContext //G601 | ||
if IsContextValidForSnapshot(scenarioContext.Name, snapshot) { | ||
return true | ||
if snapshot, ok := object.(*applicationapiv1alpha1.Snapshot); ok { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we do something like this (untested):
for _, scenarioContext := range scenario.Spec.Contexts {
scenarioContext := scenarioContext //G601
if snapshot, ok := object.(*applicationapiv1alpha1.Snapshot); ok {
return IsContextValidForSnapshot(scenarioContext.Name, snapshot)
}
if plr, ok := object.(*tektonv1.PipelineRun); ok {
return IsContextValidForBuildPLR(scenarioContext.Name, plr)
}
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Edit: I realize it is in a loop and return true
only when IsContextValidForSnapshot/BuildPLR()
is true
, otherwise we need to check next context.
8e9709c
to
3c89863
Compare
3c89863
to
6256714
Compare
/retest |
1 similar comment
/retest |
* set integration tests status to pending when build plr is triggered or retriggered * set integration test status to failed/cancelled when build plr fails * set integration test status to failed/cancelled with failure reason when snapshot is not created to show to users on git provider Signed-off-by: Hongwei Liu<[email protected]>
6256714
to
c75fedd
Compare
Checkrun example for the PR when snapshot is not created due to failing build PLR: https://github.com/hongweiliu17/devfile-sample-go-basic-1772/pull/2/checks |
As Kruno suggested in slack thread, using a fake snapshot to report integration test status to PR/MR. So I will create a new PR for this new solution. |
New PR #981 is created, then close this PR. |
retriggered
created to shown to users on git provider
Signed-off-by: Hongwei Liu[email protected]
Maintainers will complete the following section