diff --git a/WORKSPACE b/WORKSPACE index d5032459322..5de5abbf625 100644 --- a/WORKSPACE +++ b/WORKSPACE @@ -86,13 +86,6 @@ container_pull( tag = "v20210120-b86882c9314933ba1a0c77965ed9d54a747f7957", ) -container_pull( - name = "botreview-base", - registry = "index.docker.io", - repository = "alpine/git", - tag = "v2.40.1", -) - load( "@io_bazel_rules_docker//go:image.bzl", _go_image_repos = "repositories", diff --git a/external-plugins/botreview/Makefile b/external-plugins/botreview/Makefile index a0a84775da5..ae7e80a4017 100644 --- a/external-plugins/botreview/Makefile +++ b/external-plugins/botreview/Makefile @@ -13,5 +13,4 @@ test: $(bazelbin) test //external-plugins/botreview/... push: - $(bazelbin) run --stamp --workspace_status_command="./hack/print-workspace-status-no-git-tag.sh" //external-plugins/botreview:push - bash -x ../../hack/update-deployments-with-latest-image.sh quay.io/kubevirtci/botreview + podman build -f ./images/botreview/Containerfile -t quay.io/kubevirtci/botreview:latest && podman push quay.io/kubevirtci/botreview:latest diff --git a/external-plugins/botreview/README.md b/external-plugins/botreview/README.md index 0a6e6b8fd1d..10b9146be19 100644 --- a/external-plugins/botreview/README.md +++ b/external-plugins/botreview/README.md @@ -10,4 +10,4 @@ Updates in these PRs are mostly tedious to review for a human, since they contai What `botreview` can at least do is automate what a human would do anyway, like applying an expected change pattern to the changes. And this is what botreview does. -`botreview` has of course room for improval, i.e. it might generate a list of the images and check whether these are pull-able, or even perform further checks on the images. **Note: the latter is not implemented (yet)** +`botreview` has of course room for improvement, i.e. it might generate a list of the images and check whether these are pullable, or even perform further checks on the images. **Note: the latter is not implemented (yet)** diff --git a/external-plugins/botreview/review/bump_kubevirtci_test.go b/external-plugins/botreview/review/bump_kubevirtci_test.go index 69f938c99fb..48e8d72b322 100644 --- a/external-plugins/botreview/review/bump_kubevirtci_test.go +++ b/external-plugins/botreview/review/bump_kubevirtci_test.go @@ -28,26 +28,26 @@ import ( ) func TestBumpKubevirtCI_Review(t1 *testing.T) { - diffFilePathes := []string{} + diffFilePaths := []string{} entries, err := os.ReadDir("testdata/kubevirtci-bump") if err != nil { t1.Errorf("failed to read files: %v", err) } for _, entry := range entries { - diffFilePathes = append(diffFilePathes, filepath.Join("testdata/kubevirtci-bump", entry.Name())) + diffFilePaths = append(diffFilePaths, filepath.Join("testdata/kubevirtci-bump", entry.Name())) } - diffFilePathes = append(diffFilePathes, "testdata/mixed_bump_prow_job.patch0") - diffFilePathesToDiffs := map[string]*diff.FileDiff{} - for _, diffFile := range diffFilePathes { - bump_images_diff_file, err := os.ReadFile(diffFile) + diffFilePaths = append(diffFilePaths, "testdata/mixed_bump_prow_job.patch0") + diffFilePathsToDiffs := map[string]*diff.FileDiff{} + for _, diffFile := range diffFilePaths { + bumpImagesDiffFile, err := os.ReadFile(diffFile) if err != nil { t1.Errorf("failed to read diff: %v", err) } - bump_file_diffs, err := diff.ParseFileDiff(bump_images_diff_file) + bumpFileDiffs, err := diff.ParseFileDiff(bumpImagesDiffFile) if err != nil { t1.Errorf("failed to read diff: %v", err) } - diffFilePathesToDiffs[diffFile] = bump_file_diffs + diffFilePathsToDiffs[diffFile] = bumpFileDiffs } type fields struct { relevantFileDiffs []*diff.FileDiff @@ -61,14 +61,14 @@ func TestBumpKubevirtCI_Review(t1 *testing.T) { name: "simple prow autobump", fields: fields{ relevantFileDiffs: []*diff.FileDiff{ - diffFilePathesToDiffs["testdata/kubevirtci-bump/cluster-up-sha.txt"], - diffFilePathesToDiffs["testdata/kubevirtci-bump/cluster-up_cluster_kind-1.22-sriov_provider.sh"], - diffFilePathesToDiffs["testdata/kubevirtci-bump/cluster-up_cluster_kind-1.22-sriov_sriov-node_node.sh"], - diffFilePathesToDiffs["testdata/kubevirtci-bump/cluster-up_cluster_kind_common.sh"], - diffFilePathesToDiffs["testdata/kubevirtci-bump/cluster-up_cluster_kind_configure-registry-proxy.sh"], - diffFilePathesToDiffs["testdata/kubevirtci-bump/cluster-up_hack_common.sh"], - diffFilePathesToDiffs["testdata/kubevirtci-bump/cluster-up_version.txt"], - diffFilePathesToDiffs["testdata/kubevirtci-bump/hack_config-default.sh"], + diffFilePathsToDiffs["testdata/kubevirtci-bump/cluster-up-sha.txt"], + diffFilePathsToDiffs["testdata/kubevirtci-bump/cluster-up_cluster_kind-1.22-sriov_provider.sh"], + diffFilePathsToDiffs["testdata/kubevirtci-bump/cluster-up_cluster_kind-1.22-sriov_sriov-node_node.sh"], + diffFilePathsToDiffs["testdata/kubevirtci-bump/cluster-up_cluster_kind_common.sh"], + diffFilePathsToDiffs["testdata/kubevirtci-bump/cluster-up_cluster_kind_configure-registry-proxy.sh"], + diffFilePathsToDiffs["testdata/kubevirtci-bump/cluster-up_hack_common.sh"], + diffFilePathsToDiffs["testdata/kubevirtci-bump/cluster-up_version.txt"], + diffFilePathsToDiffs["testdata/kubevirtci-bump/hack_config-default.sh"], }, }, want: &BumpKubevirtCIResult{}, @@ -77,21 +77,21 @@ func TestBumpKubevirtCI_Review(t1 *testing.T) { name: "mixed image bump", fields: fields{ relevantFileDiffs: []*diff.FileDiff{ - diffFilePathesToDiffs["testdata/kubevirtci-bump/cluster-up-sha.txt"], - diffFilePathesToDiffs["testdata/kubevirtci-bump/cluster-up_cluster_kind-1.22-sriov_provider.sh"], - diffFilePathesToDiffs["testdata/mixed_bump_prow_job.patch0"], + diffFilePathsToDiffs["testdata/kubevirtci-bump/cluster-up-sha.txt"], + diffFilePathsToDiffs["testdata/kubevirtci-bump/cluster-up_cluster_kind-1.22-sriov_provider.sh"], + diffFilePathsToDiffs["testdata/mixed_bump_prow_job.patch0"], }, }, want: &BumpKubevirtCIResult{ - notMatchingHunks: map[string][]*diff.Hunk{"github/ci/prow-deploy/files/jobs/kubevirt/kubevirt/kubevirt-presubmits.yaml": diffFilePathesToDiffs["testdata/mixed_bump_prow_job.patch0"].Hunks}, + notMatchingHunks: map[string][]*diff.Hunk{"github/ci/prow-deploy/files/jobs/kubevirt/kubevirt/kubevirt-presubmits.yaml": diffFilePathsToDiffs["testdata/mixed_bump_prow_job.patch0"].Hunks}, }, }, } for _, tt := range tests { t1.Run(tt.name, func(t1 *testing.T) { t := &BumpKubevirtCI{} - for _, diff := range tt.fields.relevantFileDiffs { - t.AddIfRelevant(diff) + for _, fileDiff := range tt.fields.relevantFileDiffs { + t.AddIfRelevant(fileDiff) } if got := t.Review(); !reflect.DeepEqual(got, tt.want) { t1.Errorf("Review() = %v, want %v", got, tt.want) diff --git a/external-plugins/botreview/review/image_update_test.go b/external-plugins/botreview/review/image_update_test.go index 4b600209473..545902217e7 100644 --- a/external-plugins/botreview/review/image_update_test.go +++ b/external-plugins/botreview/review/image_update_test.go @@ -27,22 +27,22 @@ import ( ) func TestProwJobImageUpdate_Review(t1 *testing.T) { - diffFilePathes := []string{ + diffFilePaths := []string{ "testdata/simple_bump-prow-job-images_sh.patch0", "testdata/simple_bump-prow-job-images_sh.patch1", "testdata/mixed_bump_prow_job.patch0", } - diffFilePathesToDiffs := map[string]*diff.FileDiff{} - for _, diffFile := range diffFilePathes { - bump_images_diff_file, err := os.ReadFile(diffFile) + diffFilePathsToDiffs := map[string]*diff.FileDiff{} + for _, diffFile := range diffFilePaths { + bumpImagesDiffFile, err := os.ReadFile(diffFile) if err != nil { t1.Errorf("failed to read diff: %v", err) } - bump_file_diffs, err := diff.ParseFileDiff(bump_images_diff_file) + bumpFileDiffs, err := diff.ParseFileDiff(bumpImagesDiffFile) if err != nil { t1.Errorf("failed to read diff: %v", err) } - diffFilePathesToDiffs[diffFile] = bump_file_diffs + diffFilePathsToDiffs[diffFile] = bumpFileDiffs } type fields struct { relevantFileDiffs []*diff.FileDiff @@ -56,8 +56,8 @@ func TestProwJobImageUpdate_Review(t1 *testing.T) { name: "simple image bump", fields: fields{ relevantFileDiffs: []*diff.FileDiff{ - diffFilePathesToDiffs["testdata/simple_bump-prow-job-images_sh.patch0"], - diffFilePathesToDiffs["testdata/simple_bump-prow-job-images_sh.patch1"], + diffFilePathsToDiffs["testdata/simple_bump-prow-job-images_sh.patch0"], + diffFilePathsToDiffs["testdata/simple_bump-prow-job-images_sh.patch1"], }, }, want: &ProwJobImageUpdateResult{}, @@ -66,11 +66,11 @@ func TestProwJobImageUpdate_Review(t1 *testing.T) { name: "mixed image bump", fields: fields{ relevantFileDiffs: []*diff.FileDiff{ - diffFilePathesToDiffs["testdata/mixed_bump_prow_job.patch0"], + diffFilePathsToDiffs["testdata/mixed_bump_prow_job.patch0"], }, }, want: &ProwJobImageUpdateResult{ - notMatchingHunks: map[string][]*diff.Hunk{"github/ci/prow-deploy/files/jobs/kubevirt/kubevirt/kubevirt-presubmits.yaml": {diffFilePathesToDiffs["testdata/mixed_bump_prow_job.patch0"].Hunks[0]}}, + notMatchingHunks: map[string][]*diff.Hunk{"github/ci/prow-deploy/files/jobs/kubevirt/kubevirt/kubevirt-presubmits.yaml": {diffFilePathsToDiffs["testdata/mixed_bump_prow_job.patch0"].Hunks[0]}}, }, }, } diff --git a/external-plugins/botreview/review/prow_autobump_test.go b/external-plugins/botreview/review/prow_autobump_test.go index 27bf4dd74df..c60ebfbd23b 100644 --- a/external-plugins/botreview/review/prow_autobump_test.go +++ b/external-plugins/botreview/review/prow_autobump_test.go @@ -28,25 +28,25 @@ import ( ) func TestProwAutobump_Review(t1 *testing.T) { - diffFilePathes := []string{} + diffFilePaths := []string{} entries, err := os.ReadDir("testdata/prow-autobump") if err != nil { t1.Errorf("failed to read files: %v", err) } for _, entry := range entries { - diffFilePathes = append(diffFilePathes, filepath.Join("testdata/prow-autobump", entry.Name())) + diffFilePaths = append(diffFilePaths, filepath.Join("testdata/prow-autobump", entry.Name())) } - diffFilePathesToDiffs := map[string]*diff.FileDiff{} - for _, diffFile := range diffFilePathes { - bump_images_diff_file, err := os.ReadFile(diffFile) + diffFilePathsToDiffs := map[string]*diff.FileDiff{} + for _, diffFile := range diffFilePaths { + bumpImagesDiffFile, err := os.ReadFile(diffFile) if err != nil { t1.Errorf("failed to read diff: %v", err) } - bump_file_diffs, err := diff.ParseFileDiff(bump_images_diff_file) + bumpFileDiffs, err := diff.ParseFileDiff(bumpImagesDiffFile) if err != nil { t1.Errorf("failed to read diff: %v", err) } - diffFilePathesToDiffs[diffFile] = bump_file_diffs + diffFilePathsToDiffs[diffFile] = bumpFileDiffs } type fields struct { relevantFileDiffs []*diff.FileDiff @@ -60,22 +60,22 @@ func TestProwAutobump_Review(t1 *testing.T) { name: "simple prow autobump", fields: fields{ relevantFileDiffs: []*diff.FileDiff{ - diffFilePathesToDiffs["testdata/prow-autobump/github_ci_prow-deploy_kustom_base_configs_current_config_config.yaml"], - diffFilePathesToDiffs["testdata/prow-autobump/github_ci_prow-deploy_kustom_base_manifests_local_branch-protector.yaml"], - diffFilePathesToDiffs["testdata/prow-autobump/github_ci_prow-deploy_kustom_base_manifests_local_cherrypicker_deployment.yaml"], - diffFilePathesToDiffs["testdata/prow-autobump/github_ci_prow-deploy_kustom_base_manifests_local_label-sync-kubevirt.yaml"], - diffFilePathesToDiffs["testdata/prow-autobump/github_ci_prow-deploy_kustom_base_manifests_local_label-sync-nmstate.yaml"], - diffFilePathesToDiffs["testdata/prow-autobump/github_ci_prow-deploy_kustom_base_manifests_test_infra_current_crier_deployment.yaml"], - diffFilePathesToDiffs["testdata/prow-autobump/github_ci_prow-deploy_kustom_base_manifests_test_infra_current_deck_deployment.yaml"], - diffFilePathesToDiffs["testdata/prow-autobump/github_ci_prow-deploy_kustom_base_manifests_test_infra_current_ghproxy.yaml"], - diffFilePathesToDiffs["testdata/prow-autobump/github_ci_prow-deploy_kustom_base_manifests_test_infra_current_hook_deployment.yaml"], - diffFilePathesToDiffs["testdata/prow-autobump/github_ci_prow-deploy_kustom_base_manifests_test_infra_current_horologium_deployment.yaml"], - diffFilePathesToDiffs["testdata/prow-autobump/github_ci_prow-deploy_kustom_base_manifests_test_infra_current_needs-rebase_deployment.yaml"], - diffFilePathesToDiffs["testdata/prow-autobump/github_ci_prow-deploy_kustom_base_manifests_test_infra_current_prow_controller_manager_deployment.yaml"], - diffFilePathesToDiffs["testdata/prow-autobump/github_ci_prow-deploy_kustom_base_manifests_test_infra_current_sinker_deployment.yaml"], - diffFilePathesToDiffs["testdata/prow-autobump/github_ci_prow-deploy_kustom_base_manifests_test_infra_current_statusreconciler_deployment.yaml"], - diffFilePathesToDiffs["testdata/prow-autobump/github_ci_prow-deploy_kustom_base_manifests_test_infra_current_tide_deployment.yaml"], - diffFilePathesToDiffs["testdata/prow-autobump/github_ci_prow-deploy_kustom_overlays_ibmcloud-production_resources_prow-exporter-deployment.yaml"], + diffFilePathsToDiffs["testdata/prow-autobump/github_ci_prow-deploy_kustom_base_configs_current_config_config.yaml"], + diffFilePathsToDiffs["testdata/prow-autobump/github_ci_prow-deploy_kustom_base_manifests_local_branch-protector.yaml"], + diffFilePathsToDiffs["testdata/prow-autobump/github_ci_prow-deploy_kustom_base_manifests_local_cherrypicker_deployment.yaml"], + diffFilePathsToDiffs["testdata/prow-autobump/github_ci_prow-deploy_kustom_base_manifests_local_label-sync-kubevirt.yaml"], + diffFilePathsToDiffs["testdata/prow-autobump/github_ci_prow-deploy_kustom_base_manifests_local_label-sync-nmstate.yaml"], + diffFilePathsToDiffs["testdata/prow-autobump/github_ci_prow-deploy_kustom_base_manifests_test_infra_current_crier_deployment.yaml"], + diffFilePathsToDiffs["testdata/prow-autobump/github_ci_prow-deploy_kustom_base_manifests_test_infra_current_deck_deployment.yaml"], + diffFilePathsToDiffs["testdata/prow-autobump/github_ci_prow-deploy_kustom_base_manifests_test_infra_current_ghproxy.yaml"], + diffFilePathsToDiffs["testdata/prow-autobump/github_ci_prow-deploy_kustom_base_manifests_test_infra_current_hook_deployment.yaml"], + diffFilePathsToDiffs["testdata/prow-autobump/github_ci_prow-deploy_kustom_base_manifests_test_infra_current_horologium_deployment.yaml"], + diffFilePathsToDiffs["testdata/prow-autobump/github_ci_prow-deploy_kustom_base_manifests_test_infra_current_needs-rebase_deployment.yaml"], + diffFilePathsToDiffs["testdata/prow-autobump/github_ci_prow-deploy_kustom_base_manifests_test_infra_current_prow_controller_manager_deployment.yaml"], + diffFilePathsToDiffs["testdata/prow-autobump/github_ci_prow-deploy_kustom_base_manifests_test_infra_current_sinker_deployment.yaml"], + diffFilePathsToDiffs["testdata/prow-autobump/github_ci_prow-deploy_kustom_base_manifests_test_infra_current_statusreconciler_deployment.yaml"], + diffFilePathsToDiffs["testdata/prow-autobump/github_ci_prow-deploy_kustom_base_manifests_test_infra_current_tide_deployment.yaml"], + diffFilePathsToDiffs["testdata/prow-autobump/github_ci_prow-deploy_kustom_overlays_ibmcloud-production_resources_prow-exporter-deployment.yaml"], }, }, want: &ProwAutobumpResult{}, @@ -84,28 +84,28 @@ func TestProwAutobump_Review(t1 *testing.T) { name: "prow autobump with crd update", fields: fields{ relevantFileDiffs: []*diff.FileDiff{ - diffFilePathesToDiffs["testdata/prow-autobump/github_ci_prow-deploy_kustom_base_configs_current_config_config.yaml"], - diffFilePathesToDiffs["testdata/prow-autobump/github_ci_prow-deploy_kustom_base_manifests_local_branch-protector.yaml"], - diffFilePathesToDiffs["testdata/prow-autobump/github_ci_prow-deploy_kustom_base_manifests_local_cherrypicker_deployment.yaml"], - diffFilePathesToDiffs["testdata/prow-autobump/github_ci_prow-deploy_kustom_base_manifests_local_label-sync-kubevirt.yaml"], - diffFilePathesToDiffs["testdata/prow-autobump/github_ci_prow-deploy_kustom_base_manifests_local_label-sync-nmstate.yaml"], - diffFilePathesToDiffs["testdata/prow-autobump/github_ci_prow-deploy_kustom_base_manifests_test_infra_current_crier_deployment.yaml"], - diffFilePathesToDiffs["testdata/prow-autobump/github_ci_prow-deploy_kustom_base_manifests_test_infra_current_deck_deployment.yaml"], - diffFilePathesToDiffs["testdata/prow-autobump/github_ci_prow-deploy_kustom_base_manifests_test_infra_current_ghproxy.yaml"], - diffFilePathesToDiffs["testdata/prow-autobump/github_ci_prow-deploy_kustom_base_manifests_test_infra_current_hook_deployment.yaml"], - diffFilePathesToDiffs["testdata/prow-autobump/github_ci_prow-deploy_kustom_base_manifests_test_infra_current_horologium_deployment.yaml"], - diffFilePathesToDiffs["testdata/prow-autobump/github_ci_prow-deploy_kustom_base_manifests_test_infra_current_needs-rebase_deployment.yaml"], - diffFilePathesToDiffs["testdata/prow-autobump/github_ci_prow-deploy_kustom_base_manifests_test_infra_current_prow_controller_manager_deployment.yaml"], - diffFilePathesToDiffs["testdata/prow-autobump/github_ci_prow-deploy_kustom_base_manifests_test_infra_current_prowjob-crd_prowjob_customresourcedefinition.yaml"], - diffFilePathesToDiffs["testdata/prow-autobump/github_ci_prow-deploy_kustom_base_manifests_test_infra_current_sinker_deployment.yaml"], - diffFilePathesToDiffs["testdata/prow-autobump/github_ci_prow-deploy_kustom_base_manifests_test_infra_current_statusreconciler_deployment.yaml"], - diffFilePathesToDiffs["testdata/prow-autobump/github_ci_prow-deploy_kustom_base_manifests_test_infra_current_tide_deployment.yaml"], - diffFilePathesToDiffs["testdata/prow-autobump/github_ci_prow-deploy_kustom_overlays_ibmcloud-production_resources_prow-exporter-deployment.yaml"], + diffFilePathsToDiffs["testdata/prow-autobump/github_ci_prow-deploy_kustom_base_configs_current_config_config.yaml"], + diffFilePathsToDiffs["testdata/prow-autobump/github_ci_prow-deploy_kustom_base_manifests_local_branch-protector.yaml"], + diffFilePathsToDiffs["testdata/prow-autobump/github_ci_prow-deploy_kustom_base_manifests_local_cherrypicker_deployment.yaml"], + diffFilePathsToDiffs["testdata/prow-autobump/github_ci_prow-deploy_kustom_base_manifests_local_label-sync-kubevirt.yaml"], + diffFilePathsToDiffs["testdata/prow-autobump/github_ci_prow-deploy_kustom_base_manifests_local_label-sync-nmstate.yaml"], + diffFilePathsToDiffs["testdata/prow-autobump/github_ci_prow-deploy_kustom_base_manifests_test_infra_current_crier_deployment.yaml"], + diffFilePathsToDiffs["testdata/prow-autobump/github_ci_prow-deploy_kustom_base_manifests_test_infra_current_deck_deployment.yaml"], + diffFilePathsToDiffs["testdata/prow-autobump/github_ci_prow-deploy_kustom_base_manifests_test_infra_current_ghproxy.yaml"], + diffFilePathsToDiffs["testdata/prow-autobump/github_ci_prow-deploy_kustom_base_manifests_test_infra_current_hook_deployment.yaml"], + diffFilePathsToDiffs["testdata/prow-autobump/github_ci_prow-deploy_kustom_base_manifests_test_infra_current_horologium_deployment.yaml"], + diffFilePathsToDiffs["testdata/prow-autobump/github_ci_prow-deploy_kustom_base_manifests_test_infra_current_needs-rebase_deployment.yaml"], + diffFilePathsToDiffs["testdata/prow-autobump/github_ci_prow-deploy_kustom_base_manifests_test_infra_current_prow_controller_manager_deployment.yaml"], + diffFilePathsToDiffs["testdata/prow-autobump/github_ci_prow-deploy_kustom_base_manifests_test_infra_current_prowjob-crd_prowjob_customresourcedefinition.yaml"], + diffFilePathsToDiffs["testdata/prow-autobump/github_ci_prow-deploy_kustom_base_manifests_test_infra_current_sinker_deployment.yaml"], + diffFilePathsToDiffs["testdata/prow-autobump/github_ci_prow-deploy_kustom_base_manifests_test_infra_current_statusreconciler_deployment.yaml"], + diffFilePathsToDiffs["testdata/prow-autobump/github_ci_prow-deploy_kustom_base_manifests_test_infra_current_tide_deployment.yaml"], + diffFilePathsToDiffs["testdata/prow-autobump/github_ci_prow-deploy_kustom_overlays_ibmcloud-production_resources_prow-exporter-deployment.yaml"], }, }, want: &ProwAutobumpResult{ notMatchingHunks: map[string][]*diff.Hunk{ - "github/ci/prow-deploy/kustom/base/manifests/test_infra/current/prowjob-crd/prowjob_customresourcedefinition.yaml": diffFilePathesToDiffs["testdata/prow-autobump/github_ci_prow-deploy_kustom_base_manifests_test_infra_current_prowjob-crd_prowjob_customresourcedefinition.yaml"].Hunks, + "github/ci/prow-deploy/kustom/base/manifests/test_infra/current/prowjob-crd/prowjob_customresourcedefinition.yaml": diffFilePathsToDiffs["testdata/prow-autobump/github_ci_prow-deploy_kustom_base_manifests_test_infra_current_prowjob-crd_prowjob_customresourcedefinition.yaml"].Hunks, }, }, }, diff --git a/external-plugins/botreview/review/review.go b/external-plugins/botreview/review/review.go index 4d10c65d21b..4d6751c9141 100644 --- a/external-plugins/botreview/review/review.go +++ b/external-plugins/botreview/review/review.go @@ -75,30 +75,6 @@ func GuessReviewTypes(fileDiffs []*diff.FileDiff) []KindOfChange { return result } -type BasicResult struct { - message string -} - -func (n BasicResult) String() string { - return n.message -} - -func (n BasicResult) IsApproved() bool { - return false -} - -func (n BasicResult) CanMerge() bool { - return false -} - -func (n BasicResult) AddReviewFailure(fileName string, hunks ...*diff.Hunk) { - panic("not implemented") -} - -func (n BasicResult) ShortString() string { - return n.String() -} - type Reviewer struct { l *logrus.Entry org string diff --git a/external-plugins/botreview/review/review_test.go b/external-plugins/botreview/review/review_test.go index 30001870ee9..18a5fee32da 100644 --- a/external-plugins/botreview/review/review_test.go +++ b/external-plugins/botreview/review/review_test.go @@ -26,23 +26,23 @@ import ( ) func TestGuessReviewTypes(t *testing.T) { - diffFilePathes := []string{ + diffFilePaths := []string{ "testdata/simple_bump-prow-job-images_sh.patch0", "testdata/simple_bump-prow-job-images_sh.patch1", "testdata/move_prometheus_stack.patch0", "testdata/move_prometheus_stack.patch1", } - diffFilePathesToDiffs := map[string]*diff.FileDiff{} - for _, diffFile := range diffFilePathes { - bump_images_diff_file, err := os.ReadFile(diffFile) + diffFilePathsToDiffs := map[string]*diff.FileDiff{} + for _, diffFile := range diffFilePaths { + bumpImagesDiffFile, err := os.ReadFile(diffFile) if err != nil { t.Errorf("failed to read diff: %v", err) } - bump_file_diffs, err := diff.ParseFileDiff(bump_images_diff_file) + bumpFileDiffs, err := diff.ParseFileDiff(bumpImagesDiffFile) if err != nil { t.Errorf("failed to read diff: %v", err) } - diffFilePathesToDiffs[diffFile] = bump_file_diffs + diffFilePathsToDiffs[diffFile] = bumpFileDiffs } type args struct { fileDiffs []*diff.FileDiff @@ -56,15 +56,15 @@ func TestGuessReviewTypes(t *testing.T) { name: "simple image bump should yield a change", args: args{ fileDiffs: []*diff.FileDiff{ - diffFilePathesToDiffs["testdata/simple_bump-prow-job-images_sh.patch0"], - diffFilePathesToDiffs["testdata/simple_bump-prow-job-images_sh.patch1"], + diffFilePathsToDiffs["testdata/simple_bump-prow-job-images_sh.patch0"], + diffFilePathsToDiffs["testdata/simple_bump-prow-job-images_sh.patch1"], }, }, want: []KindOfChange{ &ProwJobImageUpdate{ relevantFileDiffs: []*diff.FileDiff{ - diffFilePathesToDiffs["testdata/simple_bump-prow-job-images_sh.patch0"], - diffFilePathesToDiffs["testdata/simple_bump-prow-job-images_sh.patch1"], + diffFilePathsToDiffs["testdata/simple_bump-prow-job-images_sh.patch0"], + diffFilePathsToDiffs["testdata/simple_bump-prow-job-images_sh.patch1"], }, }, }, @@ -73,14 +73,14 @@ func TestGuessReviewTypes(t *testing.T) { name: "mixed with image bump should yield a partial change", args: args{ fileDiffs: []*diff.FileDiff{ - diffFilePathesToDiffs["testdata/simple_bump-prow-job-images_sh.patch0"], - diffFilePathesToDiffs["testdata/move_prometheus_stack.patch0"], + diffFilePathsToDiffs["testdata/simple_bump-prow-job-images_sh.patch0"], + diffFilePathsToDiffs["testdata/move_prometheus_stack.patch0"], }, }, want: []KindOfChange{ &ProwJobImageUpdate{ relevantFileDiffs: []*diff.FileDiff{ - diffFilePathesToDiffs["testdata/simple_bump-prow-job-images_sh.patch0"], + diffFilePathsToDiffs["testdata/simple_bump-prow-job-images_sh.patch0"], }, }, }, @@ -89,8 +89,8 @@ func TestGuessReviewTypes(t *testing.T) { name: "non image bump should not yield a change", args: args{ fileDiffs: []*diff.FileDiff{ - diffFilePathesToDiffs["testdata/move_prometheus_stack.patch0"], - diffFilePathesToDiffs["testdata/move_prometheus_stack.patch1"], + diffFilePathsToDiffs["testdata/move_prometheus_stack.patch0"], + diffFilePathsToDiffs["testdata/move_prometheus_stack.patch1"], }, }, want: []KindOfChange{}, diff --git a/github/ci/prow-deploy/files/jobs/kubevirt/project-infra/project-infra-postsubmits.yaml b/github/ci/prow-deploy/files/jobs/kubevirt/project-infra/project-infra-postsubmits.yaml index b210a1cf0e4..f15d3fd9830 100644 --- a/github/ci/prow-deploy/files/jobs/kubevirt/project-infra/project-infra-postsubmits.yaml +++ b/github/ci/prow-deploy/files/jobs/kubevirt/project-infra/project-infra-postsubmits.yaml @@ -58,11 +58,12 @@ postsubmits: annotations: testgrid-create-test-group: "false" decorate: true - cluster: ibm-prow-jobs + cluster: kubevirt-prow-control-plane max_concurrency: 1 labels: preset-bazel-cache: "true" preset-kubevirtci-quay-credential: "true" + preset-podman-in-container-enabled: "true" spec: containers: - image: quay.io/kubevirtci/bootstrap:v20230626-e1b7af2 @@ -71,7 +72,7 @@ postsubmits: - "/bin/bash" - "-c" - | - cat "$QUAY_PASSWORD" | docker login --username $(cat "$QUAY_USER") --password-stdin=true quay.io + cat "$QUAY_PASSWORD" | podman login --username $(cat "$QUAY_USER") --password-stdin=true quay.io make -C ./external-plugins/botreview push resources: requests: diff --git a/go.mod b/go.mod index 6b2b290af9f..3d7c06b1169 100644 --- a/go.mod +++ b/go.mod @@ -37,8 +37,6 @@ require ( sigs.k8s.io/yaml v1.3.0 ) -require github.com/r3labs/diff/v3 v3.0.1 - require ( cloud.google.com/go v0.110.0 // indirect cloud.google.com/go/compute v1.19.0 // indirect diff --git a/images/botreview/Containerfile b/images/botreview/Containerfile index 4c4c0a66c85..21e9b8557a3 100644 --- a/images/botreview/Containerfile +++ b/images/botreview/Containerfile @@ -1,17 +1,12 @@ FROM docker.io/library/golang:1.20 as builder - WORKDIR /go/src/github.com/kubevirt/project-infra/ -# FIXME: switch to https://github.com/kubevirt/project-infra.git when creating postsubmit for image creation RUN mkdir -p /go/src/kubevirt/ && \ cd /go/src/kubevirt/ && \ - git clone https://github.com/dhiller/project-infra.git && \ + git clone https://github.com/kubevirt/project-infra.git && \ cd project-infra/ && \ - git checkout d0387efd4297294de17a2a84a3cc1a5155e12ba3 && \ go mod vendor && \ env GOPROXY=off GOFLAGS=-mod=vendor CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o /go/bin/botreview ./external-plugins/botreview/main.go -FROM gcr.io/k8s-prow/git:v20220523-6026203ca9 - +FROM gcr.io/k8s-prow/git:v20231107-c87e01249e COPY --from=builder /go/bin/botreview /usr/bin/botreview - ENTRYPOINT ["/usr/bin/botreview"]