Skip to content

Commit

Permalink
SECURESIGN-185 | Add tests to all pipelines (#188)
Browse files Browse the repository at this point in the history
PR to re-add go unit tests to rekor
  • Loading branch information
JasonPowr authored Dec 6, 2023
1 parent eed37ef commit 4965e39
Show file tree
Hide file tree
Showing 8 changed files with 111 additions and 1 deletion.
15 changes: 15 additions & 0 deletions .tekton/backfill-redis-1-0-gamma-pull-request.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -383,6 +383,21 @@ spec:
operator: in
values:
- "false"
- name: run-unit-test
runAfter:
- prefetch-dependencies
taskRef:
params:
- name: name
value: go-unit-test
- name: bundle
value: quay.io/securesign/rekor-unit-test:latest
- name: kind
value: task
resolver: bundles
workspaces:
- name: source
workspace: workspace
workspaces:
- name: workspace
- name: git-auth
Expand Down
15 changes: 15 additions & 0 deletions .tekton/backfill-redis-1-0-gamma-push.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -380,6 +380,21 @@ spec:
operator: in
values:
- "false"
- name: run-unit-test
runAfter:
- prefetch-dependencies
taskRef:
params:
- name: name
value: go-unit-test
- name: bundle
value: quay.io/securesign/rekor-unit-test:latest
- name: kind
value: task
resolver: bundles
workspaces:
- name: source
workspace: workspace
workspaces:
- name: workspace
- name: git-auth
Expand Down
15 changes: 15 additions & 0 deletions .tekton/rekor-cli-1-3-pull-request.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -383,6 +383,21 @@ spec:
operator: in
values:
- "false"
- name: run-unit-test
runAfter:
- prefetch-dependencies
taskRef:
params:
- name: name
value: go-unit-test
- name: bundle
value: quay.io/securesign/rekor-unit-test:latest
- name: kind
value: task
resolver: bundles
workspaces:
- name: source
workspace: workspace
workspaces:
- name: workspace
- name: git-auth
Expand Down
15 changes: 15 additions & 0 deletions .tekton/rekor-cli-1-3-push.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -380,6 +380,21 @@ spec:
operator: in
values:
- "false"
- name: run-unit-test
runAfter:
- prefetch-dependencies
taskRef:
params:
- name: name
value: go-unit-test
- name: bundle
value: quay.io/securesign/rekor-unit-test:latest
- name: kind
value: task
resolver: bundles
workspaces:
- name: source
workspace: workspace
workspaces:
- name: workspace
- name: git-auth
Expand Down
15 changes: 15 additions & 0 deletions .tekton/rekor-server-1-0-gamma-pull-request.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -383,6 +383,21 @@ spec:
operator: in
values:
- "false"
- name: run-unit-test
runAfter:
- prefetch-dependencies
taskRef:
params:
- name: name
value: go-unit-test
- name: bundle
value: quay.io/securesign/rekor-unit-test:latest
- name: kind
value: task
resolver: bundles
workspaces:
- name: source
workspace: workspace
workspaces:
- name: workspace
- name: git-auth
Expand Down
15 changes: 15 additions & 0 deletions .tekton/rekor-server-1-0-gamma-push.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -380,6 +380,21 @@ spec:
operator: in
values:
- "false"
- name: run-unit-test
runAfter:
- prefetch-dependencies
taskRef:
params:
- name: name
value: go-unit-test
- name: bundle
value: quay.io/securesign/rekor-unit-test:latest
- name: kind
value: task
resolver: bundles
workspaces:
- name: source
workspace: workspace
workspaces:
- name: workspace
- name: git-auth
Expand Down
20 changes: 20 additions & 0 deletions .tekton/rekor-unit-test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
apiVersion: tekton.dev/v1beta1
kind: Task
metadata:
name: go-unit-test
annotations:
tekton.dev/title: "Go Unit Test Task"
spec:
workspaces:
- name: source
steps:
- name: run-tests
image: registry.access.redhat.com/ubi9/go-toolset@sha256:c3a9c5c7fb226f6efcec2424dd30c38f652156040b490c9eca5ac5b61d8dc3ca
workingDir: $(workspaces.source.path)/source
script: |
#!/usr/bin/env sh
go test ./...
# This file bundles the unit tests for rekor.
# If any changes are made to this file, it must be pushed to Quay using the following command:
# 'tkn bundle push quay.io/securesign/rekor-unit-test:latest -f .tekton/rekor-unit-test.yaml'.
2 changes: 1 addition & 1 deletion pkg/api/entries.go
Original file line number Diff line number Diff line change
Expand Up @@ -352,7 +352,7 @@ func createLogEntry(params entries.CreateLogEntryParams) (models.LogEntry, middl
}

func publishEvent(ctx context.Context, publisher pubsub.Publisher, event *events.Event, contentType events.EventContentType) {
err := publisher.Publish(context.WithoutCancel(ctx), event, contentType)
err := publisher.Publish(ctx, event, contentType)
incPublishEvent(event.Type().Name(), contentType, err == nil)
if err != nil {
log.ContextLogger(ctx).Error(err)
Expand Down

0 comments on commit 4965e39

Please sign in to comment.