Repository: grafana/tanka
Pull request #1034 (2024-05-27 08:31:05)

Bump github.com/rs/zerolog from 1.32.0 to 1.33.0
Bumps [github.com/rs/zerolog](https://github.com/rs/zerolog) from 1.32.0 to 1.33.0.
<details>
<summary>Commits</summary>
<ul>
<li><a href="https://github.com/rs/zerolog/commit/c78e50e2da70f4ae63e1b65222c3acf12e9ba699"><code>c78e50e</code></a> Add fields order (<a href="https://redirect.github.com/rs/zerolog/issues/550">#550</a>)</li>
<li><a href="https://github.com/rs/zerolog/commit/8582bed24f021b174e2dfddbd2cfc72a8e39ccfd"><code>8582bed</code></a> fix: use <code>TimestampFunc</code> in busrt sampler (<a href="https://redirect.github.com/rs/zerolog/issues/671">#671</a>) (<a href="https://redirect.github.com/rs/zerolog/issues/672">#672</a>)</li>
<li><a href="https://github.com/rs/zerolog/commit/7d9db06a5369272008eee64a52ebf09443caff9e"><code>7d9db06</code></a> Allow setting floating point precision in JSON. (<a href="https://redirect.github.com/rs/zerolog/issues/663">#663</a>)</li>
<li><a href="https://github.com/rs/zerolog/commit/e5aa7e36278c0627297fad5d24a13e3f71bd15dd"><code>e5aa7e3</code></a> Revert <a href="https://redirect.github.com/rs/zerolog/issues/662">#662</a></li>
<li><a href="https://github.com/rs/zerolog/commit/0efa414907bc6775424a4987c9e13b63d17bd4c2"><code>0efa414</code></a> Fix panic caused by an extra malformed <code>level</code> field (<a href="https://redirect.github.com/rs/zerolog/issues/665">#665</a>)</li>
<li><a href="https://github.com/rs/zerolog/commit/eb081e1fa2325f7aab25a9386e463f67b37b421d"><code>eb081e1</code></a> chore: fix some typos in comments (<a href="https://redirect.github.com/rs/zerolog/issues/667">#667</a>)</li>
<li><a href="https://github.com/rs/zerolog/commit/2d899f0cf9919b091561c58233e624ffcc8b8824"><code>2d899f0</code></a> set debug log color (<a href="https://redirect.github.com/rs/zerolog/issues/662">#662</a>)</li>
<li><a href="https://github.com/rs/zerolog/commit/74cf37a3965b19e5e433dcd45ccdcfbb13cf239f"><code>74cf37a</code></a> Add EmptyFields method to remove all the fileds from logger (<a href="https://redirect.github.com/rs/zerolog/issues/575">#575</a>)</li>
<li><a href="https://github.com/rs/zerolog/commit/e5edd4b8ec0845c561d88e9bcdb3fe57b2acc249"><code>e5edd4b</code></a> Refactor: make code in comment valid and runable (<a href="https://redirect.github.com/rs/zerolog/issues/654">#654</a>)</li>
<li><a href="https://github.com/rs/zerolog/commit/582007f21da46f136517edb419ed44931ae72b73"><code>582007f</code></a> Add a time.Location to ConsoleWriter. (This allows UTC timestamps.) (<a href="https://redirect.github.com/rs/zerolog/issues/531">#531</a>)</li>
<li>Additional commits viewable in <a href="https://github.com/rs/zerolog/compare/v1.32.0...v1.33.0">compare view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=github.com/rs/zerolog&package-manager=go_modules&previous-version=1.32.0&new-version=1.33.0)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
- `@dependabot show <dependency name> ignore conditions` will show all of the ignore conditions of the specified dependency
- `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)


</details>

github-actions[bot]: [PR Preview Action](https://github.com/rossjrw/pr-preview-action) v1.4.7
:---:
:rocket: Deployed preview to https://grafana.github.io/tanka/pr-preview/pr-1034/
on branch [`gh-pages`](https://github.com/grafana/tanka/tree/gh-pages) at 2024-05-27 08:31 UTC
<!-- Sticky Pull Request Commentpr-preview -->

Patch:
diff --git a/.github/workflows/publish-page.yml b/.github/workflows/publish-page.yml
index f707038a..554e9e65 100644
--- a/.github/workflows/publish-page.yml
+++ b/.github/workflows/publish-page.yml
@@ -25,7 +25,7 @@ jobs:
       - name: Checkout
         uses: actions/checkout@v4
       - name: Install pnpm
-        uses: pnpm/action-setup@v3
+        uses: pnpm/action-setup@v4
         with:
           version: 9
       - uses: actions/setup-node@v4
diff --git a/go.mod b/go.mod
index b8bb2ab8..f3ee086d 100644
--- a/go.mod
+++ b/go.mod
@@ -14,7 +14,7 @@ require (
 	github.com/karrick/godirwalk v1.17.0
 	github.com/pkg/errors v0.9.1
 	github.com/posener/complete v1.2.3
-	github.com/rs/zerolog v1.32.0
+	github.com/rs/zerolog v1.33.0
 	github.com/spf13/pflag v1.0.5
 	github.com/stretchr/objx v0.5.2
 	github.com/stretchr/testify v1.9.0
diff --git a/go.sum b/go.sum
index 494b2775..ee9a1e0a 100644
--- a/go.sum
+++ b/go.sum
@@ -61,8 +61,8 @@ github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZN
 github.com/posener/complete v1.2.3 h1:NP0eAhjcjImqslEwo/1hq7gpajME0fTLTezBKDqfXqo=
 github.com/posener/complete v1.2.3/go.mod h1:WZIdtGGp+qx0sLrYKtIRAruyNpv6hFCicSgv7Sy7s/s=
 github.com/rs/xid v1.5.0/go.mod h1:trrq9SKmegXys3aeAKXMUTdJsYXVwGY3RLcfgqegfbg=
-github.com/rs/zerolog v1.32.0 h1:keLypqrlIjaFsbmJOBdB/qvyF8KEtCWHwobLp5l/mQ0=
-github.com/rs/zerolog v1.32.0/go.mod h1:/7mN4D5sKwJLZQ2b/znpjC3/GQWY/xaDXUM0kKWRHss=
+github.com/rs/zerolog v1.33.0 h1:1cU2KZkvPxNyfgEmhHAz/1A9Bz+llsdYzklWFzgp0r8=
+github.com/rs/zerolog v1.33.0/go.mod h1:/7mN4D5sKwJLZQ2b/znpjC3/GQWY/xaDXUM0kKWRHss=
 github.com/sergi/go-diff v1.1.0 h1:we8PVUC3FE2uYfodKH/nBHMSetSfHDR6scGdBi+erh0=
 github.com/shopspring/decimal v1.2.0/go.mod h1:DKyhrW/HYNuLGql+MJL6WCR6knT2jwCFRcu2hWCYk4o=
 github.com/shopspring/decimal v1.3.1 h1:2Usl1nmF/WZucqkFZhnfFYxxxu8LG21F6nPQBE5gKV8=
diff --git a/pkg/kubernetes/manifest/manifest.go b/pkg/kubernetes/manifest/manifest.go
index 629131c3..4f9a20bd 100644
--- a/pkg/kubernetes/manifest/manifest.go
+++ b/pkg/kubernetes/manifest/manifest.go
@@ -203,6 +203,14 @@ func (m Metadata) Name() string {
 	return name.(string)
 }
 
+func (m Metadata) GenerateName() string {
+	generateName, ok := m["generateName"]
+	if !ok {
+		return ""
+	}
+	return generateName.(string)
+}
+
 // HasNamespace returns whether the manifest has a namespace set
 func (m Metadata) HasNamespace() bool {
 	return m2o(m).Get("namespace").IsStr()
diff --git a/pkg/process/sort.go b/pkg/process/sort.go
index 84533922..226aebd5 100644
--- a/pkg/process/sort.go
+++ b/pkg/process/sort.go
@@ -82,7 +82,10 @@ func Sort(list manifest.List) {
 			return list[i].Metadata().Namespace() < list[j].Metadata().Namespace()
 		}
 
-		// Otherwise, order the objects by name.
-		return list[i].Metadata().Name() < list[j].Metadata().Name()
+		if list[i].Metadata().Name() != list[j].Metadata().Name() {
+			return list[i].Metadata().Name() < list[j].Metadata().Name()
+		}
+
+		return list[i].Metadata().GenerateName() < list[j].Metadata().GenerateName()
 	})
 }


Test patch:
diff --git a/pkg/process/sort_test.go b/pkg/process/sort_test.go
index 486c4f41..e8c90968 100644
--- a/pkg/process/sort_test.go
+++ b/pkg/process/sort_test.go
@@ -78,6 +78,19 @@ func TestSort(t *testing.T) {
 				mkobj("CustomResourceDefinition", "crd2", ""),
 			},
 		},
+		{
+			// sorting by the generate name prefix if everything else is the same
+			raw: manifest.List{
+				mkGenerateObj("CustomResourceDefinition", "crd2-", ""),
+				mkGenerateObj("CustomResourceDefinition", "crd-", ""),
+				mkGenerateObj("CustomResourceDefinition", "crd1-", ""),
+			},
+			state: manifest.List{
+				mkGenerateObj("CustomResourceDefinition", "crd-", ""),
+				mkGenerateObj("CustomResourceDefinition", "crd1-", ""),
+				mkGenerateObj("CustomResourceDefinition", "crd2-", ""),
+			},
+		},
 		{
 			raw: manifest.List{
 				mkobj("Deployment", "b", "a"),
@@ -130,3 +143,9 @@ func mkobj(kind string, name string, ns string) map[string]interface{} {
 
 	return ret
 }
+
+func mkGenerateObj(kind string, generateName string, ns string) map[string]interface{} {
+	result := mkobj(kind, "", ns)
+	result["metadata"].(map[string]interface{})["generateName"] = generateName
+	return result
+}