Skip to content

Commit

Permalink
support new /meta/version schema for ClientVersion (#32)
Browse files Browse the repository at this point in the history
  • Loading branch information
peter-cg authored Oct 24, 2023
1 parent 09959c9 commit 0a71190
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 3 deletions.
5 changes: 4 additions & 1 deletion dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -21935,6 +21935,9 @@ const fetchLatestEndorctlVersion = (api) => __awaiter(void 0, void 0, void 0, fu
if (!(0, utils_1.isVersionResponse)(data)) {
throw new Error(`Invalid response from Endor Labs API: \`${body}\``);
}
if (!data.ClientVersion) {
data.ClientVersion = data.Service.Version;
}
return data;
});
const setupEndorctl = ({ version, checksum, api }) => __awaiter(void 0, void 0, void 0, function* () {
Expand All @@ -21949,7 +21952,7 @@ const setupEndorctl = ({ version, checksum, api }) => __awaiter(void 0, void 0,
if (!version) {
core.info(`Endorctl version not provided, using latest version`);
const data = yield fetchLatestEndorctlVersion(api);
endorctlVersion = data.Service.Version;
endorctlVersion = data.ClientVersion;
endorctlChecksum = (0, utils_1.getEndorctlChecksum)(data.ClientChecksums, platform.os, platform.arch);
}
core.info(`Downloading endorctl version ${endorctlVersion}`);
Expand Down
2 changes: 1 addition & 1 deletion dist/index.js.map

Large diffs are not rendered by default.

6 changes: 5 additions & 1 deletion src/scan.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,10 @@ const fetchLatestEndorctlVersion = async (api: string) => {
throw new Error(`Invalid response from Endor Labs API: \`${body}\``);
}

if (!data.ClientVersion) {
data.ClientVersion = data.Service.Version;
}

return data;
};

Expand All @@ -67,7 +71,7 @@ const setupEndorctl = async ({ version, checksum, api }: SetupProps) => {
core.info(`Endorctl version not provided, using latest version`);

const data = await fetchLatestEndorctlVersion(api);
endorctlVersion = data.Service.Version;
endorctlVersion = data.ClientVersion;
endorctlChecksum = getEndorctlChecksum(
data.ClientChecksums,
platform.os,
Expand Down
1 change: 1 addition & 0 deletions src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ export interface ClientChecksumsType {

export interface VersionResponse {
Service: ServiceType;
ClientVersion: string;
ClientChecksums: ClientChecksumsType;
}

Expand Down

0 comments on commit 0a71190

Please sign in to comment.