Skip to content

Commit

Permalink
Use the right sequences (#908)
Browse files Browse the repository at this point in the history
* use the right sequences
  • Loading branch information
sgalsaleh committed Aug 5, 2020
1 parent 18e2286 commit 7574b10
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 5 deletions.
2 changes: 1 addition & 1 deletion kotsadm/api/src/kots_app/gitops.ts
Expand Up @@ -41,7 +41,7 @@ export async function createGitCommitForVersion(stores: Stores, appId: string, c
const gitOpsCreds = await stores.kotsAppStore.getGitOpsCreds(app.id, cluster.id);
const downstreamGitOps = await stores.kotsAppStore.getDownstreamGitOps(appId, clusterId);

const kotsApp = await stores.kotsAppStore.getKotsAppSpec(appId, app.currentSequence!);
const kotsApp = await stores.kotsAppStore.getKotsAppSpec(appId, parentSequence);

const rendered = await app.render(`${parentSequence}`, `overlays/downstreams/${cluster.title}`, kotsApp ? kotsApp.kustomizeVersion : "");

Expand Down
4 changes: 2 additions & 2 deletions kotsadm/api/src/snapshots/backup.ts
Expand Up @@ -35,8 +35,8 @@ export async function backup(stores: Stores, appId: string, scheduled: boolean):
name = `scheduled-${Date.now()}`;
}

const tmpl = await stores.snapshotsStore.getKotsBackupSpec(appId, deployedVersion.sequence);
const rendered = await kotsRenderFile(app, app.currentSequence!, tmpl, registryInfo);
const tmpl = await stores.snapshotsStore.getKotsBackupSpec(appId, deployedVersion.parentSequence!);
const rendered = await kotsRenderFile(app, deployedVersion.parentSequence!, tmpl, registryInfo);
const base = yaml.safeLoad(rendered) as Backup;
const spec = (base && base.spec) || {};

Expand Down
8 changes: 6 additions & 2 deletions kotsadm/pkg/updatechecker/updatechecker.go
Expand Up @@ -227,9 +227,13 @@ func CheckForUpdates(appID string, deploy bool) (int64, error) {
if err != nil {
return 0, errors.Wrap(err, "failed to list downstreams for app")
}
downstream := downstreams[0]

if latestVersion.Sequence != downstream.CurrentSequence {
downstreamParentSequence, err := downstream.GetCurrentParentSequence(a.ID, downstreams[0].ClusterID)
if err != nil {
return 0, errors.Wrap(err, "failed to get current downstream parent sequence")
}

if latestVersion.Sequence != downstreamParentSequence {
err := version.DeployVersion(a.ID, latestVersion.Sequence)
if err != nil {
return 0, errors.Wrap(err, "failed to deploy latest version")
Expand Down

0 comments on commit 7574b10

Please sign in to comment.