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

SECURESIGN-185 | Add tests to all pipelines #188

Merged
merged 2 commits into from
Dec 6, 2023
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
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
Loading