Skip to content
This repository has been archived by the owner on Nov 1, 2022. It is now read-only.

Make auto-release commits and events more accurate #1036

Merged
merged 4 commits into from
Apr 5, 2018

Conversation

squaremo
Copy link
Member

@squaremo squaremo commented Apr 4, 2018

As described in #1026, it's possible to calculate a set of image updates that do not end up being carried out, usually because the cluster doesn't quite reflect what's in the git repo.

As a conservative fix that doesn't change behaviour, this PR makes the reporting of auto-releases more accurate by

  1. skipping any changes that were calculated but turn out not to be changes;
  2. including only what was changed successfully in the commit message and event

There's also a bit of tidying and making way for deeper changes -- future work can, for example,

  • remove the separate preparation and application steps of auto-releases. At the minute, when it's time to do an "automation run", a list of updates is compiled by comparing the images running in the cluster with those available in the image registry. It's applied after going through the job queue; but since it has to look at the git repo in both steps anyway, it may as well just do everything when the job runs.

  • remove the Calculate and ApplyChanges steps, or at least stop the latter from just splatting bytes into the given file, since that will prevent updates to multidoc files and List resources from working properly.

squaremo added 4 commits April 4, 2018 18:32
So that we can (shortly) use the same definition of containers whether
we get them the cluster or from a manifest, move the Container type to
the `resource`. This also updates the type so that images are parsed
when constructed, i.e., in one place.
This commit adds an interface `resource.Workload`, and implements it
for the "pod controller" resources. This makes it possible to
calculate based on the images used in the resources, rather than those
used in the cluster (without implementing exactly that, yet).
We will want to be able to call CollectAvailableImages with values
from the cluster (as in `daemon.ListImages(...)`), but also with
values from the manifests (when calculating what images can be
updated).
Part of the problem being addressed here is that releases decide what
to do based on the images used in the cluster, and that does not
always correspond to changes in the repo. This commit removes the
possibility for automated releases, by

 - skipping any containers that _already_ use the supposedly new image

 - building the commit message by looking only at the images that were
   successfully changed.
Name string
Image string
}

// Sometimes we care if we can't find the containers for a service,
// sometimes we just want the information we can get.

This comment was marked as abuse.

This comment was marked as abuse.

}

func (s Controller) ContainersOrNil() []Container {
func (s Controller) ContainersOrNil() []resource.Container {
return s.Containers.Containers

This comment was marked as abuse.

This comment was marked as abuse.

@squaremo squaremo merged commit fe2e322 into master Apr 5, 2018
@squaremo squaremo deleted the issue/1026-look-at-git-not-cluster branch April 5, 2018 10:18
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants