Skip to content

Commit 18e785f

Browse files
authored
Add Commands for Enhanced Usage Insights (#224)
1 parent 2b7ec79 commit 18e785f

File tree

8 files changed

+19
-7
lines changed

8 files changed

+19
-7
lines changed

action.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ author: "JFrog"
44
inputs:
55
version:
66
description: "JFrog CLI Version"
7-
default: "2.68.0"
7+
default: "2.71.4"
88
required: false
99
download-repository:
1010
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."

lib/cleanup.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,9 @@ function collectAndPublishBuildInfoIfNeeded() {
139139
// Publish the build info to Artifactory
140140
try {
141141
core.startGroup('Publish the build info to JFrog Artifactory');
142+
// Set the environment variable to indicate that the build has been automatically published.
143+
// This is used by the usage report to track instances of automatic build publication.
144+
core.exportVariable('JFROG_CLI_USAGE_AUTO_BUILD_PUBLISHED', 'TRUE');
142145
yield utils_1.Utils.runCli(['rt', 'build-publish'], { cwd: workingDirectory });
143146
}
144147
catch (error) {

lib/utils.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,10 @@ class Utils {
7575
throw new Error(`Getting openID Connect JSON web token failed: ${error.message}`);
7676
}
7777
try {
78-
return yield this.getJfrogAccessTokenThroughOidcProtocol(jfrogCredentials, jsonWebToken, oidcProviderName);
78+
jfrogCredentials = yield this.getJfrogAccessTokenThroughOidcProtocol(jfrogCredentials, jsonWebToken, oidcProviderName);
79+
// Set environment variable to track OIDC logins in the usage report.
80+
core.exportVariable('JFROG_CLI_USAGE_CONFIG_OIDC', 'TRUE');
81+
return jfrogCredentials;
7982
}
8083
catch (error) {
8184
throw new Error(`Exchanging JSON web token with an access token failed: ${error.message}`);

node_modules/.package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@jfrog/setup-jfrog-cli",
3-
"version": "4.4.1",
3+
"version": "4.4.2",
44
"private": true,
55
"description": "Setup JFrog CLI in GitHub Actions",
66
"main": "lib/main.js",

src/cleanup.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,9 @@ async function collectAndPublishBuildInfoIfNeeded() {
106106
// Publish the build info to Artifactory
107107
try {
108108
core.startGroup('Publish the build info to JFrog Artifactory');
109+
// Set the environment variable to indicate that the build has been automatically published.
110+
// This is used by the usage report to track instances of automatic build publication.
111+
core.exportVariable('JFROG_CLI_USAGE_AUTO_BUILD_PUBLISHED', 'TRUE');
109112
await Utils.runCli(['rt', 'build-publish'], { cwd: workingDirectory });
110113
} catch (error) {
111114
core.warning('Failed while attempting to publish the build info to JFrog Artifactory: ' + error);

src/utils.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,10 @@ export class Utils {
9696
}
9797

9898
try {
99-
return await this.getJfrogAccessTokenThroughOidcProtocol(jfrogCredentials, jsonWebToken, oidcProviderName);
99+
jfrogCredentials = await this.getJfrogAccessTokenThroughOidcProtocol(jfrogCredentials, jsonWebToken, oidcProviderName);
100+
// Set environment variable to track OIDC logins in the usage report.
101+
core.exportVariable('JFROG_CLI_USAGE_CONFIG_OIDC', 'TRUE');
102+
return jfrogCredentials;
100103
} catch (error: any) {
101104
throw new Error(`Exchanging JSON web token with an access token failed: ${error.message}`);
102105
}

0 commit comments

Comments
 (0)