Skip to content

Commit e554093

Browse files
committed
Rename the prefix to be more specific
1 parent d4385a6 commit e554093

File tree

2 files changed

+17
-17
lines changed

2 files changed

+17
-17
lines changed

packages/artifact/__tests__/config.test.ts

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -42,13 +42,13 @@ describe('uploadChunkTimeoutEnv', () => {
4242
expect(config.getUploadChunkTimeout()).toBe(300000)
4343
})
4444

45-
it('should return value set in ACTIONS_UPLOAD_TIMEOUT_MS', () => {
46-
process.env.ACTIONS_UPLOAD_TIMEOUT_MS = '150000'
45+
it('should return value set in ACTIONS_ARTIFACT_UPLOAD_TIMEOUT_MS', () => {
46+
process.env.ACTIONS_ARTIFACT_UPLOAD_TIMEOUT_MS = '150000'
4747
expect(config.getUploadChunkTimeout()).toBe(150000)
4848
})
4949

50-
it('should throw if value set in ACTIONS_UPLOAD_TIMEOUT_MS is invalid', () => {
51-
process.env.ACTIONS_UPLOAD_TIMEOUT_MS = 'abc'
50+
it('should throw if value set in ACTIONS_ARTIFACT_UPLOAD_TIMEOUT_MS is invalid', () => {
51+
process.env.ACTIONS_ARTIFACT_UPLOAD_TIMEOUT_MS = 'abc'
5252
expect(() => {
5353
config.getUploadChunkTimeout()
5454
}).toThrow()
@@ -71,31 +71,31 @@ describe('uploadConcurrencyEnv', () => {
7171
expect(config.getConcurrency()).toBe(300)
7272
})
7373

74-
it('should return override value when ACTIONS_UPLOAD_CONCURRENCY is set', () => {
74+
it('should return override value when ACTIONS_ARTIFACT_UPLOAD_CONCURRENCY is set', () => {
7575
;(os.cpus as jest.Mock).mockReturnValue(new Array(4))
76-
process.env.ACTIONS_UPLOAD_CONCURRENCY = '10'
76+
process.env.ACTIONS_ARTIFACT_UPLOAD_CONCURRENCY = '10'
7777
expect(config.getConcurrency()).toBe(10)
7878
})
7979

80-
it('should throw with invalid value of ACTIONS_UPLOAD_CONCURRENCY', () => {
80+
it('should throw with invalid value of ACTIONS_ARTIFACT_UPLOAD_CONCURRENCY', () => {
8181
;(os.cpus as jest.Mock).mockReturnValue(new Array(4))
82-
process.env.ACTIONS_UPLOAD_CONCURRENCY = 'abc'
82+
process.env.ACTIONS_ARTIFACT_UPLOAD_CONCURRENCY = 'abc'
8383
expect(() => {
8484
config.getConcurrency()
8585
}).toThrow()
8686
})
8787

88-
it('should throw if ACTIONS_UPLOAD_CONCURRENCY is < 1', () => {
88+
it('should throw if ACTIONS_ARTIFACT_UPLOAD_CONCURRENCY is < 1', () => {
8989
;(os.cpus as jest.Mock).mockReturnValue(new Array(4))
90-
process.env.ACTIONS_UPLOAD_CONCURRENCY = '0'
90+
process.env.ACTIONS_ARTIFACT_UPLOAD_CONCURRENCY = '0'
9191
expect(() => {
9292
config.getConcurrency()
9393
}).toThrow()
9494
})
9595

9696
it('cannot go over currency cap when override value is greater', () => {
9797
;(os.cpus as jest.Mock).mockReturnValue(new Array(4))
98-
process.env.ACTIONS_UPLOAD_CONCURRENCY = '40'
98+
process.env.ACTIONS_ARTIFACT_UPLOAD_CONCURRENCY = '40'
9999
expect(config.getConcurrency()).toBe(32)
100100
})
101101
})

packages/artifact/src/internal/shared/config.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ export function getGitHubWorkspaceDir(): string {
4848
// Mimics behavior of azcopy: https://learn.microsoft.com/en-us/azure/storage/common/storage-use-azcopy-optimize
4949
// If your machine has fewer than 5 CPUs, then the value of this variable is set to 32.
5050
// Otherwise, the default value is equal to 16 multiplied by the number of CPUs. The maximum value of this variable is 300.
51-
// This value can be lowered with ACTIONS_UPLOAD_CONCURRENCY variable.
51+
// This value can be lowered with ACTIONS_ARTIFACT_UPLOAD_CONCURRENCY variable.
5252
export function getConcurrency(): number {
5353
const numCPUs = os.cpus().length
5454
let concurrencyCap = 32
@@ -58,12 +58,12 @@ export function getConcurrency(): number {
5858
concurrencyCap = concurrency > 300 ? 300 : concurrency
5959
}
6060

61-
const concurrencyOverride = process.env['ACTIONS_UPLOAD_CONCURRENCY']
61+
const concurrencyOverride = process.env['ACTIONS_ARTIFACT_UPLOAD_CONCURRENCY']
6262
if (concurrencyOverride) {
6363
const concurrency = parseInt(concurrencyOverride)
6464
if (isNaN(concurrency) || concurrency < 1) {
6565
throw new Error(
66-
'Invalid value set for ACTIONS_UPLOAD_CONCURRENCY env variable'
66+
'Invalid value set for ACTIONS_ARTIFACT_UPLOAD_CONCURRENCY env variable'
6767
)
6868
}
6969

@@ -72,23 +72,23 @@ export function getConcurrency(): number {
7272
}
7373

7474
info(
75-
`ACTIONS_UPLOAD_CONCURRENCY is higher than the cap of ${concurrencyCap} based on the number of cpus. Lowering it to the cap.`
75+
`ACTIONS_ARTIFACT_UPLOAD_CONCURRENCY is higher than the cap of ${concurrencyCap} based on the number of cpus. Lowering it to the cap.`
7676
)
7777
}
7878

7979
return concurrencyCap
8080
}
8181

8282
export function getUploadChunkTimeout(): number {
83-
const timeoutVar = process.env['ACTIONS_UPLOAD_TIMEOUT_MS']
83+
const timeoutVar = process.env['ACTIONS_ARTIFACT_UPLOAD_TIMEOUT_MS']
8484
if (!timeoutVar) {
8585
return 300000 // 5 minutes
8686
}
8787

8888
const timeout = parseInt(timeoutVar)
8989
if (isNaN(timeout)) {
9090
throw new Error(
91-
'Invalid value set for ACTIONS_UPLOAD_TIMEOUT_MS env variable'
91+
'Invalid value set for ACTIONS_ARTIFACT_UPLOAD_TIMEOUT_MS env variable'
9292
)
9393
}
9494

0 commit comments

Comments
 (0)