Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Commands for Enhanced Usage Insights #224

Merged
merged 11 commits into from
Nov 14, 2024
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
2 changes: 1 addition & 1 deletion action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ author: "JFrog"
inputs:
version:
description: "JFrog CLI Version"
default: "2.68.0"
default: "2.71.4"
required: false
download-repository:
description: "Remote repository in Artifactory pointing to 'https://releases.jfrog.io/artifactory/jfrog-cli'. Use this parameter in case you don't have an Internet access."
Expand Down
3 changes: 3 additions & 0 deletions lib/cleanup.js
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,9 @@ function collectAndPublishBuildInfoIfNeeded() {
// Publish the build info to Artifactory
try {
core.startGroup('Publish the build info to JFrog Artifactory');
// Set the environment variable to indicate that the build has been automatically published.
// This is used by the usage report to track instances of automatic build publication.
core.exportVariable('JFROG_CLI_USAGE_AUTO_BUILD_PUBLISHED', 'TRUE');
yield utils_1.Utils.runCli(['rt', 'build-publish'], { cwd: workingDirectory });
}
catch (error) {
Expand Down
5 changes: 4 additions & 1 deletion lib/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,10 @@ class Utils {
throw new Error(`Getting openID Connect JSON web token failed: ${error.message}`);
}
try {
return yield this.getJfrogAccessTokenThroughOidcProtocol(jfrogCredentials, jsonWebToken, oidcProviderName);
jfrogCredentials = yield this.getJfrogAccessTokenThroughOidcProtocol(jfrogCredentials, jsonWebToken, oidcProviderName);
// Set environment variable to track OIDC logins in the usage report.
core.exportVariable('JFROG_CLI_USAGE_CONFIG_OIDC', 'TRUE');
return jfrogCredentials;
}
catch (error) {
throw new Error(`Exchanging JSON web token with an access token failed: ${error.message}`);
Expand Down
2 changes: 1 addition & 1 deletion node_modules/.package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@jfrog/setup-jfrog-cli",
"version": "4.4.1",
"version": "4.4.2",
"private": true,
"description": "Setup JFrog CLI in GitHub Actions",
"main": "lib/main.js",
Expand Down
3 changes: 3 additions & 0 deletions src/cleanup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,9 @@ async function collectAndPublishBuildInfoIfNeeded() {
// Publish the build info to Artifactory
try {
core.startGroup('Publish the build info to JFrog Artifactory');
// Set the environment variable to indicate that the build has been automatically published.
// This is used by the usage report to track instances of automatic build publication.
core.exportVariable('JFROG_CLI_USAGE_AUTO_BUILD_PUBLISHED', 'TRUE');
await Utils.runCli(['rt', 'build-publish'], { cwd: workingDirectory });
} catch (error) {
core.warning('Failed while attempting to publish the build info to JFrog Artifactory: ' + error);
Expand Down
5 changes: 4 additions & 1 deletion src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,10 @@ export class Utils {
}

try {
return await this.getJfrogAccessTokenThroughOidcProtocol(jfrogCredentials, jsonWebToken, oidcProviderName);
jfrogCredentials = await this.getJfrogAccessTokenThroughOidcProtocol(jfrogCredentials, jsonWebToken, oidcProviderName);
// Set environment variable to track OIDC logins in the usage report.
core.exportVariable('JFROG_CLI_USAGE_CONFIG_OIDC', 'TRUE');
return jfrogCredentials;
} catch (error: any) {
throw new Error(`Exchanging JSON web token with an access token failed: ${error.message}`);
}
Expand Down
Loading