nebius/SWE-rebench-V2-PRs huggingface dataset:
Repository: Azure/ARO-RP
Pull request #2545 (2022-11-16 14:59:03)

Add more logs about aro deployment state
### Which issue this PR addresses:

[Add additional logging to the ARO Operator deployment process](https://msazure.visualstudio.com/AzureRedHatOpenShift/_workitems/edit/16288833/)

### What this PR does / why we need it:

<!--
Include a brief summary of what the PR is intended to accomplish and how the PR
does it. (2-3 sentences)
-->

### Is there any documentation that needs to be updated for this PR?

<!--
- If yes and the docs are in GitHub, include doc updates in the PR.
- If yes and the docs are not in GitHub (i.e. ADO wiki), include a link to the
  docs.
- If no, explain why (e.g. "tech debt cleanup, N/A").
-->



Patch:
diff --git a/pkg/monitor/cluster/arooperatorheartbeat.go b/pkg/monitor/cluster/arooperatorheartbeat.go
index 7ad6b023b..d6f8446f5 100644
--- a/pkg/monitor/cluster/arooperatorheartbeat.go
+++ b/pkg/monitor/cluster/arooperatorheartbeat.go
@@ -22,7 +22,9 @@ func (mon *Monitor) emitAroOperatorHeartbeat(ctx context.Context) error {
 	for _, d := range aroDeployments.Items {
 		_, present := aroOperatorDeploymentsReady[d.Name]
 		if present {
-			aroOperatorDeploymentsReady[d.Name] = ready.DeploymentIsReady(&d)
+			deploymentIsReady := ready.DeploymentIsReady(&d)
+			mon.log.Infof("deployment %q is ready: %v, it's status: %+v", d.Name, deploymentIsReady, d.Status)
+			aroOperatorDeploymentsReady[d.Name] = deploymentIsReady
 		}
 	}
 
diff --git a/pkg/operator/deploy/deploy.go b/pkg/operator/deploy/deploy.go
index 2ce418004..f9e5e06fc 100644
--- a/pkg/operator/deploy/deploy.go
+++ b/pkg/operator/deploy/deploy.go
@@ -392,10 +392,12 @@ func (o *operator) RenewMDSDCertificate(ctx context.Context) error {
 
 func (o *operator) IsReady(ctx context.Context) (bool, error) {
 	ok, err := ready.CheckDeploymentIsReady(ctx, o.kubernetescli.AppsV1().Deployments(pkgoperator.Namespace), "aro-operator-master")()
+	o.log.Infof("deployment %q ok status is: %v, err is: %v", "aro-operator-master", ok, err)
 	if !ok || err != nil {
 		return ok, err
 	}
 	ok, err = ready.CheckDeploymentIsReady(ctx, o.kubernetescli.AppsV1().Deployments(pkgoperator.Namespace), "aro-operator-worker")()
+	o.log.Infof("deployment %q ok status is: %v, err is: %v", "aro-operator-worker", ok, err)
 	if !ok || err != nil {
 		return ok, err
 	}


Test patch:
diff --git a/pkg/monitor/cluster/arooperatorheartbeat_test.go b/pkg/monitor/cluster/arooperatorheartbeat_test.go
index ba8bc6f84..8a239ddbc 100644
--- a/pkg/monitor/cluster/arooperatorheartbeat_test.go
+++ b/pkg/monitor/cluster/arooperatorheartbeat_test.go
@@ -13,6 +13,7 @@ import (
 	metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
 	"k8s.io/client-go/kubernetes/fake"
 
+	utillog "github.com/Azure/ARO-RP/pkg/util/log"
 	mock_metrics "github.com/Azure/ARO-RP/pkg/util/mocks/metrics"
 )
 
@@ -83,6 +84,7 @@ func TestEmitAroOperatorHeartbeat(t *testing.T) {
 	mon := &Monitor{
 		cli: cli,
 		m:   m,
+		log: utillog.GetLogger(),
 	}
 
 	m.EXPECT().EmitGauge("arooperator.heartbeat", int64(0), map[string]string{
Repository: Azure/ARO-RP
Pull request #2560 (2022-11-25 05:48:10)

Fixes a bug in the certificate PUCM process 
### Which issue this PR addresses:

"Fixes a bug in the certificate PUCM process that does not take into account clusters that have not been successfully PUCM'ed since a [large infra change PR](https://github.com/Azure/ARO-RP/pull/1296) was merged in Feb 2021". 

Previous ADO Card for Certificate PUCM : https://msazure.visualstudio.com/AzureRedHatOpenShift/_workitems/edit/15581636/

### What this PR does / why we need it:

"Fixes a bug in the certificate PUCM process that does not take into account clusters that have not been successfully PUCM'ed since a  [large infra change PR](https://github.com/Azure/ARO-RP/pull/1296) was merged in Feb 2021". At present fixMCSCert step failing as it could not find the Properties.APIServerProfile.IntIP entry in the Cluster Document.

### Test plan for issue:

Create Test Cluster without the Properties.APIServerProfile.IntIP entry in the Cluster Document and run the Certificate PUCM and it will create a new entry for Properties.APIServerProfile.IntIP and update the Cluster Document in Cosmos DB.

CURL Command to perform Admin Update just for certificates renewal:
curl -X PATCH -k "https://localhost:8443/subscriptions/$AZURE_SUBSCRIPTION_ID/resourceGroups/$RESOURCEGROUP/providers/Microsoft.RedHatOpenShift/openShiftClusters/$CLUSTER?api-version=admin" --header "Content-Type: application/json" -d '{"properties":{"maintenanceTask": "CertificatesRenewal"}}'

### Is there any documentation that needs to be updated for this PR?



Patch:
diff --git a/pkg/cluster/install.go b/pkg/cluster/install.go
index f9fe872d1..6defa7858 100644
--- a/pkg/cluster/install.go
+++ b/pkg/cluster/install.go
@@ -57,11 +57,16 @@ func (m *manager) adminUpdate() []steps.Step {
 			steps.Action(m.populateRegistryStorageAccountName), // must go before migrateStorageAccounts
 			steps.Action(m.migrateStorageAccounts),
 			steps.Action(m.fixSSH),
-			steps.Action(m.populateDatabaseIntIP),
 			//steps.Action(m.removePrivateDNSZone), // TODO(mj): re-enable once we communicate this out
 		)
 	}
 
+	if isEverything || isRenewCerts {
+		toRun = append(toRun,
+			steps.Action(m.populateDatabaseIntIP),
+		)
+	}
+
 	// Make sure the VMs are switched on and we have an APIServer
 	toRun = append(toRun,
 		steps.Action(m.startVMs),


Test patch:
diff --git a/pkg/cluster/adminupdate_test.go b/pkg/cluster/adminupdate_test.go
index 8f8900a3f..256061dcb 100644
--- a/pkg/cluster/adminupdate_test.go
+++ b/pkg/cluster/adminupdate_test.go
@@ -195,6 +195,7 @@ func TestAdminUpdateSteps(t *testing.T) {
 				"[Action ensureDefaults-fm]",
 				"[Action fixupClusterSPObjectID-fm]",
 				"[Action fixInfraID-fm]",
+				"[Action populateDatabaseIntIP-fm]",
 				"[Action startVMs-fm]",
 				"[Condition apiServersReady-fm, timeout 30m0s]",
 				"[Action fixMCSCert-fm]",
Repository: Azure/ARO-RP
Pull request #2572 (2022-12-02 11:44:56)

reads from embedded files instead of filesystem
### Which issue this PR addresses:
Fixes bug introduced by https://github.com/Azure/ARO-RP/pull/2344/files#diff-9d7f4b3eb6a8c6b563c82464fe86dd126cabe728955e19fed89282919358a391 because it was reading from the actual file system instead of the embedded one and was failing in canary because it ended up being ran from `/` (?) and got a permission denied 

E2E does not verify that the portal is running (portal tests are disabled because e2e are running in containers) and local testing has different permissions than actual environments. 

Portal will not work until this is merged
<!--
Please include a link to the ADO work item as well as any GitHub issues.

Usage: `Fixes #<GitHub issue number>`, or `Fixes (paste link of issue)`.
-->
Fixes

### What this PR does / why we need it:

<!--
Include a brief summary of what the PR is intended to accomplish and how the PR
does it. (2-3 sentences)
-->

### Test plan for issue:

<!--
How did you test that this PR works?

- Are there unit tests?
- Are there integration/e2e tests?
- If it is not possible to write automated tests, explain why and document how
  to manually test and verify the feature.
-->

### Is there any documentation that needs to be updated for this PR?

<!--
- If yes and the docs are in GitHub, include doc updates in the PR.
- If yes and the docs are not in GitHub (i.e. ADO wiki), include a link to the
  docs.
- If no, explain why (e.g. "tech debt cleanup, N/A").
-->



Patch:
diff --git a/pkg/portal/portal.go b/pkg/portal/portal.go
index 996e7f97b..664450d0b 100644
--- a/pkg/portal/portal.go
+++ b/pkg/portal/portal.go
@@ -15,7 +15,6 @@ import (
 	"log"
 	"net"
 	"net/http"
-	"path/filepath"
 	"regexp"
 	"strings"
 	"time"
@@ -267,17 +266,19 @@ func (p *portal) unauthenticatedRoutes(r *mux.Router) {
 func (p *portal) aadAuthenticatedRoutes(r *mux.Router) {
 	var names []string
 
-	err := filepath.Walk(".", func(path string, info fs.FileInfo, err error) error {
+	err := fs.WalkDir(assets.EmbeddedFiles, ".", func(path string, entry fs.DirEntry, err error) error {
 		if err != nil {
 			return err
 		}
 
-		names = append(names, path)
+		if !entry.IsDir() {
+			names = append(names, path)
+		}
 		return nil
 	})
 
 	if err != nil {
-		log.Fatal(err)
+		p.log.Fatal(err)
 	}
 
 	for _, name := range names {


Test patch:
diff --git a/test/e2e/aks.go b/test/e2e/aks.go
index 8336a6f93..c3112f0f5 100644
--- a/test/e2e/aks.go
+++ b/test/e2e/aks.go
@@ -23,7 +23,7 @@ import (
 )
 
 // Tests the kubeconfig ability to get and manipulate the cluster
-var _ = Describe("AKS cluster present", func() {
+var _ = Describe("AKS cluster present", Pending, func() {
 	ctx := context.Background()
 	var liveConfig liveconfig.Manager
 	var kubeConfig *rest.Config
Repository: datreeio/datree
Pull request #639 (2022-05-24 07:59:17)

feat: k8s validation in offline mode with local --schema-location


Patch:
diff --git a/bl/validation/k8sValidator.go b/bl/validation/k8sValidator.go
index c30920a..eac832a 100644
--- a/bl/validation/k8sValidator.go
+++ b/bl/validation/k8sValidator.go
@@ -26,7 +26,7 @@ func New() *K8sValidator {
 }
 
 func (val *K8sValidator) InitClient(k8sVersion string, ignoreMissingSchemas bool, schemaLocations []string) {
-	val.validationClient = newKubeconformValidator(k8sVersion, ignoreMissingSchemas, append(getDefaultSchemaLocations(), schemaLocations...))
+	val.validationClient = newKubeconformValidator(k8sVersion, ignoreMissingSchemas, getAllSchemaLocations(schemaLocations))
 }
 
 type WarningKind int
@@ -197,6 +197,13 @@ func isEveryResultStatusEmpty(results []kubeconformValidator.Result) bool {
 	return isEveryResultStatusEmpty
 }
 
+func getAllSchemaLocations(userProvidedSchemaLocations []string) []string {
+	// order matters!
+	// it's important that provided schema locations (from --schema-locations flag) are *before* the default schema locations
+	// this will give them priority and allow using a local schema in offline mode
+	return append(userProvidedSchemaLocations, getDefaultSchemaLocations()...)
+}
+
 func getDefaultSchemaLocations() []string {
 	return []string{
 		"default",


Test patch:
diff --git a/bl/validation/k8sValidator_test.go b/bl/validation/k8sValidator_test.go
index 31e3de4..2ec6254 100644
--- a/bl/validation/k8sValidator_test.go
+++ b/bl/validation/k8sValidator_test.go
@@ -25,7 +25,7 @@ func TestValidateResources(t *testing.T) {
 	test_valid_multiple_configurations(t)
 	test_valid_multiple_configurations_only_k8s_files(t)
 	test_invalid_file(t)
-	test_default_schema_location(t)
+	test_get_all_schema_locations(t)
 	test_get_datree_crd_schema_by_name(t)
 	t.Run("test empty file", test_empty_file)
 	t.Run("test no internet connection", test_no_connection)
@@ -208,13 +208,14 @@ func test_missing_schema_skipped(t *testing.T) {
 	assert.Equal(t, "k8s schema validation skipped: --ignore-missing-schemas flag was used", k8sValidationWarningPerValidFile[path].Warning)
 }
 
-func test_default_schema_location(t *testing.T) {
+func test_get_all_schema_locations(t *testing.T) {
 	expectedOutput := []string{
+		"/my-local-schema-location",
 		"default",
 		"https://raw.githubusercontent.com/yannh/kubernetes-json-schema/master/{{ .NormalizedKubernetesVersion }}/{{ .ResourceKind }}{{ .KindSuffix }}.json",
 		"https://raw.githubusercontent.com/datreeio/CRDs-catalog/master/argo/{{ .ResourceKind }}_{{ .ResourceAPIVersion }}.json",
 	}
-	actual := getDefaultSchemaLocations()
+	actual := getAllSchemaLocations([]string{"/my-local-schema-location"})
 	assert.Equal(t, expectedOutput, actual)
 }