feat: working within 2 major version

Signed-off-by: Aleksei Igrychev <aleksei.igrychev@palark.com>
This commit is contained in:
Aleksei Igrychev
2024-04-24 14:03:13 +01:00
parent 43d2310151
commit 41f4b68701
17 changed files with 2639 additions and 1600 deletions

View File

@@ -7,8 +7,6 @@ import {String} from 'typescript-string-operations'
import {Manager} from './manager'
import * as werf from './werf'
const minimalWerfVersion = 'v1.1.17'
export async function PrepareEnvironAndRunWerfCommand(
args: string[]
): Promise<void> {
@@ -67,27 +65,15 @@ export function ProcessGitHubContext(): void {
export function ValidateWerfVersion(version: string): void {
const ver = semver.coerce(version)
if (ver) {
if (ver.major !== werf.MAJOR || ver.minor !== werf.MINOR) {
throw new Error(
String.Format(
'The arbitrary version ({0}) must be within the MAJOR.MINOR ({1})',
version.trim(),
werf.MAJOR_MINOR_GROUP
)
)
}
if (semver.gte(ver, minimalWerfVersion)) {
return
}
if (ver && ver.major === werf.MAJOR) {
return
}
throw new Error(
String.Format(
'werf version {0} is not supported (expected version must be equal or greater than {1})',
'werf version {0} is not supported: the version must be semver and within the MAJOR ({1})',
version.trim(),
minimalWerfVersion
werf.GROUP
)
)
}

View File

@@ -125,7 +125,7 @@ export class Manager {
return this._constructReleaseUrl(version)
}
const url = `${WERF_TUF_SERVER_URL}/targets/channels/${werf.MAJOR_MINOR_GROUP}/${this.channel}`
const url = `${WERF_TUF_SERVER_URL}/targets/channels/${werf.GROUP}/${this.channel}`
try {
const resp = await request
.get(url)

View File

@@ -1,3 +1,2 @@
export const MAJOR_MINOR_GROUP = '1.2'
export const MAJOR = 1
export const MINOR = 2
export const GROUP = '2'
export const MAJOR = 2