Repository navigation
Change the way builds are annotated - #1015
Conversation
|
I can confirm this allows the triggering of a new build with "latest" manifest (while master doesn't) |
|
The |
|
We should use the |
|
Should we move forward and merge (an updated version of) this now? |
2ec4661 to
74a124d
Compare
74a124d to
80ba9ee
Compare
| Template: &build.TemplateInstantiationSpec{ | ||
| Name: "riff-cnb", | ||
| Arguments: c.makeBuildArguments(options), | ||
| Object: &unstructured.Unstructured{ |
There was a problem hiding this comment.
it shouldn't be necessary to fallback to the unstructured option since we are using a Build resource.
| } | ||
|
|
||
| func (c *client) bumpNonceAnnotationForBuild(s *v1alpha1.Service) { | ||
| configurationSpec := s.Spec.RunLatest.Configuration |
There was a problem hiding this comment.
should we also handle Pinned and Release config modes?
There was a problem hiding this comment.
not in this PR, maybe separate issue
| configurationSpec := s.Spec.RunLatest.Configuration | ||
| build := getBuild(configurationSpec) | ||
| if build != nil { | ||
| annotations := build.GetAnnotations() |
There was a problem hiding this comment.
There's no need to use the get/set method, you can interact with the Annotations field directly.
There was a problem hiding this comment.
Hmmm, just keeping the same code we already had, also not seeing how I can manipulate the annotations directly on an Unstructured object
| annotations = map[string]string{} | ||
| } | ||
| nonce := annotations[buildAnnotation] | ||
| i, err := strconv.Atoi(nonce) |
There was a problem hiding this comment.
rather than futz with conversation and errors, can we simply assign a unique value like build.Generation or build.ResourceVersion if you'd rather a string. Both values are read-only (set by the api server) and guaranteed unique between mutations.
There was a problem hiding this comment.
again, just keeping the same logic we already had, maybe we can create a separate PR if we want to change this
| } | ||
|
|
||
| func getBuild(configSpec v1alpha1.ConfigurationSpec) *unstructured.Unstructured { | ||
| // Trap panic from the Knative resources.GetBuild function call |
There was a problem hiding this comment.
why does it panic? That seems like something that should be fixed upstream
There was a problem hiding this comment.
there are a couple of panics in the upstream code, seems to be when the data doesn't match what is expected
There was a problem hiding this comment.
I reworked our tests to create a more complete Build object to avoid triggering a panic
80ba9ee to
7422bac
Compare
|
rebased |
7422bac to
bee6db4
Compare
| "strconv" | ||
|
|
||
| "github.com/knative/serving/pkg/apis/serving/v1alpha1" | ||
| "github.com/knative/serving/pkg/reconciler/v1alpha1/configuration/resources" |
There was a problem hiding this comment.
We shouldn't use this package, it's an implementation detail for serving
There was a problem hiding this comment.
hmm, I agree that it is not ideal, but do you have a better idea how to access the annotations of the build definition embedded in the kservice?
There was a problem hiding this comment.
Do the equivalent of https://github.com/knative/serving/blob/99ceee84e0c158ea1388af3420feff63b37f60ef/pkg/reconciler/v1alpha1/configuration/resources/build.go#L62-L96 yourself.
If this is something we want Knative to maintain, we should add it as a method in https://github.com/knative/serving/tree/master/pkg/apis/serving/v1alpha1
There was a problem hiding this comment.
That seems worse, at least the implementation in knative is more likely to be maintained even if it is not exposed in the API
bee6db4 to
9f62019
Compare
|
Rebased and squashed |
- due to changes in Knative Serving we need to add a full Build as an Unstructured object - we can then annotated the Build instead of the Revision to trigger a build - this is necessary after the changes in knative/serving#2402 - use GetBuild method from "reconciler/v1alpha1/configuration/resources" - fix tests to create Build objects that pass validation - bump knative/build to 0.4.0
12850a4 to
d6f913e
Compare
|
Rebased and squashed, again |
due to changes in Knative Serving we need to add a full Build as an Unstructured object
we can then annotated the Build instead of the Revision to trigger a build
this is necessary after the changes in Don't create builds unless the BuildSpec changes. knative/serving#2402
Fixes #939