Skip to content

Commit

Permalink
merge: #2599
Browse files Browse the repository at this point in the history
2599: feat(si): Ensure that the SI binary can update it's containers r=stack72 a=stack72

- fix(auth-api): Reenable the container updates from the github releases API
- fix(si): Ensure we are comparing the container version vs release digest from the auth-api for updates

there is an order of operations here - we need to release the SI binary *first* to get the good update behaviour in place then we can launch the auth-api


Co-authored-by: stack72 <[email protected]>
  • Loading branch information
si-bors-ng[bot] and stack72 authored Aug 17, 2023
2 parents bfe6545 + 3dea9b0 commit 029ebe0
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 7 deletions.
9 changes: 3 additions & 6 deletions bin/auth-api/src/routes/github.routes.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// import _ from 'lodash';
import _ from 'lodash';
import Axios from "axios";
import { tryCatch } from "../lib/try-catch";
import { ApiError } from "../lib/api-error";
Expand Down Expand Up @@ -110,7 +110,6 @@ router.get("/github/releases", async (ctx) => {
ctx.body = await loadReleases();
});

/*
interface GithubTag {
ref: string;
node_id: string;
Expand All @@ -132,13 +131,12 @@ interface LatestContainer {
let containersCachedAt: Date | null = null;
let containers: LatestContainer[] | null = null;
let loadingContainers: boolean = false;
*/

router.get("/github/containers/latest", async (ctx) => {
ctx.body = [];
// ctx.body = [];

// TODO: re-enable container updates when we fix the tags
/*

const seconds = Math.abs(Date.now() - (containersCachedAt?.getTime() ?? 0));
if ((seconds > 180 * 1000 || !containers) && !loadingContainers) {
loadingContainers = true;
Expand Down Expand Up @@ -201,5 +199,4 @@ router.get("/github/containers/latest", async (ctx) => {
}

ctx.body = containers ?? [];
*/
});
2 changes: 1 addition & 1 deletion lib/si-cli/src/cmd/update.rs
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ impl AppState {
continue;
}

if current.git_sha != latest.git_sha {
if current.version != latest.digest {
containers.push(latest);
}
continue 'outer;
Expand Down
6 changes: 6 additions & 0 deletions lib/si-cli/src/containers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ pub struct DockerReleaseInfo {
pub git_sha: String,
pub created_at: String,
pub image: String,
pub version: String,
}

#[derive(Clone, Debug)]
Expand Down Expand Up @@ -73,6 +74,11 @@ impl DockerClient {
.get("org.opencontainers.image.revision")
.unwrap()
.to_string(),
version: container
.labels
.get("org.opencontainers.image.version")
.unwrap()
.to_string(),
created_at: container
.labels
.get("org.opencontainers.image.created")
Expand Down

0 comments on commit 029ebe0

Please sign in to comment.