Skip to content

Commit c720a60

Browse files
authored
Merge branch 'actions:main' into patch-1
2 parents aa6719e + ec9716b commit c720a60

File tree

20 files changed

+126
-118
lines changed

20 files changed

+126
-118
lines changed

packages/artifact/RELEASES.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# @actions/artifact Releases
22

3+
### 2.2.2
4+
5+
- Default concurrency to 5 for uploading artifacts [#1962](https://github.com/actions/toolkit/pull/1962
6+
37
### 2.2.1
48

59
- Add `ACTIONS_ARTIFACT_UPLOAD_CONCURRENCY` and `ACTIONS_ARTIFACT_UPLOAD_TIMEOUT_MS` environment variables [#1928](https://github.com/actions/toolkit/pull/1928)

packages/artifact/__tests__/config.test.ts

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -56,22 +56,30 @@ describe('uploadChunkTimeoutEnv', () => {
5656
})
5757

5858
describe('uploadConcurrencyEnv', () => {
59-
it('should return default 32 when cpu num is <= 4', () => {
59+
it('Concurrency default to 5', () => {
6060
;(os.cpus as jest.Mock).mockReturnValue(new Array(4))
61+
expect(config.getConcurrency()).toBe(5)
62+
})
63+
64+
it('Concurrency max out at 300 on systems with many CPUs', () => {
65+
;(os.cpus as jest.Mock).mockReturnValue(new Array(32))
66+
process.env.ACTIONS_ARTIFACT_UPLOAD_CONCURRENCY = '301'
67+
expect(config.getConcurrency()).toBe(300)
68+
})
69+
70+
it('Concurrency can be set to 32 when cpu num is <= 4', () => {
71+
;(os.cpus as jest.Mock).mockReturnValue(new Array(4))
72+
process.env.ACTIONS_ARTIFACT_UPLOAD_CONCURRENCY = '32'
6173
expect(config.getConcurrency()).toBe(32)
6274
})
6375

64-
it('should return 16 * num of cpu when cpu num is > 4', () => {
76+
it('Concurrency can be set 16 * num of cpu when cpu num is > 4', () => {
6577
;(os.cpus as jest.Mock).mockReturnValue(new Array(6))
78+
process.env.ACTIONS_ARTIFACT_UPLOAD_CONCURRENCY = '96'
6679
expect(config.getConcurrency()).toBe(96)
6780
})
6881

69-
it('should return up to 300 max value', () => {
70-
;(os.cpus as jest.Mock).mockReturnValue(new Array(32))
71-
expect(config.getConcurrency()).toBe(300)
72-
})
73-
74-
it('should return override value when ACTIONS_ARTIFACT_UPLOAD_CONCURRENCY is set', () => {
82+
it('Concurrency can be overridden by env var ACTIONS_ARTIFACT_UPLOAD_CONCURRENCY', () => {
7583
;(os.cpus as jest.Mock).mockReturnValue(new Array(4))
7684
process.env.ACTIONS_ARTIFACT_UPLOAD_CONCURRENCY = '10'
7785
expect(config.getConcurrency()).toBe(10)
@@ -92,10 +100,4 @@ describe('uploadConcurrencyEnv', () => {
92100
config.getConcurrency()
93101
}).toThrow()
94102
})
95-
96-
it('cannot go over currency cap when override value is greater', () => {
97-
;(os.cpus as jest.Mock).mockReturnValue(new Array(4))
98-
process.env.ACTIONS_ARTIFACT_UPLOAD_CONCURRENCY = '40'
99-
expect(config.getConcurrency()).toBe(32)
100-
})
101103
})

packages/artifact/package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/artifact/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@actions/artifact",
3-
"version": "2.2.1",
3+
"version": "2.2.2",
44
"preview": true,
55
"description": "Actions artifact lib",
66
"keywords": [

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

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,8 @@ export function getGitHubWorkspaceDir(): string {
4545
return ghWorkspaceDir
4646
}
4747

48-
// Mimics behavior of azcopy: https://learn.microsoft.com/en-us/azure/storage/common/storage-use-azcopy-optimize
49-
// If your machine has fewer than 5 CPUs, then the value of this variable is set to 32.
50-
// 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_ARTIFACT_UPLOAD_CONCURRENCY variable.
48+
// The maximum value of concurrency is 300.
49+
// This value can be changed with ACTIONS_ARTIFACT_UPLOAD_CONCURRENCY variable.
5250
export function getConcurrency(): number {
5351
const numCPUs = os.cpus().length
5452
let concurrencyCap = 32
@@ -68,15 +66,20 @@ export function getConcurrency(): number {
6866
}
6967

7068
if (concurrency < concurrencyCap) {
69+
info(
70+
`Set concurrency based on the value set in ACTIONS_ARTIFACT_UPLOAD_CONCURRENCY.`
71+
)
7172
return concurrency
7273
}
7374

7475
info(
75-
`ACTIONS_ARTIFACT_UPLOAD_CONCURRENCY is higher than the cap of ${concurrencyCap} based on the number of cpus. Lowering it to the cap.`
76+
`ACTIONS_ARTIFACT_UPLOAD_CONCURRENCY is higher than the cap of ${concurrencyCap} based on the number of cpus. Set it to the maximum value allowed.`
7677
)
78+
return concurrencyCap
7779
}
7880

79-
return concurrencyCap
81+
// default concurrency to 5
82+
return 5
8083
}
8184

8285
export function getUploadChunkTimeout(): number {

packages/attest/RELEASES.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# @actions/attest Releases
22

3+
### 1.6.0
4+
5+
- Update `buildSLSAProvenancePredicate` to populate `workflow.ref` field from the `ref` claim in the OIDC token [#1969](https://github.com/actions/toolkit/pull/1969)
6+
37
### 1.5.0
48

59
- Bump @actions/core from 1.10.1 to 1.11.1 [#1847](https://github.com/actions/toolkit/pull/1847)

packages/attest/__tests__/__snapshots__/provenance.test.ts.snap

Lines changed: 1 addition & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -1,47 +1,5 @@
11
// Jest Snapshot v1, https://goo.gl/fbAQLP
22

3-
exports[`provenance functions buildSLSAProvenancePredicate handle tags including "@" character 1`] = `
4-
{
5-
"params": {
6-
"buildDefinition": {
7-
"buildType": "https://actions.github.io/buildtypes/workflow/v1",
8-
"externalParameters": {
9-
"workflow": {
10-
"path": ".github/workflows/main.yml",
11-
12-
"repository": "https://foo.ghe.com/owner/repo",
13-
},
14-
},
15-
"internalParameters": {
16-
"github": {
17-
"event_name": "push",
18-
"repository_id": "repo-id",
19-
"repository_owner_id": "owner-id",
20-
"runner_environment": "github-hosted",
21-
},
22-
},
23-
"resolvedDependencies": [
24-
{
25-
"digest": {
26-
"gitCommit": "babca52ab0c93ae16539e5923cb0d7403b9a093b",
27-
},
28-
"uri": "git+https://foo.ghe.com/owner/repo@refs/heads/main",
29-
},
30-
],
31-
},
32-
"runDetails": {
33-
"builder": {
34-
"id": "https://foo.ghe.com/owner/workflows/.github/workflows/publish.yml@main",
35-
},
36-
"metadata": {
37-
"invocationId": "https://foo.ghe.com/owner/repo/actions/runs/run-id/attempts/run-attempt",
38-
},
39-
},
40-
},
41-
"type": "https://slsa.dev/provenance/v1",
42-
}
43-
`;
44-
453
exports[`provenance functions buildSLSAProvenancePredicate returns a provenance hydrated from an OIDC token 1`] = `
464
{
475
"params": {
@@ -50,7 +8,7 @@ exports[`provenance functions buildSLSAProvenancePredicate returns a provenance
508
"externalParameters": {
519
"workflow": {
5210
"path": ".github/workflows/main.yml",
53-
"ref": "main",
11+
"ref": "refs/heads/main",
5412
"repository": "https://foo.ghe.com/owner/repo",
5513
},
5614
},

packages/attest/__tests__/provenance.test.ts

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -75,16 +75,6 @@ describe('provenance functions', () => {
7575
const predicate = await buildSLSAProvenancePredicate()
7676
expect(predicate).toMatchSnapshot()
7777
})
78-
79-
it('handle tags including "@" character', async () => {
80-
nock.cleanAll()
81-
await mockIssuer({
82-
...claims,
83-
workflow_ref: 'owner/repo/.github/workflows/main.yml@[email protected]'
84-
})
85-
const predicate = await buildSLSAProvenancePredicate()
86-
expect(predicate).toMatchSnapshot()
87-
})
8878
})
8979

9080
describe('attestProvenance', () => {

packages/attest/package-lock.json

Lines changed: 16 additions & 15 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/attest/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@actions/attest",
3-
"version": "1.5.0",
3+
"version": "1.6.0",
44
"description": "Actions attestation lib",
55
"keywords": [
66
"github",
@@ -39,7 +39,7 @@
3939
"@sigstore/rekor-types": "^3.0.0",
4040
"@types/jsonwebtoken": "^9.0.6",
4141
"nock": "^13.5.1",
42-
"undici": "^5.28.4"
42+
"undici": "^5.28.5"
4343
},
4444
"dependencies": {
4545
"@actions/core": "^1.11.1",

0 commit comments

Comments
 (0)