Skip to content
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

Create api_version v1beta5, same as v1beta4 #431

Merged
merged 7 commits into from
Feb 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
8 changes: 4 additions & 4 deletions templates/commands/goldentest/new_test_cli_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ steps:
message: 'Hello, {{.name}}!'
`

testYaml := `api_version: cli.abcxyz.dev/v1beta4
testYaml := `api_version: cli.abcxyz.dev/v1beta5
kind: GoldenTest
inputs:
- name: name
Expand Down Expand Up @@ -168,7 +168,7 @@ builtin_vars:
"testdata/golden/new-test/test.yaml": testYaml,
},
expectedContents: map[string]string{
"test.yaml": `api_version: cli.abcxyz.dev/v1beta4
"test.yaml": `api_version: cli.abcxyz.dev/v1beta5
kind: GoldenTest
inputs:
- name: name
Expand Down Expand Up @@ -208,7 +208,7 @@ steps:
`,
},
expectedContents: map[string]string{
"test.yaml": `api_version: cli.abcxyz.dev/v1beta4
"test.yaml": `api_version: cli.abcxyz.dev/v1beta5
kind: GoldenTest
`,
},
Expand Down Expand Up @@ -371,7 +371,7 @@ Enter value: `,
},
},
expectedContents: map[string]string{
"test.yaml": `api_version: cli.abcxyz.dev/v1beta4
"test.yaml": `api_version: cli.abcxyz.dev/v1beta5
kind: GoldenTest
inputs:
- name: name
Expand Down
8 changes: 4 additions & 4 deletions templates/common/render/manifest_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ func TestWriteManifest(t *testing.T) {
want: map[string]string{
"a.txt": "some other stuff",
".abc/manifest_nolocation_2023-12-08T23:59:02.000000013Z.lock.yaml": `# Generated by the "abc templates" command. Do not modify.
api_version: cli.abcxyz.dev/v1beta4
api_version: cli.abcxyz.dev/v1beta5
kind: Manifest
creation_time: 2023-12-08T23:59:02.000000013Z
modification_time: 2023-12-08T23:59:02.000000013Z
Expand Down Expand Up @@ -111,7 +111,7 @@ output_hashes:
want: map[string]string{
"a.txt": "some other stuff",
".abc/manifest_github.com%2Ffoo%2Fbar_2023-12-08T23:59:02.000000013Z.lock.yaml": `# Generated by the "abc templates" command. Do not modify.
api_version: cli.abcxyz.dev/v1beta4
api_version: cli.abcxyz.dev/v1beta5
kind: Manifest
creation_time: 2023-12-08T23:59:02.000000013Z
modification_time: 2023-12-08T23:59:02.000000013Z
Expand Down Expand Up @@ -174,7 +174,7 @@ output_hashes:
want: map[string]string{
"a.txt": "some other stuff",
".abc/manifest_nolocation_2023-12-08T23:59:02.000000013Z.lock.yaml": `# Generated by the "abc templates" command. Do not modify.
api_version: cli.abcxyz.dev/v1beta4
api_version: cli.abcxyz.dev/v1beta5
kind: Manifest
creation_time: 2023-12-08T23:59:02.000000013Z
modification_time: 2023-12-08T23:59:02.000000013Z
Expand Down Expand Up @@ -206,7 +206,7 @@ output_hashes:
outputHashes: map[string][]byte{},
want: map[string]string{
".abc/manifest_nolocation_2023-12-08T23:59:02.000000013Z.lock.yaml": `# Generated by the "abc templates" command. Do not modify.
api_version: cli.abcxyz.dev/v1beta4
api_version: cli.abcxyz.dev/v1beta5
kind: Manifest
creation_time: 2023-12-08T23:59:02.000000013Z
modification_time: 2023-12-08T23:59:02.000000013Z
Expand Down
2 changes: 1 addition & 1 deletion templates/common/render/render_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ steps:
"dir1/file_in_dir.txt": "file_in_dir contents",
"dir2/file2.txt": "file2 contents",
".abc/manifest_nolocation_2023-12-08T23:59:02.000000013Z.lock.yaml": `# Generated by the "abc templates" command. Do not modify.
api_version: cli.abcxyz.dev/v1beta4
api_version: cli.abcxyz.dev/v1beta5
kind: Manifest
creation_time: 2023-12-08T23:59:02.000000013Z
modification_time: 2023-12-08T23:59:02.000000013Z
Expand Down
12 changes: 12 additions & 0 deletions templates/model/decode/decode.go
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,18 @@ var apiVersions = []apiVersionDef{
KindManifest: &manifestv1alpha1.Manifest{},
},
},
// Why is v1beta5 the same as v1beta4? It's a simple hack that works around
// a bug in abc versions <=0.5.0, for reasons that are very difficult to
// understand. See github.com/abcxyz/abc/pull/431 for rationale.
{
apiVersion: "cli.abcxyz.dev/v1beta5",
unreleased: true,
kinds: map[string]model.ValidatorUpgrader{
KindTemplate: &specv1beta4.Spec{},
KindGoldenTest: &goldentestv1beta3.Test{},
KindManifest: &manifestv1alpha1.Manifest{},
},
},
}

// Decode parses the given YAML contents of r into a struct and returns it. The
Expand Down
2 changes: 1 addition & 1 deletion templates/model/decode/decode_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -555,7 +555,7 @@ func TestLatestSupportedAPIVersion(t *testing.T) {
{
name: "not_release_build",
isReleaseBuild: false,
want: "cli.abcxyz.dev/v1beta4", // update for creation of a new api_version
want: "cli.abcxyz.dev/v1beta5", // update for creation of a new api_version
},
}

Expand Down