Skip to content

Scorecard2 pod execution #2890

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

Merged
merged 78 commits into from
Apr 28, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
78 commits
Select commit Hold shift + click to select a range
32087a9
add build of scorecard-test image, wire it into the scorecard-test im…
Apr 16, 2020
45c3d34
add a sample config file and pod spec, plus remove a log message from…
Apr 16, 2020
857e056
add start of pod definition
Apr 16, 2020
2e6db59
split out kubeclient and testpod
Apr 17, 2020
958e2ae
add random string to test pod names
Apr 17, 2020
6a971a4
add interim pod log capture
Apr 17, 2020
43555bb
add output formatting
Apr 20, 2020
db2d6e5
split out CR helper
Apr 20, 2020
d861b3d
add suggestion for test names if user enters invalid test name in the…
Apr 20, 2020
f009ea8
convert all output to ScorecardOutput
Apr 20, 2020
87ad36d
add initial delete pod defer
Apr 20, 2020
3658568
make the bundle singular, refactor the CRs into a helper
Apr 21, 2020
50981f6
add tar and untar of configmap
Apr 21, 2020
474641b
add cleanup flag
Apr 22, 2020
467c2ae
update kube client logic to look in various places for the config
Apr 22, 2020
7ebf414
add waittime command flag, add pod wait logic
Apr 22, 2020
295bb5d
change waittime to wait-time for the flag name
Apr 22, 2020
0abefbb
refactor some code, create a relation between the test and the test pod
Apr 22, 2020
f7e6e13
fix get bundle to check for valid paths to avoid errors in the api call
Apr 23, 2020
7f0cb6d
refactor for linter and general cleanup
Apr 23, 2020
13d04fe
refactor the TestBundle into just a registry.Bundle
Apr 23, 2020
457046f
remove basic check status test as its not useful
Apr 23, 2020
e3f2b41
remove reference to basic check status test which was removed
Apr 23, 2020
606aa16
fix tests
Apr 23, 2020
34a411b
remove basic status test from config
Apr 23, 2020
3356aa5
updates based on pr review comments
Apr 23, 2020
ec7800e
add build of scorecard-test image, wire it into the scorecard-test im…
Apr 16, 2020
b59aa81
add a sample config file and pod spec, plus remove a log message from…
Apr 16, 2020
99ad3fb
add start of pod definition
Apr 16, 2020
300ee72
split out kubeclient and testpod
Apr 17, 2020
f98e8f4
add random string to test pod names
Apr 17, 2020
cb322e4
add interim pod log capture
Apr 17, 2020
d7c98ab
add output formatting
Apr 20, 2020
0bf89cd
split out CR helper
Apr 20, 2020
9464b84
add suggestion for test names if user enters invalid test name in the…
Apr 20, 2020
38cc7af
convert all output to ScorecardOutput
Apr 20, 2020
fe64d30
add initial delete pod defer
Apr 20, 2020
28224bf
make the bundle singular, refactor the CRs into a helper
Apr 21, 2020
b92ee61
add tar and untar of configmap
Apr 21, 2020
770f91c
add cleanup flag
Apr 22, 2020
0dc37a9
update kube client logic to look in various places for the config
Apr 22, 2020
a4f8884
add waittime command flag, add pod wait logic
Apr 22, 2020
2405569
change waittime to wait-time for the flag name
Apr 22, 2020
a13becc
refactor some code, create a relation between the test and the test pod
Apr 22, 2020
d6e7087
fix get bundle to check for valid paths to avoid errors in the api call
Apr 23, 2020
ba955d3
refactor for linter and general cleanup
Apr 23, 2020
f894e11
refactor the TestBundle into just a registry.Bundle
Apr 23, 2020
4a0baa0
remove basic check status test as its not useful
Apr 23, 2020
9d4cc1d
remove reference to basic check status test which was removed
Apr 23, 2020
ae9d02d
fix tests
Apr 23, 2020
61c1108
remove basic status test from config
Apr 23, 2020
8d21ee3
updates based on pr review comments
Apr 23, 2020
98cfa69
Merge branch 'scorecard2-pod-execution' of github.com:jmccormick2001/…
Apr 23, 2020
67b7518
Update cmd/operator-sdk/alpha/scorecard/cmd.go
Apr 24, 2020
521ae4d
Update cmd/operator-sdk/alpha/scorecard/cmd.go
Apr 24, 2020
c1fdf82
Update internal/scorecard/alpha/tests/test_bundle.go
Apr 24, 2020
61a6344
Update internal/scorecard/alpha/tests/test_bundle.go
Apr 24, 2020
6a41299
make updates based on PR reviews
Apr 24, 2020
a761a26
refactor output formatting into the cmd
Apr 24, 2020
b9cebae
fix linter issue
Apr 24, 2020
2137885
rename tar function name
Apr 24, 2020
1329a4a
Update cmd/operator-sdk/alpha/scorecard/cmd.go
Apr 24, 2020
d457c0e
fix skipcleanup
Apr 24, 2020
b44503a
refactor crhelper to avoid extraneous unmarshalling
Apr 24, 2020
49c3ad7
replace fmt.Print with log.Error in a few cases
Apr 24, 2020
54818cc
updates from PR review
Apr 27, 2020
b67d4ae
Update internal/scorecard/alpha/tests/crhelper.go
Apr 27, 2020
4efa124
Update internal/scorecard/alpha/tests/crhelper.go
Apr 27, 2020
04b2dbc
Update cmd/operator-sdk/alpha/scorecard/cmd.go
Apr 27, 2020
cc62112
Update internal/scorecard/alpha/config.go
Apr 27, 2020
5aa6bdc
rename ScorecardTest to Test and other PR review comments
Apr 27, 2020
7c02717
various updates from PR comments
Apr 27, 2020
660dd7c
cleanup fmt.Error calls
Apr 27, 2020
c06c512
refactor Options struct into Scorecard struct and add struct methods …
Apr 27, 2020
fffa03a
make entrypoints a collection in the config file format
Apr 27, 2020
8dc43b6
fix GetBundle return values
Apr 27, 2020
c3075df
fix unit tests
Apr 28, 2020
397c11f
fix image
Apr 28, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions internal/scorecard/alpha/formatting.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import (
"fmt"

"github.com/operator-framework/operator-sdk/pkg/apis/scorecard/v1alpha2"
log "github.com/sirupsen/logrus"
"k8s.io/client-go/kubernetes"
)

Expand All @@ -30,13 +31,13 @@ func getTestResults(client kubernetes.Interface, tests []ScorecardTest) (output
p := tests[i].TestPod
logBytes, err := getPodLog(client, p)
if err != nil {
fmt.Printf("error getting pod log %s\n", err.Error())
log.Errorf("Error getting pod log %s\n", err.Error())
Copy link
Member

@joelanford joelanford Apr 25, 2020

Choose a reason for hiding this comment

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

Rather than logging an error, we should convert this error to a ScorecardTestResult and append it to the list of results. Ditto for any other errors related to anything happening in a test run.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed.

} else {
// marshal pod log into ScorecardTestResult
var sc v1alpha2.ScorecardTestResult
err := json.Unmarshal(logBytes, &sc)
if err != nil {
fmt.Printf("error unmarshalling test result %s\n", err.Error())
log.Errorf("Error unmarshalling test result %s\n", err.Error())
} else {
output.Results = append(output.Results, sc)
}
Expand Down
3 changes: 2 additions & 1 deletion internal/scorecard/alpha/testconfigmap.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ package alpha
import (
"fmt"

log "github.com/sirupsen/logrus"
v1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/client-go/kubernetes"
Expand Down Expand Up @@ -54,6 +55,6 @@ func getConfigMapDefinition(namespace string, bundleData []byte) *v1.ConfigMap {
func deleteConfigMap(client kubernetes.Interface, configMap *v1.ConfigMap) {
err := client.CoreV1().ConfigMaps(configMap.Namespace).Delete(configMap.Name, &metav1.DeleteOptions{})
if err != nil {
fmt.Printf("error deleting configMap %s %s", configMap.Name, err.Error())
log.Errorf("Error deleting configMap %s %s", configMap.Name, err.Error())
}
}
3 changes: 2 additions & 1 deletion internal/scorecard/alpha/testpod.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import (
"math/rand"
"time"

log "github.com/sirupsen/logrus"
v1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/client-go/kubernetes"
Expand Down Expand Up @@ -118,7 +119,7 @@ func deletePods(client kubernetes.Interface, tests []ScorecardTest) {
p := tests[i].TestPod
err := client.CoreV1().Pods(p.Namespace).Delete(p.Name, &metav1.DeleteOptions{})
if err != nil {
fmt.Printf("error deleting pod %s %s\n", p.Name, err.Error())
log.Errorf("Error deleting pod %s %s\n", p.Name, err.Error())
}

}
Expand Down