-
Notifications
You must be signed in to change notification settings - Fork 119
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
upgrade to latest dependencies (#822)
bumping knative.dev/eventing 31cda4c...8565fcd: > 8565fcd Clean up resources created by Feature tests (# 5289) > 73ce225 [Rekt] Channel Delivery Spec data plane tests. (# 5279) > 5ed9b36 event type v1beta1 (# 5272) > 5855490 Running validation for events on broker ingress (# 5275) > 0fa5989 Add pre-review checklist to PR template (# 5184) > f1909db Improve performance of eventfilter lookups (# 5288) > 60bc1cf break delivery/routing tests into features (# 5287) > 79e83bd adding more polling for channel tests (# 5284) bumping knative.dev/reconciler-test b0c3de2...4598ca0: > 4598ca0 add feature to context, add refs to feature (# 183) > 15b4e12 Fail on feature.Require errors. (# 182) > 2e99af8 upgrade to latest dependencies (# 179) > 9efa295 implement step planning event (# 178) Signed-off-by: Knative Automation <automation@knative.team>
- Loading branch information
1 parent
527c7a5
commit 696a286
Showing
9 changed files
with
111 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
/* | ||
Copyright 2021 The Knative Authors | ||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
*/ | ||
|
||
package feature | ||
|
||
import ( | ||
"context" | ||
) | ||
|
||
type envKey struct{} | ||
|
||
// ContextWith decorates the given context with the provided Feature, and returns | ||
// the resulting context. | ||
func ContextWith(ctx context.Context, f *Feature) context.Context { | ||
return context.WithValue(ctx, envKey{}, f) | ||
} | ||
|
||
// FromContext returns the Feature from Context, if not found FromContext will | ||
// panic. | ||
// TODO: revisit if we really want to panic here... likely not. | ||
func FromContext(ctx context.Context) *Feature { | ||
if e, ok := ctx.Value(envKey{}).(*Feature); ok { | ||
return e | ||
} | ||
panic("no Feature found in context") | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.