Skip to content

Commit

Permalink
chore(release): 1.87.0 (#4226)
Browse files Browse the repository at this point in the history
  • Loading branch information
mergify[bot] committed Aug 11, 2023
2 parents 77f0f84 + 68d232f commit 9892444
Show file tree
Hide file tree
Showing 19 changed files with 837 additions and 701 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/close-stale-issues.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
runs-on: ubuntu-latest
name: Stale issue job
steps:
- uses: aws-actions/stale-issue-cleanup@v5
- uses: aws-actions/stale-issue-cleanup@v6
with:
# Setting messages to an empty string will cause the automation to skip
# that category
Expand Down
9 changes: 6 additions & 3 deletions .github/workflows/docker-images.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,12 @@ jobs:
matrix:
debian:
- 'buster' # 10
- 'bullseye' # 11
- 'bookworm' # 12
node: ['14', '16', '18', '20']
node: ['16', '18', '20']
include:
- debian: 'bullseye' # 11
node: '20'
- debian: 'bookworm' #12
node: '20'
env:
# Node version whose images will be aliased without the -nodeXX segment
DEFAULT_NODE_MAJOR_VERSION: 16
Expand Down
13 changes: 12 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,23 @@

All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.

## [1.87.0](https://github.com/aws/jsii/compare/v1.86.1...v1.87.0) (2023-08-11)


### Bug Fixes

* **kernel:** fast module loading fails on Windows (EPERM) ([#4212](https://github.com/aws/jsii/issues/4212)) ([fac6cbb](https://github.com/aws/jsii/commit/fac6cbbeb5d9bcbbac8f9dff58001afb701a4065)), closes [#4208](https://github.com/aws/jsii/issues/4208)
* **kernel:** package cache fails under parallelism ([#4215](https://github.com/aws/jsii/issues/4215)) ([b739ef6](https://github.com/aws/jsii/commit/b739ef68d4d92d7af78b2a91b8581e9f3077df96)), closes [#4181](https://github.com/aws/jsii/issues/4181) [#4207](https://github.com/aws/jsii/issues/4207)
* pip, black, setuptools, twine, wheel, and aws-sam-cli incorrectly installed in superchain ([#4201](https://github.com/aws/jsii/issues/4201)) ([851415c](https://github.com/aws/jsii/commit/851415c44864c0fb0b4b2d5ee4535f0b33f89a48))
* **python:** type object 'InterfaceDynamicProxy' has no attribute '__jsii_type__' ([#4209](https://github.com/aws/jsii/issues/4209)) ([057b267](https://github.com/aws/jsii/commit/057b267809a05135d6d22227318ae55100aad272))
* **superchain:** add openssh-client back ([#4224](https://github.com/aws/jsii/issues/4224)) ([8390ca1](https://github.com/aws/jsii/commit/8390ca1615769846f92c42ef35ac590b4673efbb))

## [1.86.1](https://github.com/aws/jsii/compare/v1.86.0...v1.86.1) (2023-08-02)


### Bug Fixes

* **kernel:** incorrectly scoped FQN resolutions ([#4204](https://github.com/aws/jsii/pull/4204)) ([ed667c7](https://github.com/aws/jsii/commit/ed667c76be73c43f969a1b7acc0b4b93a7a00889))
* **kernel:** incorrectly scoped FQN resolutions ([#4204](https://github.com/aws/jsii/issues/4204)) ([ed667c7](https://github.com/aws/jsii/commit/ed667c76be73c43f969a1b7acc0b4b93a7a00889)), closes [aws/aws-cdk#26604](https://github.com/aws/aws-cdk/issues/26604) [#4202](https://github.com/aws/jsii/issues/4202) [#4203](https://github.com/aws/jsii/issues/4203)

## [1.86.0](https://github.com/aws/jsii/compare/v1.85.0...v1.86.0) (2023-08-01)

Expand Down
2 changes: 1 addition & 1 deletion lerna.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@
"rejectCycles": true
}
},
"version": "1.86.1",
"version": "1.87.0",
"$schema": "node_modules/lerna/schemas/lerna-schema.json"
}
14 changes: 7 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,21 +18,21 @@
"@jest/types": "^28.1.3",
"@types/jest": "^29.5.3",
"@types/node": "^14.18.54",
"@typescript-eslint/eslint-plugin": "^6.2.0",
"@typescript-eslint/parser": "^6.2.0",
"@typescript-eslint/eslint-plugin": "^6.3.0",
"@typescript-eslint/parser": "^6.3.0",
"all-contributors-cli": "^6.26.1",
"eslint": "^8.45.0",
"eslint-config-prettier": "^8.8.0",
"eslint-import-resolver-node": "^0.3.7",
"eslint": "^8.46.0",
"eslint-config-prettier": "^9.0.0",
"eslint-import-resolver-node": "^0.3.9",
"eslint-import-resolver-typescript": "^3.5.5",
"eslint-plugin-import": "2.26.0",
"eslint-plugin-prettier": "^5.0.0",
"jest": "^29.6.1",
"jest": "^29.6.2",
"jest-circus": "^28.1.3",
"jest-config": "^28.1.3",
"jest-expect-message": "^1.1.3",
"lerna": "^7.1.4",
"prettier": "^3.0.0",
"prettier": "^3.0.1",
"standard-version": "^9.5.0",
"ts-node": "^10.9.1",
"typescript": "~4.7.4"
Expand Down
4 changes: 2 additions & 2 deletions packages/@jsii/go-runtime-test/project/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ require (
github.com/aws/jsii/jsii-calc/go/scopejsiicalclib v0.0.0-devpreview
github.com/stretchr/testify v1.8.4
golang.org/x/lint v0.0.0-20210508222113-6edffad5e616
golang.org/x/tools v0.11.0
golang.org/x/tools v0.12.0
)

require (
Expand All @@ -22,7 +22,7 @@ require (
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/yuin/goldmark v1.4.13 // indirect
golang.org/x/mod v0.12.0 // indirect
golang.org/x/sys v0.10.0 // indirect
golang.org/x/sys v0.11.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)

Expand Down
4 changes: 4 additions & 0 deletions packages/@jsii/go-runtime-test/project/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ golang.org/x/sys v0.9.0 h1:KS/R3tvhPqvJvwcKfnBHJwwthS11LRhmM5D59eEXa0s=
golang.org/x/sys v0.9.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.10.0 h1:SqMFp9UcQJZa+pmYuAKjd9xq1f0j5rLcDIk0mj4qAsA=
golang.org/x/sys v0.10.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.11.0 h1:eG7RXZHdqOJ1i+0lgLgCpSXAp6M3LYlAo6osgSi0xOM=
golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/tools v0.0.0-20200130002326-2f3ba24bd6e7/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=
golang.org/x/tools v0.9.3 h1:Gn1I8+64MsuTb/HpH+LmQtNas23LhUVr3rYZ0eKuaMM=
Expand All @@ -49,6 +51,8 @@ golang.org/x/tools v0.10.0 h1:tvDr/iQoUqNdohiYm0LmmKcBk+q86lb9EprIUFhHHGg=
golang.org/x/tools v0.10.0/go.mod h1:UJwyiVBsOA2uwvK/e5OY3GTpDUJriEd+/YlqAwLPmyM=
golang.org/x/tools v0.11.0 h1:EMCa6U9S2LtZXLAMoWiR/R8dAQFRqbAitmbJ2UKhoi8=
golang.org/x/tools v0.11.0/go.mod h1:anzJrxPjNtfgiYQYirP2CPGzGLxrH2u2QBhn6Bf3qY8=
golang.org/x/tools v0.12.0 h1:YW6HUoUmYBpwSgyaGaZq1fHjrBjX1rlpZ54T6mu2kss=
golang.org/x/tools v0.12.0/go.mod h1:Sc0INKfu04TlqNoRA1hgpFZbhYXHPr4V5DzpSBTPqQM=
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
Expand Down
4 changes: 2 additions & 2 deletions packages/@jsii/go-runtime/jsii-runtime-go/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ require (
github.com/mattn/go-isatty v0.0.19
github.com/stretchr/testify v1.8.4
golang.org/x/lint v0.0.0-20210508222113-6edffad5e616
golang.org/x/tools v0.11.0
golang.org/x/tools v0.12.0
)

require (
Expand All @@ -17,7 +17,7 @@ require (
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/yuin/goldmark v1.4.13 // indirect
golang.org/x/mod v0.12.0 // indirect
golang.org/x/sys v0.10.0 // indirect
golang.org/x/sys v0.11.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)

Expand Down
8 changes: 4 additions & 4 deletions packages/@jsii/go-runtime/jsii-runtime-go/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,12 @@ golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5h
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.10.0 h1:SqMFp9UcQJZa+pmYuAKjd9xq1f0j5rLcDIk0mj4qAsA=
golang.org/x/sys v0.10.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.11.0 h1:eG7RXZHdqOJ1i+0lgLgCpSXAp6M3LYlAo6osgSi0xOM=
golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/tools v0.0.0-20200130002326-2f3ba24bd6e7/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=
golang.org/x/tools v0.11.0 h1:EMCa6U9S2LtZXLAMoWiR/R8dAQFRqbAitmbJ2UKhoi8=
golang.org/x/tools v0.11.0/go.mod h1:anzJrxPjNtfgiYQYirP2CPGzGLxrH2u2QBhn6Bf3qY8=
golang.org/x/tools v0.12.0 h1:YW6HUoUmYBpwSgyaGaZq1fHjrBjX1rlpZ54T6mu2kss=
golang.org/x/tools v0.12.0/go.mod h1:Sc0INKfu04TlqNoRA1hgpFZbhYXHPr4V5DzpSBTPqQM=
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
Expand Down
134 changes: 122 additions & 12 deletions packages/@jsii/kernel/src/disk-cache/disk-cache.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import {
utimesSync,
writeFileSync,
} from 'fs';
import { lockSync, unlockSync } from 'lockfile';
import { lockSync, Options, unlockSync } from 'lockfile';
import { dirname, join } from 'path';

import { digestFile } from './digest-file';
Expand Down Expand Up @@ -152,9 +152,62 @@ export class Entry {
return join(this.path, MARKER_FILE_NAME);
}

/**
* Whether the directory has been completely written
*
* The presence of the marker file is a signal that we can skip trying to lock the directory.
*/
public get isComplete(): boolean {
return existsSync(this.#markerFile);
}

/**
* Retrieve an entry from the cache
*
* If the entry doesn't exist yet, use 'cb' to produce the file contents.
*/
public retrieve(cb: (path: string) => void): {
path: string;
cache: 'hit' | 'miss';
} {
// If the marker file already exists, update its timestamp and immediately return.
// We don't even try to lock.
if (this.isComplete) {
this.#touchMarkerFile();
return { path: this.path, cache: 'hit' };
}

let cache: 'hit' | 'miss' = 'miss';
this.lock((lock) => {
// While we all fought to acquire the lock, someone else might have completed already.
if (this.isComplete) {
cache = 'hit';
return;
}

// !!!IMPORTANT!!!
// Extract directly into the final target directory, as certain antivirus
// software configurations on Windows will make a `renameSync` operation
// fail with EPERM until the files have been fully analyzed.
mkdirSync(this.path, { recursive: true });
try {
cb(this.path);
} catch (error) {
rmSync(this.path, { force: true, recursive: true });
throw error;
}
lock.markComplete();
});
return { path: this.path, cache };
}

public lock<T>(cb: (entry: LockedEntry) => T): T {
mkdirSync(dirname(this.path), { recursive: true });
lockSync(this.#lockFile, { retries: 12, stale: 5_000 });
lockSyncWithWait(this.#lockFile, {
retries: 12,
// Extracting the largest tarball takes ~5s
stale: 10_000,
});
let disposed = false;
try {
return cb({
Expand All @@ -179,20 +232,13 @@ export class Entry {
mkdirSync(dirname(join(this.path, name)), { recursive: true });
writeFileSync(join(this.path, name), content);
},
touch: () => {
markComplete: () => {
if (disposed) {
throw new Error(
`Cannot touch ${this.path} once the lock block was returned!`,
);
}
if (this.pathExists) {
if (existsSync(this.#markerFile)) {
const now = new Date();
utimesSync(this.#markerFile, now, now);
} else {
writeFileSync(this.#markerFile, '');
}
}
this.#touchMarkerFile();
},
});
} finally {
Expand All @@ -201,6 +247,23 @@ export class Entry {
}
}

/**
* Update the timestamp on the marker file
*/
#touchMarkerFile() {
if (this.pathExists) {
try {
const now = new Date();
utimesSync(this.#markerFile, now, now);
} catch (e: any) {
if (e.code !== 'ENOENT') {
throw e;
}
writeFileSync(this.#markerFile, '');
}
}
}

public read(file: string): Buffer | undefined {
try {
return readFileSync(join(this.path, file));
Expand All @@ -217,7 +280,12 @@ export interface LockedEntry {
delete(): void;
write(name: string, data: Buffer): void;

touch(): void;
/**
* Mark the entry has having been completed
*
* The modification time of this file is used for cleanup.
*/
markComplete(): void;
}

function* directoriesUnder(
Expand All @@ -242,3 +310,45 @@ function* directoriesUnder(
}
}
}

/**
* We must use 'lockSync', but that doesn't support waiting (because waiting is only supported for async APIs)
* so we have to build our own looping locker with waits
*/
function lockSyncWithWait(path: string, options: Options) {
let retries = options.retries ?? 0;
let sleep = 100;

// eslint-disable-next-line no-constant-condition
while (true) {
try {
lockSync(path, {
retries: 0,
stale: options.stale,
});
return;
} catch (e: any) {
if (retries === 0) {
throw e;
}
retries--;

if (e.code === 'EEXIST') {
// Most common case, needs longest sleep. Randomize the herd.
sleepSync(Math.floor(Math.random() * sleep));
sleep *= 1.5;
} else {
sleepSync(5);
}
}
}
}

/**
* Abuse Atomics.wait() to come up with a sync sleep
*
* We must use a sync sleep because all of jsii is sync.
*/
function sleepSync(ms: number) {
Atomics.wait(new Int32Array(new SharedArrayBuffer(4)), 0, 0, ms);
}
Loading

0 comments on commit 9892444

Please sign in to comment.