Skip to content

Revert default server ID removal #234

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

Merged
merged 1 commit into from
Dec 10, 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
8 changes: 4 additions & 4 deletions lib/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -350,10 +350,10 @@ class Utils {
return Utils.getRunDefaultServerId();
}
/**
* Return a server ID that is unique for this workflow run based on the GitHub repository and run ID.
* Return the default server ID for JFrog CLI server configuration.
*/
static getRunDefaultServerId() {
return [Utils.SETUP_JFROG_CLI_SERVER_ID_PREFIX, process.env.GITHUB_REPOSITORY, process.env.GITHUB_RUN_ID].join('-');
return Utils.SETUP_JFROG_CLI_SERVER_ID;
}
static setCliEnv() {
Utils.exportVariableIfNotSet('JFROG_CLI_ENV_EXCLUDE', '*password*;*secret*;*key*;*token*;*auth*;JF_ARTIFACTORY_*;JF_ENV_*;JF_URL;JF_USER;JF_PASSWORD;JF_ACCESS_TOKEN');
Expand Down Expand Up @@ -773,8 +773,8 @@ Utils.LATEST_CLI_VERSION = 'latest';
Utils.LATEST_RELEASE_VERSION = '[RELEASE]';
// Placeholder CLI version to use to keep 'latest' in cache.
Utils.LATEST_SEMVER = '100.100.100';
// The prefix for the default server id name for JFrog CLI config
Utils.SETUP_JFROG_CLI_SERVER_ID_PREFIX = 'setup-jfrog-cli-server';
// The default server id name for separate env config
Utils.SETUP_JFROG_CLI_SERVER_ID = 'setup-jfrog-cli-server';
// Environment variable to hold all configured server IDs, separated by ';'
Utils.JFROG_CLI_SERVER_IDS_ENV_VAR = 'SETUP_JFROG_CLI_SERVER_IDS';
// Directory name which holds markdown files for the Workflow summary
Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

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

8 changes: 4 additions & 4 deletions src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ export class Utils {
private static readonly LATEST_RELEASE_VERSION: string = '[RELEASE]';
// Placeholder CLI version to use to keep 'latest' in cache.
public static readonly LATEST_SEMVER: string = '100.100.100';
// The prefix for the default server id name for JFrog CLI config
public static readonly SETUP_JFROG_CLI_SERVER_ID_PREFIX: string = 'setup-jfrog-cli-server';
// The default server id name for separate env config
public static readonly SETUP_JFROG_CLI_SERVER_ID: string = 'setup-jfrog-cli-server';
// Environment variable to hold all configured server IDs, separated by ';'
public static readonly JFROG_CLI_SERVER_IDS_ENV_VAR: string = 'SETUP_JFROG_CLI_SERVER_IDS';
// Directory name which holds markdown files for the Workflow summary
Expand Down Expand Up @@ -398,10 +398,10 @@ export class Utils {
}

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

public static setCliEnv() {
Expand Down
11 changes: 2 additions & 9 deletions test/main.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -156,15 +156,8 @@ function testConfigCommand(expectedServerId: string) {
}

describe('JFrog CLI Configuration', () => {
beforeAll(() => {
process.env.GITHUB_REPOSITORY = 'owner/repo';
process.env.GITHUB_RUN_ID = '1';
});

afterAll(() => {
['GITHUB_REPOSITORY', 'GITHUB_RUN_ID', Utils.JFROG_CLI_SERVER_IDS_ENV_VAR].forEach((envKey) => {
delete process.env[envKey];
});
delete process.env[Utils.JFROG_CLI_SERVER_IDS_ENV_VAR];
});
const myCore: jest.Mocked<typeof core> = core as any;

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

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

Expand Down
Loading