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

Resolving build test issues in PRs #1078

Merged
merged 1 commit into from
May 7, 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
3 changes: 2 additions & 1 deletion cmd/interceptors/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,8 @@ func main() {

service, err := server.NewWithCoreInterceptors(kubeClient, logger)
if err != nil {
log.Fatalf("failed to initialize core interceptors: %s", err)
log.Printf("failed to initialize core interceptors: %s", err)
return
}
mux := http.NewServeMux()
mux.Handle("/", service)
Expand Down
2 changes: 1 addition & 1 deletion cmd/triggerrun/cmd/root_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ import (
)

func TestTrigger_Error(t *testing.T) {
//error case for show feature
// error case for show feature
buf := new(bytes.Buffer)
err := trigger("../testdata/trigger.yaml", "../testdata/http.txt", "show", "BAD_KUBECONFIG", buf)

Expand Down
2 changes: 1 addition & 1 deletion examples/webhook-interceptors/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ func main() {
}

http.HandleFunc("/", func(writer http.ResponseWriter, request *http.Request) {
//TODO: We should probably send over the EL eventID as a X-Tekton-Event-Id header as well
// TODO: We should probably send over the EL eventID as a X-Tekton-Event-Id header as well
payload, err := github.ValidatePayload(request, []byte(secretToken))
id := github.DeliveryID(request)
if err != nil {
Expand Down
4 changes: 2 additions & 2 deletions pkg/reconciler/v1alpha1/eventlistener/eventlistener.go
Original file line number Diff line number Diff line change
Expand Up @@ -613,7 +613,7 @@ func (r *Reconciler) reconcileCustomObject(ctx context.Context, logger *zap.Suga
}
}

//if dynamicduck.ReconcileCustomObject(existingCustomObject, data) {
// if dynamicduck.ReconcileCustomObject(existingCustomObject, data) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we remove this comment?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe that's a separate PR...not sure the context behind the comment

if updated {
existingMarshaledData, err := json.Marshal(existingObject)
if err != nil {
Expand Down Expand Up @@ -981,7 +981,7 @@ func defaultObservabilityConfigMap() *corev1.ConfigMap {
return &corev1.ConfigMap{
ObjectMeta: metav1.ObjectMeta{Name: metrics.ConfigMapName()},
Data: map[string]string{
//TODO: Better nonempty config
// TODO: Better nonempty config
"_example": "See tekton-pipelines namespace for valid values",
},
}
Expand Down
8 changes: 4 additions & 4 deletions pkg/sink/auth_override.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,10 @@ import (
"k8s.io/client-go/rest"
)

//AuthOverride is an interface that constructs a discovery client for the ServerResourceInterface
//and a dynamic client for the Tekton Resources, using the token provide as the bearer token in the
//REST config used to build those client. The other non-credential related parameters for the
//REST client used are copied from the in cluster config of the event sink.
// AuthOverride is an interface that constructs a discovery client for the ServerResourceInterface
// and a dynamic client for the Tekton Resources, using the token provide as the bearer token in the
// REST config used to build those client. The other non-credential related parameters for the
// REST client used are copied from the in cluster config of the event sink.
type AuthOverride interface {
OverrideAuthentication(sa string,
namespace string,
Expand Down
2 changes: 1 addition & 1 deletion pkg/sink/metrics_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ func TestRecordResourceCreation(t *testing.T) {
}
}
v := view.Find("triggered_resources")
//need to unregister the view so the counts reset
// need to unregister the view so the counts reset
view.Unregister(v)
})
}
Expand Down
4 changes: 2 additions & 2 deletions pkg/sink/sink.go
Original file line number Diff line number Diff line change
Expand Up @@ -168,8 +168,8 @@ func (r Sink) HandleEvent(response http.ResponseWriter, request *http.Request) {
}(*t)
}

//The eventlistener waits until all the trigger executions (up-to the creation of the resources) and
//only when at least one of the execution completed successfully, it returns response code 201(Created) otherwise it returns 202 (Accepted).
// The eventlistener waits until all the trigger executions (up-to the creation of the resources) and
// only when at least one of the execution completed successfully, it returns response code 201(Created) otherwise it returns 202 (Accepted).
code := http.StatusAccepted
for i := 0; i < len(triggers); i++ {
thiscode := <-result
Expand Down
2 changes: 1 addition & 1 deletion pkg/template/jsonpath.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ func parseJSONPath(input interface{}, expr string) (string, error) {
j := jsonpath.New("").AllowMissingKeys(false)
buf := new(bytes.Buffer)

//First turn the expression into fully valid JSONPath
// First turn the expression into fully valid JSONPath
expr, err := tektonJSONPathExpression(expr)
if err != nil {
return "", err
Expand Down
2 changes: 1 addition & 1 deletion pkg/template/jsonpath_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ func TestParseJSONPath(t *testing.T) {
if err != nil {
t.Fatalf("parseJSONPath() error = %v", err)
}
if diff := cmp.Diff(strings.Replace(tt.want, " ", "", -1), got); diff != "" {
if diff := cmp.Diff(strings.ReplaceAll(tt.want, " ", ""), got); diff != "" {
t.Errorf("parseJSONPath() -want,+got: %s", diff)
}
})
Expand Down
8 changes: 4 additions & 4 deletions pkg/template/resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -129,10 +129,10 @@ func applyParamToResourceTemplate(param triggersv1.Param, rt json.RawMessage, ol
// Escape quotes so that that JSON strings can be appended to regular strings.
// See #257 for discussion on this behavior.
if oldEscape {
paramValue := strings.Replace(param.Value, `"`, `\"`, -1)
return bytes.Replace(rt, []byte(paramVariable), []byte(paramValue), -1)
paramValue := strings.ReplaceAll(param.Value, `"`, `\"`)
return bytes.ReplaceAll(rt, []byte(paramVariable), []byte(paramValue))
}
return bytes.Replace(rt, []byte(paramVariable), []byte(param.Value), -1)
return bytes.ReplaceAll(rt, []byte(paramVariable), []byte(param.Value))
}

// UUID generates a Universally Unique IDentifier following RFC 4122.
Expand All @@ -141,7 +141,7 @@ var UUID = func() string { return uuid.New().String() }
// applyUIDToResourceTemplate returns the TriggerResourceTemplate after uid replacement
// The same uid should be used per trigger to properly address resources throughout the TriggerTemplate.
func applyUIDToResourceTemplate(rt json.RawMessage, uid string) json.RawMessage {
return bytes.Replace(rt, uidMatch, []byte(uid), -1)
return bytes.ReplaceAll(rt, uidMatch, []byte(uid))
}

func convertParamMapToArray(paramMap map[string]string) []triggersv1.Param {
Expand Down