Skip to content
This repository has been archived by the owner on Jun 11, 2024. It is now read-only.

Lisk core upgrade to latest version using Lisk commander failed - Closes #4037 #4079

Merged
merged 3 commits into from
Aug 14, 2019
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 9 additions & 4 deletions commander/src/commands/core/install.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,15 @@ import * as fsExtra from 'fs-extra';
import Listr from 'listr';
import * as os from 'os';
import BaseCommand from '../../base';
import { NETWORK, SNAPSHOT_URL } from '../../utils/constants';
import { NETWORK, RELEASE_URL, SNAPSHOT_URL } from '../../utils/constants';
import {
createDirectory,
generateEnvConfig,
getDownloadedFileInfo,
getVersionToInstall,
isSupportedOS,
liskInstall,
liskLatestUrl,
liskSnapshotUrl,
validateNetwork,
validateNotARootUser,
Expand Down Expand Up @@ -65,6 +66,7 @@ interface Options {
readonly liskTarSHA256Url: string;
readonly liskTarUrl: string;
readonly version: string;
readonly latestUrl: string;
}

const validatePrerequisite = (installPath: string): void => {
Expand Down Expand Up @@ -103,14 +105,16 @@ const installOptions = async (
): Promise<Options> => {
const installPath = liskInstall(installationPath);
const installDir = `${installPath}/${name}/`;
const latestUrl = releaseUrl || liskLatestUrl(RELEASE_URL, network);

const installVersion: string = await getVersionToInstall(
network,
liskVersion,
releaseUrl,
);

const { version, liskTarUrl, liskTarSHA256Url } = await getReleaseInfo(
releaseUrl,
latestUrl,
network,
installVersion,
);
Expand All @@ -120,6 +124,7 @@ const installOptions = async (
version,
liskTarUrl,
liskTarSHA256Url,
latestUrl,
};
};

Expand Down Expand Up @@ -225,12 +230,12 @@ export default class InstallCommand extends BaseCommand {
{
title: 'Validate root user, flags, prerequisites',
task: async ctx => {
const { installDir, releaseUrl } = ctx.options;
const { installDir, latestUrl } = ctx.options;
validateNotARootUser();
validateFlags(flags as Flags);
validatePrerequisite(installDir);
if (liskVersion) {
await validateVersion(releaseUrl, liskVersion);
await validateVersion(latestUrl, liskVersion);
ctx.options.version = liskVersion;
}
},
Expand Down
6 changes: 5 additions & 1 deletion commander/src/commands/core/upgrade.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,14 @@ import * as fsExtra from 'fs-extra';
import Listr from 'listr';
import semver from 'semver';
import BaseCommand from '../../base';
import { RELEASE_URL } from '../../utils/constants';
import { isCacheRunning, startCache, stopCache } from '../../utils/core/cache';
import {
backupLisk,
generateEnvConfig,
getDownloadedFileInfo,
getVersionToInstall,
liskLatestUrl,
upgradeLisk,
validateVersion,
} from '../../utils/core/commons';
Expand Down Expand Up @@ -125,7 +127,9 @@ export default class UpgradeCommand extends BaseCommand {
`Upgrade version:${upgradeVersion} should be greater than current version: ${currentVersion}`,
);
}
await validateVersion(releaseUrl, upgradeVersion);
const latestUrl = releaseUrl || liskLatestUrl(RELEASE_URL, network);

await validateVersion(latestUrl, upgradeVersion);
},
},
{
Expand Down