1
0
Fork 0

modifies for warpcache

pull/1716/head
Prajjwal 2024-04-15 10:13:42 +05:30
parent 917853e23b
commit 9a8c6b26ce
33 changed files with 701 additions and 146 deletions

View File

@ -1,6 +1,6 @@
{ {
"name": "github-actions.warp-cache", "name": "github-actions.warp-cache",
"version": "0.3.0", "version": "1.0.0",
"preview": true, "preview": true,
"description": "Github action to use WarpBuild's in-house cache offering", "description": "Github action to use WarpBuild's in-house cache offering",
"keywords": [ "keywords": [

View File

@ -66,6 +66,7 @@ export function isFeatureAvailable(): boolean {
* @param restoreKeys an optional ordered list of keys to use for restoring the cache if no cache hit occurred for key * @param restoreKeys an optional ordered list of keys to use for restoring the cache if no cache hit occurred for key
* @param downloadOptions cache download options * @param downloadOptions cache download options
* @param enableCrossOsArchive an optional boolean enabled to restore on windows any cache created on any platform * @param enableCrossOsArchive an optional boolean enabled to restore on windows any cache created on any platform
* @param enableCrossArchArchive an optional boolean enabled to restore cache created on any arch
* @returns string returns the key for the cache hit, otherwise returns undefined * @returns string returns the key for the cache hit, otherwise returns undefined
*/ */
export async function restoreCache( export async function restoreCache(
@ -73,22 +74,23 @@ export async function restoreCache(
primaryKey: string, primaryKey: string,
restoreKeys?: string[], restoreKeys?: string[],
options?: DownloadOptions, options?: DownloadOptions,
enableCrossOsArchive = false enableCrossOsArchive = false,
enableCrossArchArchive = false
): Promise<string | undefined> { ): Promise<string | undefined> {
checkPaths(paths) checkPaths(paths)
checkKey(primaryKey)
restoreKeys = restoreKeys ?? [] restoreKeys = restoreKeys ?? []
const keys = [primaryKey, ...restoreKeys]
core.debug('Resolved Keys:') core.debug('Resolved Restore Keys:')
core.debug(JSON.stringify(keys)) core.debug(JSON.stringify(restoreKeys))
if (keys.length > 10) { if (restoreKeys.length > 9) {
throw new ValidationError( throw new ValidationError(
`Key Validation Error: Keys are limited to a maximum of 10.` `Key Validation Error: Keys are limited to a maximum of 10.`
) )
} }
for (const key of keys) { for (const key of restoreKeys) {
checkKey(key) checkKey(key)
} }
@ -96,10 +98,16 @@ export async function restoreCache(
let archivePath = '' let archivePath = ''
try { try {
// path are needed to compute version // path are needed to compute version
const cacheEntry = await cacheHttpClient.getCacheEntry(keys, paths, { const cacheEntry = await cacheHttpClient.getCacheEntry(
compressionMethod, primaryKey,
enableCrossOsArchive restoreKeys,
}) paths,
{
compressionMethod,
enableCrossOsArchive,
enableCrossArchArchive
}
)
if (!cacheEntry) { if (!cacheEntry) {
// Internal Error // Internal Error
@ -205,13 +213,14 @@ export async function restoreCache(
* @param paths a list of file paths to be cached * @param paths a list of file paths to be cached
* @param key an explicit key for restoring the cache * @param key an explicit key for restoring the cache
* @param enableCrossOsArchive an optional boolean enabled to save cache on windows which could be restored on any platform * @param enableCrossOsArchive an optional boolean enabled to save cache on windows which could be restored on any platform
* @param options cache upload options * @param enableCrossArchArchive an optional boolean enabled to save cache on any arch which could be restored on any arch
* @returns number returns cacheId if the cache was saved successfully and throws an error if save fails * @returns string returns cacheId if the cache was saved successfully and throws an error if save fails
*/ */
export async function saveCache( export async function saveCache(
paths: string[], paths: string[],
key: string, key: string,
enableCrossOsArchive = false enableCrossOsArchive = false,
enableCrossArchArchive = false
): Promise<string> { ): Promise<string> {
checkPaths(paths) checkPaths(paths)
checkKey(key) checkKey(key)
@ -254,6 +263,13 @@ export async function saveCache(
) )
} }
const cacheVersion = cacheHttpClient.getCacheVersion(
paths,
compressionMethod,
enableCrossOsArchive,
enableCrossArchArchive
)
core.debug('Reserving Cache') core.debug('Reserving Cache')
// Calculate number of chunks required. This is only required if backend is S3 as Google Cloud SDK will do it for us // Calculate number of chunks required. This is only required if backend is S3 as Google Cloud SDK will do it for us
const uploadOptions = getUploadOptions() const uploadOptions = getUploadOptions()
@ -262,11 +278,7 @@ export async function saveCache(
const reserveCacheResponse = await cacheHttpClient.reserveCache( const reserveCacheResponse = await cacheHttpClient.reserveCache(
key, key,
numberOfChunks, numberOfChunks,
{ cacheVersion
compressionMethod,
enableCrossOsArchive,
cacheSize: archiveFileSize
}
) )
if (reserveCacheResponse?.statusCode === 400) { if (reserveCacheResponse?.statusCode === 400) {
@ -278,12 +290,6 @@ export async function saveCache(
) )
} }
const cacheVersion = cacheHttpClient.getCacheVersion(
paths,
compressionMethod,
enableCrossOsArchive
)
switch (reserveCacheResponse.result?.provider) { switch (reserveCacheResponse.result?.provider) {
case 's3': case 's3':
core.debug(`Saving Cache to S3`) core.debug(`Saving Cache to S3`)
@ -341,18 +347,30 @@ export async function saveCache(
/** /**
* Deletes an entire cache by cache key. * Deletes an entire cache by cache key.
* @param keys The cache keys * @param key The cache keys
*/ */
export async function deleteCache(keys: string[]): Promise<void> { export async function deleteCache(
for (const key of keys) { paths: string[],
checkKey(key) key: string,
} enableCrossOsArchive = false,
enableCrossArchArchive = false
): Promise<void> {
checkKey(key)
core.debug('Deleting Cache') core.debug('Deleting Cache')
core.debug(`Cache Keys: ${keys}`) core.debug(`Cache Key: ${key}`)
const compressionMethod = await utils.getCompressionMethod()
const cacheVersion = cacheHttpClient.getCacheVersion(
paths,
compressionMethod,
enableCrossOsArchive,
enableCrossArchArchive
)
try { try {
await cacheHttpClient.deleteCache(keys) await cacheHttpClient.deleteCache(key, cacheVersion)
} catch (error) { } catch (error) {
core.warning(`Failed to delete cache: ${error}`) core.warning(`Failed to delete cache: ${error}`)
} }

View File

@ -23,11 +23,14 @@ import {Storage} from '@google-cloud/storage'
import { import {
CommonsCommitCacheRequest, CommonsCommitCacheRequest,
CommonsCommitCacheResponse, CommonsCommitCacheResponse,
CommonsDeleteCacheResponse,
CommonsGetCacheResponse, CommonsGetCacheResponse,
CommonsReserveCacheRequest, CommonsReserveCacheRequest,
CommonsReserveCacheResponse CommonsReserveCacheResponse
} from './warpcache-ts-sdk' } from './warpcache-ts-sdk'
import {multiPartUploadToGCS, uploadFileToS3} from './uploadUtils' import {multiPartUploadToGCS, uploadFileToS3} from './uploadUtils'
import {CommonsGetCacheRequest} from './warpcache-ts-sdk/models/commons-get-cache-request'
import {CommonsDeleteCacheRequest} from './warpcache-ts-sdk/models/commons-delete-cache-request'
const versionSalt = '1.0' const versionSalt = '1.0'
@ -47,6 +50,16 @@ function createAcceptHeader(type: string, apiVersion: string): string {
return `${type};api-version=${apiVersion}` return `${type};api-version=${apiVersion}`
} }
function getVCSRepository(): string {
const vcsRepository = process.env['GITHUB_REPOSITORY'] ?? ''
return vcsRepository
}
function getVCSRef(): string {
const vcsBranch = process.env['GITHUB_REF'] ?? ''
return vcsBranch
}
function getRequestOptions(): RequestOptions { function getRequestOptions(): RequestOptions {
const requestOptions: RequestOptions = { const requestOptions: RequestOptions = {
headers: { headers: {
@ -71,7 +84,8 @@ function createHttpClient(): HttpClient {
export function getCacheVersion( export function getCacheVersion(
paths: string[], paths: string[],
compressionMethod?: CompressionMethod, compressionMethod?: CompressionMethod,
enableCrossOsArchive = false enableCrossOsArchive = false,
enableCrossArchArchive = false
): string { ): string {
const components = paths const components = paths
@ -86,6 +100,11 @@ export function getCacheVersion(
components.push('windows-only') components.push('windows-only')
} }
// Add architecture to cache version
if (!enableCrossArchArchive) {
components.push(process.arch)
}
// Add salt to cache version to support breaking changes in cache entry // Add salt to cache version to support breaking changes in cache entry
components.push(versionSalt) components.push(versionSalt)
@ -93,7 +112,8 @@ export function getCacheVersion(
} }
export async function getCacheEntry( export async function getCacheEntry(
keys: string[], key: string,
restoreKeys: string[],
paths: string[], paths: string[],
options?: InternalCacheOptions options?: InternalCacheOptions
): Promise<CommonsGetCacheResponse | null> { ): Promise<CommonsGetCacheResponse | null> {
@ -101,14 +121,23 @@ export async function getCacheEntry(
const version = getCacheVersion( const version = getCacheVersion(
paths, paths,
options?.compressionMethod, options?.compressionMethod,
options?.enableCrossOsArchive options?.enableCrossOsArchive,
options?.enableCrossArchArchive
) )
const resource = `cache?keys=${encodeURIComponent(
keys.join(',') const getCacheRequest: CommonsGetCacheRequest = {
)}&version=${version}` cache_key: key,
restore_keys: restoreKeys,
cache_version: version,
vcs_repository: getVCSRepository(),
vcs_ref: getVCSRef()
}
const response = await retryTypedResponse('getCacheEntry', async () => const response = await retryTypedResponse('getCacheEntry', async () =>
httpClient.getJson<CommonsGetCacheResponse>(getCacheApiUrl(resource)) httpClient.postJson<CommonsGetCacheResponse>(
getCacheApiUrl('cache/get'),
getCacheRequest
)
) )
if (response.statusCode === 204) { if (response.statusCode === 204) {
@ -190,14 +219,17 @@ export function downloadCacheStreaming(
export async function reserveCache( export async function reserveCache(
cacheKey: string, cacheKey: string,
numberOfChunks: number, numberOfChunks: number,
options?: InternalCacheOptions cacheVersion: string
): Promise<ITypedResponseWithError<CommonsReserveCacheResponse>> { ): Promise<ITypedResponseWithError<CommonsReserveCacheResponse>> {
const httpClient = createHttpClient() const httpClient = createHttpClient()
const reserveCacheRequest: CommonsReserveCacheRequest = { const reserveCacheRequest: CommonsReserveCacheRequest = {
cache_key: cacheKey, cache_key: cacheKey,
cache_version: cacheVersion,
number_of_chunks: numberOfChunks, number_of_chunks: numberOfChunks,
content_type: 'application/zstd' content_type: 'application/zstd',
vcs_repository: getVCSRepository(),
vcs_ref: getVCSRef()
} }
const response = await retryTypedResponse('reserveCache', async () => const response = await retryTypedResponse('reserveCache', async () =>
httpClient.postJson<CommonsReserveCacheResponse>( httpClient.postJson<CommonsReserveCacheResponse>(
@ -227,8 +259,9 @@ async function commitCache(
upload_key: uploadKey, upload_key: uploadKey,
upload_id: uploadID, upload_id: uploadID,
parts: parts, parts: parts,
os: process.env['RUNNER_OS'] ?? 'Linux', vcs_type: 'github',
vcs_type: 'github' vcs_repository: getVCSRepository(),
vcs_ref: getVCSRef()
} }
return await retryTypedResponse('commitCache', async () => return await retryTypedResponse('commitCache', async () =>
httpClient.postJson<CommonsCommitCacheResponse>( httpClient.postJson<CommonsCommitCacheResponse>(
@ -340,13 +373,24 @@ export async function saveCache(
return cacheKeyResponse return cacheKeyResponse
} }
export async function deleteCache(keys: string[]) { export async function deleteCache(cacheKey: string, cacheVersion: string) {
const httpClient = createHttpClient() const httpClient = createHttpClient()
const resource = `cache?keys=${encodeURIComponent(keys.join(','))}`
const response = await httpClient.del(getCacheApiUrl(resource)) const deleteCacheRequest: CommonsDeleteCacheRequest = {
if (!isSuccessStatusCode(response.message.statusCode)) { cache_key: cacheKey,
throw new Error( cache_version: cacheVersion,
`Cache service responded with ${response.message.statusCode}` vcs_repository: getVCSRepository(),
vcs_ref: getVCSRef()
}
const response = await retryTypedResponse('deleteCacheEntry', async () =>
httpClient.postJson<CommonsDeleteCacheResponse>(
getCacheApiUrl('cache/delete'),
deleteCacheRequest
) )
)
if (!isSuccessStatusCode(response.statusCode)) {
throw new Error(`Cache service responded with ${response.statusCode}`)
} }
} }

View File

@ -9,6 +9,7 @@ export interface ITypedResponseWithError<T> extends TypedResponse<T> {
export interface InternalCacheOptions { export interface InternalCacheOptions {
compressionMethod?: CompressionMethod compressionMethod?: CompressionMethod
enableCrossOsArchive?: boolean enableCrossOsArchive?: boolean
enableCrossArchArchive?: boolean
cacheSize?: number cacheSize?: number
} }

View File

@ -111,7 +111,7 @@ export async function retryTypedResponse<T>(
if (error instanceof HttpClientError) { if (error instanceof HttpClientError) {
return { return {
statusCode: error.statusCode, statusCode: error.statusCode,
result: null, result: error.result ?? null,
headers: {}, headers: {},
error error
} }

View File

@ -9,12 +9,16 @@ common.ts
configuration.ts configuration.ts
git_push.sh git_push.sh
index.ts index.ts
models/commons-cache-entry.ts
models/commons-commit-cache-request.ts models/commons-commit-cache-request.ts
models/commons-commit-cache-response.ts models/commons-commit-cache-response.ts
models/commons-delete-cache-request.ts
models/commons-delete-cache-response.ts models/commons-delete-cache-response.ts
models/commons-gcscommit-cache-response.ts models/commons-gcscommit-cache-response.ts
models/commons-gcsdelete-cache-response.ts
models/commons-gcsget-cache-reponse.ts models/commons-gcsget-cache-reponse.ts
models/commons-gcsreserve-cache-response.ts models/commons-gcsreserve-cache-response.ts
models/commons-get-cache-request.ts
models/commons-get-cache-response.ts models/commons-get-cache-response.ts
models/commons-reserve-cache-request.ts models/commons-reserve-cache-request.ts
models/commons-reserve-cache-response.ts models/commons-reserve-cache-response.ts

View File

@ -26,8 +26,12 @@ import { CommonsCommitCacheRequest } from '../models';
// @ts-ignore // @ts-ignore
import { CommonsCommitCacheResponse } from '../models'; import { CommonsCommitCacheResponse } from '../models';
// @ts-ignore // @ts-ignore
import { CommonsDeleteCacheRequest } from '../models';
// @ts-ignore
import { CommonsDeleteCacheResponse } from '../models'; import { CommonsDeleteCacheResponse } from '../models';
// @ts-ignore // @ts-ignore
import { CommonsGetCacheRequest } from '../models';
// @ts-ignore
import { CommonsGetCacheResponse } from '../models'; import { CommonsGetCacheResponse } from '../models';
// @ts-ignore // @ts-ignore
import { CommonsReserveCacheRequest } from '../models'; import { CommonsReserveCacheRequest } from '../models';
@ -110,13 +114,13 @@ export const DefaultApiAxiosParamCreator = function (configuration?: Configurati
/** /**
* delete cache * delete cache
* @summary delete cache * @summary delete cache
* @param {string} keys cache keys * @param {CommonsDeleteCacheRequest} body Delete Cache Request Body
* @param {*} [options] Override http request option. * @param {*} [options] Override http request option.
* @throws {RequiredError} * @throws {RequiredError}
*/ */
v1CacheDeleteDelete: async (keys: string, options: RawAxiosRequestConfig = {}): Promise<RequestArgs> => { v1CacheDeletePost: async (body: CommonsDeleteCacheRequest, options: RawAxiosRequestConfig = {}): Promise<RequestArgs> => {
// verify required parameter 'keys' is not null or undefined // verify required parameter 'body' is not null or undefined
assertParamExists('v1CacheDeleteDelete', 'keys', keys) assertParamExists('v1CacheDeletePost', 'body', body)
const localVarPath = `/v1/cache/delete`; const localVarPath = `/v1/cache/delete`;
// use dummy base URL string because the URL constructor only accepts absolute URLs. // use dummy base URL string because the URL constructor only accepts absolute URLs.
const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
@ -125,19 +129,18 @@ export const DefaultApiAxiosParamCreator = function (configuration?: Configurati
baseOptions = configuration.baseOptions; baseOptions = configuration.baseOptions;
} }
const localVarRequestOptions = { method: 'DELETE', ...baseOptions, ...options}; const localVarRequestOptions = { method: 'POST', ...baseOptions, ...options};
const localVarHeaderParameter = {} as any; const localVarHeaderParameter = {} as any;
const localVarQueryParameter = {} as any; const localVarQueryParameter = {} as any;
if (keys !== undefined) {
localVarQueryParameter['keys'] = keys;
}
localVarHeaderParameter['Content-Type'] = 'application/json';
setSearchParams(localVarUrlObj, localVarQueryParameter); setSearchParams(localVarUrlObj, localVarQueryParameter);
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
localVarRequestOptions.data = serializeDataIfNeeded(body, localVarRequestOptions, configuration)
return { return {
url: toPathString(localVarUrlObj), url: toPathString(localVarUrlObj),
@ -147,17 +150,14 @@ export const DefaultApiAxiosParamCreator = function (configuration?: Configurati
/** /**
* get cache * get cache
* @summary get cache * @summary get cache
* @param {string} keys cache keys * @param {CommonsGetCacheRequest} body Get Cache Request Body
* @param {string} version cache version
* @param {*} [options] Override http request option. * @param {*} [options] Override http request option.
* @throws {RequiredError} * @throws {RequiredError}
*/ */
v1CacheGet: async (keys: string, version: string, options: RawAxiosRequestConfig = {}): Promise<RequestArgs> => { v1CacheGetPost: async (body: CommonsGetCacheRequest, options: RawAxiosRequestConfig = {}): Promise<RequestArgs> => {
// verify required parameter 'keys' is not null or undefined // verify required parameter 'body' is not null or undefined
assertParamExists('v1CacheGet', 'keys', keys) assertParamExists('v1CacheGetPost', 'body', body)
// verify required parameter 'version' is not null or undefined const localVarPath = `/v1/cache/get`;
assertParamExists('v1CacheGet', 'version', version)
const localVarPath = `/v1/cache`;
// use dummy base URL string because the URL constructor only accepts absolute URLs. // use dummy base URL string because the URL constructor only accepts absolute URLs.
const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
let baseOptions; let baseOptions;
@ -165,23 +165,18 @@ export const DefaultApiAxiosParamCreator = function (configuration?: Configurati
baseOptions = configuration.baseOptions; baseOptions = configuration.baseOptions;
} }
const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options}; const localVarRequestOptions = { method: 'POST', ...baseOptions, ...options};
const localVarHeaderParameter = {} as any; const localVarHeaderParameter = {} as any;
const localVarQueryParameter = {} as any; const localVarQueryParameter = {} as any;
if (keys !== undefined) {
localVarQueryParameter['keys'] = keys;
}
if (version !== undefined) {
localVarQueryParameter['version'] = version;
}
localVarHeaderParameter['Content-Type'] = 'application/json';
setSearchParams(localVarUrlObj, localVarQueryParameter); setSearchParams(localVarUrlObj, localVarQueryParameter);
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
localVarRequestOptions.data = serializeDataIfNeeded(body, localVarRequestOptions, configuration)
return { return {
url: toPathString(localVarUrlObj), url: toPathString(localVarUrlObj),
@ -262,28 +257,27 @@ export const DefaultApiFp = function(configuration?: Configuration) {
/** /**
* delete cache * delete cache
* @summary delete cache * @summary delete cache
* @param {string} keys cache keys * @param {CommonsDeleteCacheRequest} body Delete Cache Request Body
* @param {*} [options] Override http request option. * @param {*} [options] Override http request option.
* @throws {RequiredError} * @throws {RequiredError}
*/ */
async v1CacheDeleteDelete(keys: string, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<CommonsDeleteCacheResponse>> { async v1CacheDeletePost(body: CommonsDeleteCacheRequest, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<CommonsDeleteCacheResponse>> {
const localVarAxiosArgs = await localVarAxiosParamCreator.v1CacheDeleteDelete(keys, options); const localVarAxiosArgs = await localVarAxiosParamCreator.v1CacheDeletePost(body, options);
const localVarOperationServerIndex = configuration?.serverIndex ?? 0; const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
const localVarOperationServerBasePath = operationServerMap['DefaultApi.v1CacheDeleteDelete']?.[localVarOperationServerIndex]?.url; const localVarOperationServerBasePath = operationServerMap['DefaultApi.v1CacheDeletePost']?.[localVarOperationServerIndex]?.url;
return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath); return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
}, },
/** /**
* get cache * get cache
* @summary get cache * @summary get cache
* @param {string} keys cache keys * @param {CommonsGetCacheRequest} body Get Cache Request Body
* @param {string} version cache version
* @param {*} [options] Override http request option. * @param {*} [options] Override http request option.
* @throws {RequiredError} * @throws {RequiredError}
*/ */
async v1CacheGet(keys: string, version: string, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<CommonsGetCacheResponse>> { async v1CacheGetPost(body: CommonsGetCacheRequest, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<CommonsGetCacheResponse>> {
const localVarAxiosArgs = await localVarAxiosParamCreator.v1CacheGet(keys, version, options); const localVarAxiosArgs = await localVarAxiosParamCreator.v1CacheGetPost(body, options);
const localVarOperationServerIndex = configuration?.serverIndex ?? 0; const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
const localVarOperationServerBasePath = operationServerMap['DefaultApi.v1CacheGet']?.[localVarOperationServerIndex]?.url; const localVarOperationServerBasePath = operationServerMap['DefaultApi.v1CacheGetPost']?.[localVarOperationServerIndex]?.url;
return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath); return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
}, },
/** /**
@ -331,22 +325,22 @@ export const DefaultApiFactory = function (configuration?: Configuration, basePa
/** /**
* delete cache * delete cache
* @summary delete cache * @summary delete cache
* @param {DefaultApiV1CacheDeleteDeleteRequest} requestParameters Request parameters. * @param {DefaultApiV1CacheDeletePostRequest} requestParameters Request parameters.
* @param {*} [options] Override http request option. * @param {*} [options] Override http request option.
* @throws {RequiredError} * @throws {RequiredError}
*/ */
v1CacheDeleteDelete(requestParameters: DefaultApiV1CacheDeleteDeleteRequest, options?: RawAxiosRequestConfig): AxiosPromise<CommonsDeleteCacheResponse> { v1CacheDeletePost(requestParameters: DefaultApiV1CacheDeletePostRequest, options?: RawAxiosRequestConfig): AxiosPromise<CommonsDeleteCacheResponse> {
return localVarFp.v1CacheDeleteDelete(requestParameters.keys, options).then((request) => request(axios, basePath)); return localVarFp.v1CacheDeletePost(requestParameters.body, options).then((request) => request(axios, basePath));
}, },
/** /**
* get cache * get cache
* @summary get cache * @summary get cache
* @param {DefaultApiV1CacheGetRequest} requestParameters Request parameters. * @param {DefaultApiV1CacheGetPostRequest} requestParameters Request parameters.
* @param {*} [options] Override http request option. * @param {*} [options] Override http request option.
* @throws {RequiredError} * @throws {RequiredError}
*/ */
v1CacheGet(requestParameters: DefaultApiV1CacheGetRequest, options?: RawAxiosRequestConfig): AxiosPromise<CommonsGetCacheResponse> { v1CacheGetPost(requestParameters: DefaultApiV1CacheGetPostRequest, options?: RawAxiosRequestConfig): AxiosPromise<CommonsGetCacheResponse> {
return localVarFp.v1CacheGet(requestParameters.keys, requestParameters.version, options).then((request) => request(axios, basePath)); return localVarFp.v1CacheGetPost(requestParameters.body, options).then((request) => request(axios, basePath));
}, },
/** /**
* reserve cache * reserve cache
@ -376,38 +370,31 @@ export interface DefaultApiV1CacheCommitPostRequest {
} }
/** /**
* Request parameters for v1CacheDeleteDelete operation in DefaultApi. * Request parameters for v1CacheDeletePost operation in DefaultApi.
* @export * @export
* @interface DefaultApiV1CacheDeleteDeleteRequest * @interface DefaultApiV1CacheDeletePostRequest
*/ */
export interface DefaultApiV1CacheDeleteDeleteRequest { export interface DefaultApiV1CacheDeletePostRequest {
/** /**
* cache keys * Delete Cache Request Body
* @type {string} * @type {CommonsDeleteCacheRequest}
* @memberof DefaultApiV1CacheDeleteDelete * @memberof DefaultApiV1CacheDeletePost
*/ */
readonly keys: string readonly body: CommonsDeleteCacheRequest
} }
/** /**
* Request parameters for v1CacheGet operation in DefaultApi. * Request parameters for v1CacheGetPost operation in DefaultApi.
* @export * @export
* @interface DefaultApiV1CacheGetRequest * @interface DefaultApiV1CacheGetPostRequest
*/ */
export interface DefaultApiV1CacheGetRequest { export interface DefaultApiV1CacheGetPostRequest {
/** /**
* cache keys * Get Cache Request Body
* @type {string} * @type {CommonsGetCacheRequest}
* @memberof DefaultApiV1CacheGet * @memberof DefaultApiV1CacheGetPost
*/ */
readonly keys: string readonly body: CommonsGetCacheRequest
/**
* cache version
* @type {string}
* @memberof DefaultApiV1CacheGet
*/
readonly version: string
} }
/** /**
@ -457,25 +444,25 @@ export class DefaultApi extends BaseAPI {
/** /**
* delete cache * delete cache
* @summary delete cache * @summary delete cache
* @param {DefaultApiV1CacheDeleteDeleteRequest} requestParameters Request parameters. * @param {DefaultApiV1CacheDeletePostRequest} requestParameters Request parameters.
* @param {*} [options] Override http request option. * @param {*} [options] Override http request option.
* @throws {RequiredError} * @throws {RequiredError}
* @memberof DefaultApi * @memberof DefaultApi
*/ */
public v1CacheDeleteDelete(requestParameters: DefaultApiV1CacheDeleteDeleteRequest, options?: RawAxiosRequestConfig) { public v1CacheDeletePost(requestParameters: DefaultApiV1CacheDeletePostRequest, options?: RawAxiosRequestConfig) {
return DefaultApiFp(this.configuration).v1CacheDeleteDelete(requestParameters.keys, options).then((request) => request(this.axios, this.basePath)); return DefaultApiFp(this.configuration).v1CacheDeletePost(requestParameters.body, options).then((request) => request(this.axios, this.basePath));
} }
/** /**
* get cache * get cache
* @summary get cache * @summary get cache
* @param {DefaultApiV1CacheGetRequest} requestParameters Request parameters. * @param {DefaultApiV1CacheGetPostRequest} requestParameters Request parameters.
* @param {*} [options] Override http request option. * @param {*} [options] Override http request option.
* @throws {RequiredError} * @throws {RequiredError}
* @memberof DefaultApi * @memberof DefaultApi
*/ */
public v1CacheGet(requestParameters: DefaultApiV1CacheGetRequest, options?: RawAxiosRequestConfig) { public v1CacheGetPost(requestParameters: DefaultApiV1CacheGetPostRequest, options?: RawAxiosRequestConfig) {
return DefaultApiFp(this.configuration).v1CacheGet(requestParameters.keys, requestParameters.version, options).then((request) => request(this.axios, this.basePath)); return DefaultApiFp(this.configuration).v1CacheGetPost(requestParameters.body, options).then((request) => request(this.axios, this.basePath));
} }
/** /**

View File

@ -0,0 +1,72 @@
/* tslint:disable */
/* eslint-disable */
/**
*
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
*
* The version of the OpenAPI document: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
/**
*
* @export
* @interface CommonsCacheEntry
*/
export interface CommonsCacheEntry {
/**
*
* @type {string}
* @memberof CommonsCacheEntry
*/
'cache_key'?: string;
/**
*
* @type {string}
* @memberof CommonsCacheEntry
*/
'cache_version'?: string;
/**
*
* @type {string}
* @memberof CommonsCacheEntry
*/
'created_at'?: string;
/**
*
* @type {string}
* @memberof CommonsCacheEntry
*/
'id'?: string;
/**
*
* @type {string}
* @memberof CommonsCacheEntry
*/
'organization_id'?: string;
/**
*
* @type {string}
* @memberof CommonsCacheEntry
*/
'updated_at'?: string;
/**
*
* @type {string}
* @memberof CommonsCacheEntry
*/
'vcs_organization_name'?: string;
/**
*
* @type {string}
* @memberof CommonsCacheEntry
*/
'vcs_repository_name'?: string;
}

View File

@ -23,6 +23,12 @@ import { TypesCompletedPart } from './types-completed-part';
* @interface CommonsCommitCacheRequest * @interface CommonsCommitCacheRequest
*/ */
export interface CommonsCommitCacheRequest { export interface CommonsCommitCacheRequest {
/**
*
* @type {{ [key: string]: string; }}
* @memberof CommonsCommitCacheRequest
*/
'annotations'?: { [key: string]: string; };
/** /**
* *
* @type {string} * @type {string}
@ -35,12 +41,6 @@ export interface CommonsCommitCacheRequest {
* @memberof CommonsCommitCacheRequest * @memberof CommonsCommitCacheRequest
*/ */
'cache_version': string; 'cache_version': string;
/**
*
* @type {string}
* @memberof CommonsCommitCacheRequest
*/
'os': string;
/** /**
* *
* @type {Array<TypesCompletedPart>} * @type {Array<TypesCompletedPart>}
@ -59,6 +59,18 @@ export interface CommonsCommitCacheRequest {
* @memberof CommonsCommitCacheRequest * @memberof CommonsCommitCacheRequest
*/ */
'upload_key'?: string; 'upload_key'?: string;
/**
* VCSRef is the ref of the repository in vcs for which cache is being used. This can be a branch, git tag, or pull request ref.
* @type {string}
* @memberof CommonsCommitCacheRequest
*/
'vcs_ref'?: string;
/**
* VCSRepository is the repository name in vcs. It can be of the format <organization>/<repository> or <repository>. While saving the entry, <organization>/ will be trimmed if passed.
* @type {string}
* @memberof CommonsCommitCacheRequest
*/
'vcs_repository'?: string;
/** /**
* *
* @type {string} * @type {string}

View File

@ -13,6 +13,9 @@
*/ */
// May contain unused imports in some cases
// @ts-ignore
import { CommonsCacheEntry } from './commons-cache-entry';
// May contain unused imports in some cases // May contain unused imports in some cases
// @ts-ignore // @ts-ignore
import { CommonsGCSCommitCacheResponse } from './commons-gcscommit-cache-response'; import { CommonsGCSCommitCacheResponse } from './commons-gcscommit-cache-response';
@ -26,6 +29,18 @@ import { CommonsS3CommitCacheResponse } from './commons-s3-commit-cache-response
* @interface CommonsCommitCacheResponse * @interface CommonsCommitCacheResponse
*/ */
export interface CommonsCommitCacheResponse { export interface CommonsCommitCacheResponse {
/**
*
* @type {{ [key: string]: string; }}
* @memberof CommonsCommitCacheResponse
*/
'annotations'?: { [key: string]: string; };
/**
*
* @type {CommonsCacheEntry}
* @memberof CommonsCommitCacheResponse
*/
'cache_entry'?: CommonsCacheEntry;
/** /**
* *
* @type {CommonsGCSCommitCacheResponse} * @type {CommonsGCSCommitCacheResponse}
@ -44,5 +59,11 @@ export interface CommonsCommitCacheResponse {
* @memberof CommonsCommitCacheResponse * @memberof CommonsCommitCacheResponse
*/ */
's3'?: CommonsS3CommitCacheResponse; 's3'?: CommonsS3CommitCacheResponse;
/**
* VCSRepository is the repository name in vcs. It can be of the format <organization>/<repository> or <repository>. While saving the entry, <organization>/ will be trimmed if passed.
* @type {string}
* @memberof CommonsCommitCacheResponse
*/
'vcs_repository'?: string;
} }

View File

@ -0,0 +1,54 @@
/* tslint:disable */
/* eslint-disable */
/**
*
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
*
* The version of the OpenAPI document: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
/**
*
* @export
* @interface CommonsDeleteCacheRequest
*/
export interface CommonsDeleteCacheRequest {
/**
*
* @type {{ [key: string]: string; }}
* @memberof CommonsDeleteCacheRequest
*/
'annotations'?: { [key: string]: string; };
/**
*
* @type {string}
* @memberof CommonsDeleteCacheRequest
*/
'cache_key': string;
/**
*
* @type {string}
* @memberof CommonsDeleteCacheRequest
*/
'cache_version': string;
/**
* VCSRef is the ref of the repository in vcs for which cache is being used. This can be a branch, git tag, or pull request ref.
* @type {string}
* @memberof CommonsDeleteCacheRequest
*/
'vcs_ref'?: string;
/**
* VCSRepository is the repository name in vcs. It can be of the format <organization>/<repository> or <repository>. While saving the entry, <organization>/ will be trimmed if passed.
* @type {string}
* @memberof CommonsDeleteCacheRequest
*/
'vcs_repository'?: string;
}

View File

@ -13,6 +13,12 @@
*/ */
// May contain unused imports in some cases
// @ts-ignore
import { CommonsCacheEntry } from './commons-cache-entry';
// May contain unused imports in some cases
// @ts-ignore
import { CommonsGCSDeleteCacheResponse } from './commons-gcsdelete-cache-response';
// May contain unused imports in some cases // May contain unused imports in some cases
// @ts-ignore // @ts-ignore
import { CommonsS3DeleteCacheResponse } from './commons-s3-delete-cache-response'; import { CommonsS3DeleteCacheResponse } from './commons-s3-delete-cache-response';
@ -25,10 +31,22 @@ import { CommonsS3DeleteCacheResponse } from './commons-s3-delete-cache-response
export interface CommonsDeleteCacheResponse { export interface CommonsDeleteCacheResponse {
/** /**
* *
* @type {object} * @type {{ [key: string]: string; }}
* @memberof CommonsDeleteCacheResponse * @memberof CommonsDeleteCacheResponse
*/ */
'gcs'?: object; 'annotations'?: { [key: string]: string; };
/**
*
* @type {CommonsCacheEntry}
* @memberof CommonsDeleteCacheResponse
*/
'cache_entry'?: CommonsCacheEntry;
/**
*
* @type {CommonsGCSDeleteCacheResponse}
* @memberof CommonsDeleteCacheResponse
*/
'gcs'?: CommonsGCSDeleteCacheResponse;
/** /**
* *
* @type {string} * @type {string}

View File

@ -0,0 +1,36 @@
/* tslint:disable */
/* eslint-disable */
/**
*
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
*
* The version of the OpenAPI document: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
/**
*
* @export
* @interface CommonsGCSDeleteCacheResponse
*/
export interface CommonsGCSDeleteCacheResponse {
/**
*
* @type {string}
* @memberof CommonsGCSDeleteCacheResponse
*/
'cache_key': string;
/**
*
* @type {string}
* @memberof CommonsGCSDeleteCacheResponse
*/
'cache_version': string;
}

View File

@ -0,0 +1,60 @@
/* tslint:disable */
/* eslint-disable */
/**
*
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
*
* The version of the OpenAPI document: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
/**
*
* @export
* @interface CommonsGetCacheRequest
*/
export interface CommonsGetCacheRequest {
/**
*
* @type {{ [key: string]: string; }}
* @memberof CommonsGetCacheRequest
*/
'annotations'?: { [key: string]: string; };
/**
*
* @type {string}
* @memberof CommonsGetCacheRequest
*/
'cache_key': string;
/**
*
* @type {string}
* @memberof CommonsGetCacheRequest
*/
'cache_version': string;
/**
*
* @type {Array<string>}
* @memberof CommonsGetCacheRequest
*/
'restore_keys'?: Array<string>;
/**
* VCSRef is the ref of the repository in vcs for which cache is being used. This can be a branch, git tag, or pull request ref.
* @type {string}
* @memberof CommonsGetCacheRequest
*/
'vcs_ref'?: string;
/**
* VCSRepository is the repository name in vcs. It can be of the format <organization>/<repository> or <repository>. While saving the entry, <organization>/ will be trimmed if passed.
* @type {string}
* @memberof CommonsGetCacheRequest
*/
'vcs_repository'?: string;
}

View File

@ -13,6 +13,9 @@
*/ */
// May contain unused imports in some cases
// @ts-ignore
import { CommonsCacheEntry } from './commons-cache-entry';
// May contain unused imports in some cases // May contain unused imports in some cases
// @ts-ignore // @ts-ignore
import { CommonsGCSGetCacheReponse } from './commons-gcsget-cache-reponse'; import { CommonsGCSGetCacheReponse } from './commons-gcsget-cache-reponse';
@ -26,6 +29,18 @@ import { CommonsS3GetCacheResponse } from './commons-s3-get-cache-response';
* @interface CommonsGetCacheResponse * @interface CommonsGetCacheResponse
*/ */
export interface CommonsGetCacheResponse { export interface CommonsGetCacheResponse {
/**
*
* @type {{ [key: string]: string; }}
* @memberof CommonsGetCacheResponse
*/
'annotations'?: { [key: string]: string; };
/**
*
* @type {CommonsCacheEntry}
* @memberof CommonsGetCacheResponse
*/
'cache_entry'?: CommonsCacheEntry;
/** /**
* *
* @type {CommonsGCSGetCacheReponse} * @type {CommonsGCSGetCacheReponse}

View File

@ -20,12 +20,24 @@
* @interface CommonsReserveCacheRequest * @interface CommonsReserveCacheRequest
*/ */
export interface CommonsReserveCacheRequest { export interface CommonsReserveCacheRequest {
/**
*
* @type {{ [key: string]: string; }}
* @memberof CommonsReserveCacheRequest
*/
'annotations'?: { [key: string]: string; };
/** /**
* *
* @type {string} * @type {string}
* @memberof CommonsReserveCacheRequest * @memberof CommonsReserveCacheRequest
*/ */
'cache_key': string; 'cache_key': string;
/**
*
* @type {string}
* @memberof CommonsReserveCacheRequest
*/
'cache_version': string;
/** /**
* ContentType contains the content type of the cache. * This is not supported for GCS cache. When passed this will be ignored. * * ContentType contains the content type of the cache. * This is not supported for GCS cache. When passed this will be ignored. *
* @type {string} * @type {string}
@ -38,5 +50,17 @@ export interface CommonsReserveCacheRequest {
* @memberof CommonsReserveCacheRequest * @memberof CommonsReserveCacheRequest
*/ */
'number_of_chunks'?: number; 'number_of_chunks'?: number;
/**
* VCSRef is the ref of the repository in vcs for which cache is being used. This can be a branch, git tag, or pull request ref.
* @type {string}
* @memberof CommonsReserveCacheRequest
*/
'vcs_ref'?: string;
/**
* VCSRepository is the repository name in vcs. It can be of the format <organization>/<repository> or <repository>. While saving the entry, <organization>/ will be trimmed if passed.
* @type {string}
* @memberof CommonsReserveCacheRequest
*/
'vcs_repository'?: string;
} }

View File

@ -26,6 +26,12 @@ import { CommonsS3ReserveCacheResponse } from './commons-s3-reserve-cache-respon
* @interface CommonsReserveCacheResponse * @interface CommonsReserveCacheResponse
*/ */
export interface CommonsReserveCacheResponse { export interface CommonsReserveCacheResponse {
/**
*
* @type {{ [key: string]: string; }}
* @memberof CommonsReserveCacheResponse
*/
'annotations'?: { [key: string]: string; };
/** /**
* *
* @type {CommonsGCSReserveCacheResponse} * @type {CommonsGCSReserveCacheResponse}

View File

@ -20,6 +20,12 @@
* @interface CommonsS3GetCacheResponse * @interface CommonsS3GetCacheResponse
*/ */
export interface CommonsS3GetCacheResponse { export interface CommonsS3GetCacheResponse {
/**
*
* @type {{ [key: string]: string; }}
* @memberof CommonsS3GetCacheResponse
*/
'annotations'?: { [key: string]: string; };
/** /**
* *
* @type {string} * @type {string}

View File

@ -1,9 +1,13 @@
export * from './commons-cache-entry';
export * from './commons-commit-cache-request'; export * from './commons-commit-cache-request';
export * from './commons-commit-cache-response'; export * from './commons-commit-cache-response';
export * from './commons-delete-cache-request';
export * from './commons-delete-cache-response'; export * from './commons-delete-cache-response';
export * from './commons-gcscommit-cache-response'; export * from './commons-gcscommit-cache-response';
export * from './commons-gcsdelete-cache-response';
export * from './commons-gcsget-cache-reponse'; export * from './commons-gcsget-cache-reponse';
export * from './commons-gcsreserve-cache-response'; export * from './commons-gcsreserve-cache-response';
export * from './commons-get-cache-request';
export * from './commons-get-cache-response'; export * from './commons-get-cache-response';
export * from './commons-reserve-cache-request'; export * from './commons-reserve-cache-request';
export * from './commons-reserve-cache-response'; export * from './commons-reserve-cache-response';

View File

@ -1,13 +1,17 @@
/* istanbul ignore file */ /* istanbul ignore file */
/* tslint:disable */ /* tslint:disable */
/* eslint-disable */ /* eslint-disable */
export { $commons_CacheAnnotationsMap } from './schemas/$commons_CacheAnnotationsMap';
export { $commons_CacheEntry } from './schemas/$commons_CacheEntry';
export { $commons_CommitCacheRequest } from './schemas/$commons_CommitCacheRequest'; export { $commons_CommitCacheRequest } from './schemas/$commons_CommitCacheRequest';
export { $commons_CommitCacheResponse } from './schemas/$commons_CommitCacheResponse'; export { $commons_CommitCacheResponse } from './schemas/$commons_CommitCacheResponse';
export { $commons_DeleteCacheRequest } from './schemas/$commons_DeleteCacheRequest';
export { $commons_DeleteCacheResponse } from './schemas/$commons_DeleteCacheResponse'; export { $commons_DeleteCacheResponse } from './schemas/$commons_DeleteCacheResponse';
export { $commons_GCSCommitCacheResponse } from './schemas/$commons_GCSCommitCacheResponse'; export { $commons_GCSCommitCacheResponse } from './schemas/$commons_GCSCommitCacheResponse';
export { $commons_GCSDeleteCacheResponse } from './schemas/$commons_GCSDeleteCacheResponse'; export { $commons_GCSDeleteCacheResponse } from './schemas/$commons_GCSDeleteCacheResponse';
export { $commons_GCSGetCacheReponse } from './schemas/$commons_GCSGetCacheReponse'; export { $commons_GCSGetCacheReponse } from './schemas/$commons_GCSGetCacheReponse';
export { $commons_GCSReserveCacheResponse } from './schemas/$commons_GCSReserveCacheResponse'; export { $commons_GCSReserveCacheResponse } from './schemas/$commons_GCSReserveCacheResponse';
export { $commons_GetCacheRequest } from './schemas/$commons_GetCacheRequest';
export { $commons_GetCacheResponse } from './schemas/$commons_GetCacheResponse'; export { $commons_GetCacheResponse } from './schemas/$commons_GetCacheResponse';
export { $commons_ReserveCacheRequest } from './schemas/$commons_ReserveCacheRequest'; export { $commons_ReserveCacheRequest } from './schemas/$commons_ReserveCacheRequest';
export { $commons_ReserveCacheResponse } from './schemas/$commons_ReserveCacheResponse'; export { $commons_ReserveCacheResponse } from './schemas/$commons_ReserveCacheResponse';

View File

@ -0,0 +1,9 @@
/* istanbul ignore file */
/* tslint:disable */
/* eslint-disable */
export const $commons_CacheAnnotationsMap = {
type: 'dictionary',
contains: {
type: 'string',
},
} as const;

View File

@ -0,0 +1,31 @@
/* istanbul ignore file */
/* tslint:disable */
/* eslint-disable */
export const $commons_CacheEntry = {
properties: {
cache_key: {
type: 'string',
},
cache_version: {
type: 'string',
},
created_at: {
type: 'string',
},
id: {
type: 'string',
},
organization_id: {
type: 'string',
},
updated_at: {
type: 'string',
},
vcs_organization_name: {
type: 'string',
},
vcs_repository_name: {
type: 'string',
},
},
} as const;

View File

@ -3,6 +3,9 @@
/* eslint-disable */ /* eslint-disable */
export const $commons_CommitCacheRequest = { export const $commons_CommitCacheRequest = {
properties: { properties: {
annotations: {
type: 'commons_CacheAnnotationsMap',
},
cache_key: { cache_key: {
type: 'string', type: 'string',
isRequired: true, isRequired: true,
@ -11,10 +14,6 @@ export const $commons_CommitCacheRequest = {
type: 'string', type: 'string',
isRequired: true, isRequired: true,
}, },
os: {
type: 'string',
isRequired: true,
},
parts: { parts: {
type: 'array', type: 'array',
contains: { contains: {
@ -28,6 +27,12 @@ export const $commons_CommitCacheRequest = {
upload_key: { upload_key: {
type: 'string', type: 'string',
}, },
vcs_ref: {
type: 'string',
},
vcs_repository: {
type: 'string',
},
vcs_type: { vcs_type: {
type: 'string', type: 'string',
isRequired: true, isRequired: true,

View File

@ -3,6 +3,12 @@
/* eslint-disable */ /* eslint-disable */
export const $commons_CommitCacheResponse = { export const $commons_CommitCacheResponse = {
properties: { properties: {
annotations: {
type: 'commons_CacheAnnotationsMap',
},
cache_entry: {
type: 'commons_CacheEntry',
},
gcs: { gcs: {
type: 'commons_GCSCommitCacheResponse', type: 'commons_GCSCommitCacheResponse',
}, },
@ -12,5 +18,8 @@ export const $commons_CommitCacheResponse = {
s3: { s3: {
type: 'commons_S3CommitCacheResponse', type: 'commons_S3CommitCacheResponse',
}, },
vcs_repository: {
type: 'string',
},
}, },
} as const; } as const;

View File

@ -0,0 +1,24 @@
/* istanbul ignore file */
/* tslint:disable */
/* eslint-disable */
export const $commons_DeleteCacheRequest = {
properties: {
annotations: {
type: 'commons_CacheAnnotationsMap',
},
cache_key: {
type: 'string',
isRequired: true,
},
cache_version: {
type: 'string',
isRequired: true,
},
vcs_ref: {
type: 'string',
},
vcs_repository: {
type: 'string',
},
},
} as const;

View File

@ -3,6 +3,12 @@
/* eslint-disable */ /* eslint-disable */
export const $commons_DeleteCacheResponse = { export const $commons_DeleteCacheResponse = {
properties: { properties: {
annotations: {
type: 'commons_CacheAnnotationsMap',
},
cache_entry: {
type: 'commons_CacheEntry',
},
gcs: { gcs: {
type: 'commons_GCSDeleteCacheResponse', type: 'commons_GCSDeleteCacheResponse',
}, },

View File

@ -3,5 +3,13 @@
/* eslint-disable */ /* eslint-disable */
export const $commons_GCSDeleteCacheResponse = { export const $commons_GCSDeleteCacheResponse = {
properties: { properties: {
cache_key: {
type: 'string',
isRequired: true,
},
cache_version: {
type: 'string',
isRequired: true,
},
}, },
} as const; } as const;

View File

@ -0,0 +1,30 @@
/* istanbul ignore file */
/* tslint:disable */
/* eslint-disable */
export const $commons_GetCacheRequest = {
properties: {
annotations: {
type: 'commons_CacheAnnotationsMap',
},
cache_key: {
type: 'string',
isRequired: true,
},
cache_version: {
type: 'string',
isRequired: true,
},
restore_keys: {
type: 'array',
contains: {
type: 'string',
},
},
vcs_ref: {
type: 'string',
},
vcs_repository: {
type: 'string',
},
},
} as const;

View File

@ -3,6 +3,12 @@
/* eslint-disable */ /* eslint-disable */
export const $commons_GetCacheResponse = { export const $commons_GetCacheResponse = {
properties: { properties: {
annotations: {
type: 'commons_CacheAnnotationsMap',
},
cache_entry: {
type: 'commons_CacheEntry',
},
gcs: { gcs: {
type: 'commons_GCSGetCacheReponse', type: 'commons_GCSGetCacheReponse',
}, },

View File

@ -3,15 +3,28 @@
/* eslint-disable */ /* eslint-disable */
export const $commons_ReserveCacheRequest = { export const $commons_ReserveCacheRequest = {
properties: { properties: {
annotations: {
type: 'commons_CacheAnnotationsMap',
},
cache_key: { cache_key: {
type: 'string', type: 'string',
isRequired: true, isRequired: true,
}, },
cache_version: {
type: 'string',
isRequired: true,
},
content_type: { content_type: {
type: 'string', type: 'string',
}, },
number_of_chunks: { number_of_chunks: {
type: 'number', type: 'number',
}, },
vcs_ref: {
type: 'string',
},
vcs_repository: {
type: 'string',
},
}, },
} as const; } as const;

View File

@ -3,6 +3,9 @@
/* eslint-disable */ /* eslint-disable */
export const $commons_ReserveCacheResponse = { export const $commons_ReserveCacheResponse = {
properties: { properties: {
annotations: {
type: 'commons_CacheAnnotationsMap',
},
gcs: { gcs: {
type: 'commons_GCSReserveCacheResponse', type: 'commons_GCSReserveCacheResponse',
}, },

View File

@ -3,6 +3,9 @@
/* eslint-disable */ /* eslint-disable */
export const $commons_S3GetCacheResponse = { export const $commons_S3GetCacheResponse = {
properties: { properties: {
annotations: {
type: 'commons_CacheAnnotationsMap',
},
cache_key: { cache_key: {
type: 'string', type: 'string',
}, },

View File

@ -1,23 +1,45 @@
import {deleteCache, restoreCache, saveCache} from './cache' import {deleteCache, restoreCache, saveCache} from './cache'
import {getCacheVersion} from './internal/cacheHttpClient'
import {getCompressionMethod} from './internal/cacheUtils'
process.env['WARPBUILD_CACHE_URL'] = 'http://localhost:8002' process.env['WARPBUILD_CACHE_URL'] = 'https://cache.dev.warpbuild.dev'
// process.env['WARPBUILD_CACHE_URL'] = 'http://localhost:8000'
process.env['RUNNER_TEMP'] = '/Users/prajjwal/Repos/warpbuild/playground/tmp_fs' process.env['RUNNER_TEMP'] = '/Users/prajjwal/Repos/warpbuild/playground/tmp_fs'
process.env['NODE_DEBUG'] = 'http' process.env['NODE_DEBUG'] = 'http'
process.env['WARPBUILD_RUNNER_VERIFICATION_TOKEN'] = process.env['RUNNER_DEBUG'] = '1'
'eyJhbGciOiJFUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE3MTMwNzE5ODgsInJlcG8iOiJiZW5jaG1hcmtzIiwicmVwb093bmVyIjoiV2FycEJ1aWxkcyIsIngtd2FycGJ1aWxkLW9yZ2FuaXphdGlvbi1pZCI6IndmbW4wODBlaWY4cm5pd3EifQ.Wat-RATKl_KB39SF6egch3nF3_dD8hDE3lbl9wm7AyBUs9pUNEDejJtgHO0xQfGvSN-qRTPbJ_glHKPUIRHE3w' process.env['WARPBUILD_RUNNER_VERIFICATION_TOKEN'] = '<Set_token_here>'
process.env['GITHUB_REPOSITORY'] = 'Warpbuilds/backend-cache'
process.env['GITHUB_REF'] = 'refs/heads/main'
saveCache( // saveCache(
['/Users/prajjwal/Repos/warpbuild/playground/test_fs'], // ['/Users/prajjwal/Repos/warpbuild/playground/test_fs'],
'test-fs-local-key', // 'test-fs-local-key',
true // true
) // )
restoreCache( // saveCache(
['/Users/prajjwal/Repos/warpbuild/playground/test_fs'], // ['/Users/prajjwal/Repos/warpbuild/playground/test_fs'],
'test-fs-local-key', // 'test-fs-local-key-2',
[], // true
{}, // )
true
)
deleteCache(['test-fs-local-key']) // saveCache(
// ['/Users/prajjwal/Repos/warpbuild/playground/test_fs'],
// 'test-fs-local-key',
// true,
// true
// )
// restoreCache(
// ['/Users/prajjwal/Repos/warpbuild/playground/test_fs'],
// 'test-fs-local-key-3',
// ['test-fs'],
// {},
// true,
// false
// )
// deleteCache(
// ['/Users/prajjwal/Repos/warpbuild/playground/test_fs'],
// 'test-fs-local-key'
// )