Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
9 changes: 6 additions & 3 deletions lib/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,13 +81,16 @@ class Utils {
if (!isLatestVer && (0, semver_1.lt)(version, this.MIN_CLI_VERSION)) {
throw new Error('Requested to download JFrog CLI version ' + version + ' but must be at least ' + this.MIN_CLI_VERSION);
}
if (jfrogCredentials.oidcProviderName && cliRemote != '') {
throw new Error('OIDC credentials are not supported for CLI remote downloads, please use an access token instead.');
}
if (!isLatestVer && this.loadFromCache(version)) {
core.info('Found JFrog CLI in cache. No need to download');
return;
}
// To download CLI from a remote repository, we first need to fetch an access token.
// This should fall back to the 'manual' oidc exchange method.
if (jfrogCredentials.oidcProviderName && cliRemote != '') {
core.debug("'Fetching OIDC access token to download CLI from remote repository");
jfrogCredentials.accessToken = yield oidc_utils_1.OidcUtils.exchangeOidcToken(jfrogCredentials);
}
// Download JFrog CLI
let downloadDetails = Utils.extractDownloadDetails(cliRemote, jfrogCredentials);
let url = Utils.getCliUrl(version, Utils.getJFrogExecutableName(), downloadDetails);
Expand Down
9 changes: 6 additions & 3 deletions src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,13 +95,16 @@ export class Utils {
if (!isLatestVer && lt(version, this.MIN_CLI_VERSION)) {
throw new Error('Requested to download JFrog CLI version ' + version + ' but must be at least ' + this.MIN_CLI_VERSION);
}
if (jfrogCredentials.oidcProviderName && cliRemote != '') {
throw new Error('OIDC credentials are not supported for CLI remote downloads, please use an access token instead.');
}
if (!isLatestVer && this.loadFromCache(version)) {
core.info('Found JFrog CLI in cache. No need to download');
return;
}
// To download CLI from a remote repository, we first need to fetch an access token.
// This should fall back to the 'manual' oidc exchange method.
if (jfrogCredentials.oidcProviderName && cliRemote != '') {
core.debug("'Fetching OIDC access token to download CLI from remote repository");
jfrogCredentials.accessToken = await OidcUtils.exchangeOidcToken(jfrogCredentials);
}
// Download JFrog CLI
let downloadDetails: DownloadDetails = Utils.extractDownloadDetails(cliRemote, jfrogCredentials);
let url: string = Utils.getCliUrl(version, Utils.getJFrogExecutableName(), downloadDetails);
Expand Down
Loading