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

proto: Change RestartPolicy variants to use CamelCase #152

Merged
merged 2 commits into from
Dec 23, 2021
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
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ jobs:
uses: arduino/setup-protoc@v1
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
version: '3.17.3'
version: '3.19.1'
- name: Install protoc-gen-go
run: go install google.golang.org/protobuf/cmd/protoc-gen-go@v1.27.1
- name: Check Protobuf Generation
Expand Down
2 changes: 1 addition & 1 deletion cel/cos_tlv_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ func TestCosEventlog(t *testing.T) {
}{
{ImageRefType, test.DebugPCR, []byte("docker.io/bazel/experimental/test:latest")},
{ImageDigestType, test.DebugPCR, []byte("sha256:781d8dfdd92118436bd914442c8339e653b83f6bf3c1a7a98efcfb7c4fed7483")},
{RestartPolicyType, test.DebugPCR, []byte(pb.RestartPolicy_NEVER.String())},
{RestartPolicyType, test.DebugPCR, []byte(pb.RestartPolicy_Never.String())},
}

for _, testEvent := range testEvents {
Expand Down
12 changes: 7 additions & 5 deletions proto/attest.proto
Original file line number Diff line number Diff line change
Expand Up @@ -115,13 +115,15 @@ message SecureBootState {
}

// The container's restart policy.
// See
// See the following Kubernetes documentation for more details:
// https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle/#restart-policy
// for more details.
// Note that these enum variants do not conform to the standard Protocol Buffers
// Style Guide so that RestartPolicy_name, RestartPolicy_value, and
// RestartPolicy.String() match the values used by Kubernetes and others.
enum RestartPolicy {
ALWAYS = 0;
ON_FAILURE = 1;
NEVER = 2;
Always = 0;
OnFailure = 1;
Never = 2;
}

message ContainerState {
Expand Down
44 changes: 23 additions & 21 deletions proto/attest/attest.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion proto/tpm/tpm.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions server/eventlog_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -428,13 +428,13 @@ func TestParsingCELEventLog(t *testing.T) {
}{
{cel.ImageRefType, test.DebugPCR, []byte("docker.io/bazel/experimental/test:latest")},
{cel.ImageDigestType, test.DebugPCR, []byte("sha256:781d8dfdd92118436bd914442c8339e653b83f6bf3c1a7a98efcfb7c4fed7483")},
{cel.RestartPolicyType, test.DebugPCR, []byte(attestpb.RestartPolicy_ALWAYS.String())},
{cel.RestartPolicyType, test.DebugPCR, []byte(attestpb.RestartPolicy_Always.String())},
}

want := attestpb.ContainerState{
ImageReference: string(testCELEvents[0].eventPayload),
ImageDigest: string(testCELEvents[1].eventPayload),
RestartPolicy: attestpb.RestartPolicy_ALWAYS}
RestartPolicy: attestpb.RestartPolicy_Always}
for _, testEvent := range testCELEvents {
cos := cel.CosTlv{EventType: testEvent.cosNestedEventType, EventContent: testEvent.eventPayload}
if err := coscel.AppendEvent(tpm, testEvent.pcr, hashAlgoList, cos); err != nil {
Expand Down
4 changes: 2 additions & 2 deletions server/verify_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,7 @@ func TestVerifyAttestationWithCEL(t *testing.T) {
}{
{cel.ImageRefType, test.DebugPCR, []byte("docker.io/bazel/experimental/test:latest")},
{cel.ImageDigestType, test.DebugPCR, []byte("sha256:781d8dfdd92118436bd914442c8339e653b83f6bf3c1a7a98efcfb7c4fed7483")},
{cel.RestartPolicyType, test.DebugPCR, []byte(attestpb.RestartPolicy_NEVER.String())},
{cel.RestartPolicyType, test.DebugPCR, []byte(attestpb.RestartPolicy_Never.String())},
}
hashAlgoList := []crypto.Hash{crypto.SHA256, crypto.SHA1, crypto.SHA512}
for _, testEvent := range testEvents {
Expand Down Expand Up @@ -340,7 +340,7 @@ func TestVerifyAttestationWithCEL(t *testing.T) {
want := attestpb.ContainerState{
ImageReference: string(testEvents[0].eventPayload),
ImageDigest: string(testEvents[1].eventPayload),
RestartPolicy: attestpb.RestartPolicy_NEVER}
RestartPolicy: attestpb.RestartPolicy_Never}
if diff := cmp.Diff(state.Cos.Container, &want, protocmp.Transform()); diff != "" {
t.Errorf("unexpected difference:\n%v", diff)
}
Expand Down