lburgazzoli commented on a change in pull request #76: Context handling
improvement
URL: https://github.com/apache/camel-k/pull/76#discussion_r217885800
##########
File path: pkg/stub/action/integration/build.go
##########
@@ -53,44 +50,65 @@ func (action *buildAction) Handle(integration
*v1alpha1.Integration) error {
return err
}
-
if ctx != nil {
+ if ctx.Labels["camel.apache.org/context.type"] == "platform" {
+ // This is a platform context and as it is auto
generated it may get
+ // out of sync if the integration that has generated
it, has been
+ // amended to add/remove dependencies
+
+ //TODO: this is a very simple check, we may need to
provide a deps comparison strategy
+ if !StringSliceContains(ctx.Spec.Dependencies,
integration.Spec.Dependencies) {
+ // We need to re-generate a context or search
for a new one that
+ // satisfies integrations needs so let's remove
the association
+ // with a context
+ target := integration.DeepCopy()
+ target.Spec.Context = ""
+ return sdk.Update(target)
+ }
+ }
+
if ctx.Status.Phase == v1alpha1.IntegrationContextPhaseReady {
target := integration.DeepCopy()
target.Status.Image = ctx.Status.Image
+ target.Spec.Context = ctx.Name
target.Status.Phase = v1alpha1.IntegrationPhaseDeploying
return sdk.Update(target)
}
+ if integration.Spec.Context == "" {
+ // We need to set the context
+ target := integration.DeepCopy()
+ target.Spec.Context = ctx.Name
+ return sdk.Update(target)
+ }
+
return nil
}
- buildIdentifier := api.BuildIdentifier{
- Name: integration.Name,
- Qualifier: integration.Status.Digest,
+ platformCtxName := fmt.Sprintf("ctx-%s-%s", integration.Name,
integration.ResourceVersion)
Review comment:
Yes this was for "tracking purpose" while building, we'll define an
independent name.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services