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

[CSR-1645] fix: Rename from --paths to --path #16

Merged
merged 1 commit into from
Oct 2, 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
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,9 @@ To explore additional examples and filtering options for receiving runs, you can

### Caching artifacts

The `currents cache` command allows you to archive files from specified locations and save them under an ID in Currents storage. It also stores a meta file with configuration data. You can provide the ID manually or it can be generated based on CI environment variables (only GitHub and GitLab are supported). The files to archive can be defined using the `paths <path-1,path2,...,path-n>` CLI option or predefined using a `preset`.
The `currents cache` command allows you to archive files from specified locations and save them under an ID in Currents storage. It also stores a meta file with configuration data. You can provide the ID manually or it can be generated based on CI environment variables (only GitHub and GitLab are supported). The files to archive can be defined using the `path <path-1,path2,...,path-n>` CLI option or predefined using a `preset`.

To cache files, run `npx currents cache set --key <record-key> --id <id> --paths <path-1,path-2,...path-n>`.
To cache files, run `npx currents cache set --key <record-key> --id <id> --path <path-1,path-2,...path-n>`.

To download files, run `npx currents cache set --key <record-key> --preset last-run`.

Expand Down
2 changes: 1 addition & 1 deletion packages/cmd/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ The `currents cache` command allows you to archive files from specified location
To cache files, use the following command:

```sh
npx currents cache set --key <record-key> --id <id> --paths <path-1,path-2,...path-n>
npx currents cache set --key <record-key> --id <id> --path <path-1,path-2,...path-n>
```

To download files, use the following command:
Expand Down
6 changes: 3 additions & 3 deletions packages/cmd/src/commands/cache/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {
matrixIndexOption,
matrixTotalOption,
outputDirOption,
pathsOption,
pathOption,
presetOption,
presetOutputOption,
pwOutputDirOption,
Expand All @@ -22,7 +22,7 @@ const getExample = (name: string) => `
${chalk.bold('Examples')}

Save files to the cache under a specific ID:
${dim(`${name} ${COMMAND_NAME} set --key <record-key> --id <id> --paths <path-1,path-2,...path-n>`)}
${dim(`${name} ${COMMAND_NAME} set --key <record-key> --id <id> --path <path-1,path-2,...path-n>`)}

Retrieve files from the cache saved under a specific ID:
${dim(`${name} ${COMMAND_NAME} get --key <record-key> --id <id>`)}
Expand Down Expand Up @@ -57,7 +57,7 @@ export const getCacheSetCommand = () => {
.addOption(recordKeyOption)
.addOption(idOption)
.addOption(presetOption)
.addOption(pathsOption)
.addOption(pathOption)
.addOption(debugOption)
.addOption(pwOutputDirOption)
.addOption(matrixIndexOption)
Expand Down
4 changes: 2 additions & 2 deletions packages/cmd/src/commands/cache/options.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ export const idOption = new Option(
'The ID the data is saved under in the cache'
);

export const pathsOption = new Option(
'--paths <paths>',
export const pathOption = new Option(
'--path <path>',
'Comma-separated list of paths to cache'
).argParser(parseCommaSeparatedList);

Expand Down
2 changes: 1 addition & 1 deletion packages/cmd/src/config/cache/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ type CommonConfig = {

export type CacheSetCommandConfig = CacheCommandConfig &
CommonConfig & {
paths?: string[];
path?: string[];
pwOutputDir?: string;
};

Expand Down
4 changes: 2 additions & 2 deletions packages/cmd/src/config/cache/env.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@ const cacheSetCommandConfigKeys = {
name: 'Preset output path',
cli: '--preset-output',
},
paths: {
path: {
name: 'Paths to cache',
cli: '--paths',
cli: '--path',
},
matrixIndex: {
name: 'Matrix index',
Expand Down
2 changes: 1 addition & 1 deletion packages/cmd/src/config/cache/options.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export function cacheSetCommandOptsToConfig(
id: options.id,
preset: options.preset,
pwOutputDir: options.pwOutputDir,
paths: options.paths,
path: options.path,
debug: options.debug,
matrixIndex: options.matrixIndex,
matrixTotal: options.matrixTotal,
Expand Down
8 changes: 4 additions & 4 deletions packages/cmd/src/services/cache/lib.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export type MetaFile = {
id: string;
orgId: string;
config: CacheSetCommandConfig;
paths: string[];
path: string[];
ci: Record<string, unknown>;
createdAt: string;
};
Expand All @@ -16,20 +16,20 @@ export function createMeta({
config,
cacheId,
orgId,
paths,
path,
ci,
}: {
config: CacheSetCommandConfig;
cacheId: string;
orgId: string;
paths: string[];
path: string[];
ci: Record<string, unknown>;
}) {
const meta = {
id: cacheId,
orgId,
config: omit(config, 'recordKey'),
paths,
path,
ci,
createdAt: new Date().toISOString(),
};
Expand Down
4 changes: 2 additions & 2 deletions packages/cmd/src/services/cache/set.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export async function handleSetCache() {
const { recordKey, id, preset, pwOutputDir, matrixIndex, matrixTotal } =
config.values;

const paths = config.values.paths ? filterPaths(config.values.paths) : [];
const paths = config.values.path ? filterPaths(config.values.path) : [];

const uploadPaths: string[] = [];

Expand Down Expand Up @@ -62,7 +62,7 @@ export async function handleSetCache() {
config: config.values,
ci,
orgId: result.orgId,
paths: uploadPaths,
path: uploadPaths,
}),
cacheId: result.cacheId,
uploadUrl: result.metaUploadUrl,
Expand Down