Skip to content

Commit fd3db35

Browse files
authored
Revert default server ID removal (#234)
1 parent 040913f commit fd3db35

File tree

4 files changed

+11
-18
lines changed

4 files changed

+11
-18
lines changed

lib/utils.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -350,10 +350,10 @@ class Utils {
350350
return Utils.getRunDefaultServerId();
351351
}
352352
/**
353-
* Return a server ID that is unique for this workflow run based on the GitHub repository and run ID.
353+
* Return the default server ID for JFrog CLI server configuration.
354354
*/
355355
static getRunDefaultServerId() {
356-
return [Utils.SETUP_JFROG_CLI_SERVER_ID_PREFIX, process.env.GITHUB_REPOSITORY, process.env.GITHUB_RUN_ID].join('-');
356+
return Utils.SETUP_JFROG_CLI_SERVER_ID;
357357
}
358358
static setCliEnv() {
359359
Utils.exportVariableIfNotSet('JFROG_CLI_ENV_EXCLUDE', '*password*;*secret*;*key*;*token*;*auth*;JF_ARTIFACTORY_*;JF_ENV_*;JF_URL;JF_USER;JF_PASSWORD;JF_ACCESS_TOKEN');
@@ -773,8 +773,8 @@ Utils.LATEST_CLI_VERSION = 'latest';
773773
Utils.LATEST_RELEASE_VERSION = '[RELEASE]';
774774
// Placeholder CLI version to use to keep 'latest' in cache.
775775
Utils.LATEST_SEMVER = '100.100.100';
776-
// The prefix for the default server id name for JFrog CLI config
777-
Utils.SETUP_JFROG_CLI_SERVER_ID_PREFIX = 'setup-jfrog-cli-server';
776+
// The default server id name for separate env config
777+
Utils.SETUP_JFROG_CLI_SERVER_ID = 'setup-jfrog-cli-server';
778778
// Environment variable to hold all configured server IDs, separated by ';'
779779
Utils.JFROG_CLI_SERVER_IDS_ENV_VAR = 'SETUP_JFROG_CLI_SERVER_IDS';
780780
// Directory name which holds markdown files for the Workflow summary

package-lock.json

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/utils.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@ export class Utils {
3333
private static readonly LATEST_RELEASE_VERSION: string = '[RELEASE]';
3434
// Placeholder CLI version to use to keep 'latest' in cache.
3535
public static readonly LATEST_SEMVER: string = '100.100.100';
36-
// The prefix for the default server id name for JFrog CLI config
37-
public static readonly SETUP_JFROG_CLI_SERVER_ID_PREFIX: string = 'setup-jfrog-cli-server';
36+
// The default server id name for separate env config
37+
public static readonly SETUP_JFROG_CLI_SERVER_ID: string = 'setup-jfrog-cli-server';
3838
// Environment variable to hold all configured server IDs, separated by ';'
3939
public static readonly JFROG_CLI_SERVER_IDS_ENV_VAR: string = 'SETUP_JFROG_CLI_SERVER_IDS';
4040
// Directory name which holds markdown files for the Workflow summary
@@ -398,10 +398,10 @@ export class Utils {
398398
}
399399

400400
/**
401-
* Return a server ID that is unique for this workflow run based on the GitHub repository and run ID.
401+
* Return the default server ID for JFrog CLI server configuration.
402402
*/
403403
static getRunDefaultServerId(): string {
404-
return [Utils.SETUP_JFROG_CLI_SERVER_ID_PREFIX, process.env.GITHUB_REPOSITORY, process.env.GITHUB_RUN_ID].join('-');
404+
return Utils.SETUP_JFROG_CLI_SERVER_ID;
405405
}
406406

407407
public static setCliEnv() {

test/main.spec.ts

+2-9
Original file line numberDiff line numberDiff line change
@@ -156,15 +156,8 @@ function testConfigCommand(expectedServerId: string) {
156156
}
157157

158158
describe('JFrog CLI Configuration', () => {
159-
beforeAll(() => {
160-
process.env.GITHUB_REPOSITORY = 'owner/repo';
161-
process.env.GITHUB_RUN_ID = '1';
162-
});
163-
164159
afterAll(() => {
165-
['GITHUB_REPOSITORY', 'GITHUB_RUN_ID', Utils.JFROG_CLI_SERVER_IDS_ENV_VAR].forEach((envKey) => {
166-
delete process.env[envKey];
167-
});
160+
delete process.env[Utils.JFROG_CLI_SERVER_IDS_ENV_VAR];
168161
});
169162
const myCore: jest.Mocked<typeof core> = core as any;
170163

@@ -187,7 +180,7 @@ describe('JFrog CLI Configuration', () => {
187180
});
188181

189182
test('Get default server ID', async () => {
190-
expect(Utils.getRunDefaultServerId()).toStrictEqual('setup-jfrog-cli-server-owner/repo-1');
183+
expect(Utils.getRunDefaultServerId()).toStrictEqual('setup-jfrog-cli-server');
191184
});
192185
});
193186

0 commit comments

Comments
 (0)