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

chore: upgrade node version #14985

Merged
merged 80 commits into from
May 30, 2024
Merged
Show file tree
Hide file tree
Changes from 71 commits
Commits
Show all changes
80 commits
Select commit Hold shift + click to select a range
3cb8d6c
chore: single source of truth for node version
lodmfjord Apr 12, 2024
4b1a737
fix: hash key
lodmfjord Apr 12, 2024
2df4d00
fix: update docker images
lodmfjord Apr 12, 2024
21ac386
chore: nx format:write update dirty files
andes-it Apr 12, 2024
a095f9e
fix: deps
lodmfjord Apr 12, 2024
04e2f16
chore: nx format:write update dirty files
andes-it Apr 12, 2024
26ff4f6
fix: build arg
lodmfjord Apr 12, 2024
0c30df3
fix: remove echo
lodmfjord Apr 12, 2024
f11b018
Update scripts/ci/Dockerfile
lodmfjord Apr 12, 2024
4cc976f
Update .github/workflows/pullrequest.yml
lodmfjord Apr 12, 2024
c5e73ef
Update .github/workflows/push.yml
lodmfjord Apr 12, 2024
1ddff48
Update scripts/ci/Dockerfile
lodmfjord Apr 12, 2024
cef0a92
Update scripts/ci/10_prepare-docker-deps.sh
lodmfjord Apr 12, 2024
7929815
Update scripts/ci/10_prepare-docker-deps.sh
lodmfjord Apr 12, 2024
4ea535c
fix: formatting
lodmfjord Apr 12, 2024
504b58d
fix: formatting
lodmfjord Apr 12, 2024
9c5cc8d
chore: nx format:write update dirty files
andes-it Apr 12, 2024
256d59c
fix: sparse checkout
lodmfjord Apr 12, 2024
0c0ed08
Update .github/workflows/push.yml
lodmfjord Apr 12, 2024
0695087
chore: nx format:write update dirty files
andes-it Apr 12, 2024
4d811fb
fix: nodejs image tag
lodmfjord Apr 12, 2024
83fb6df
fix: image tag
lodmfjord Apr 12, 2024
bdc7236
fix: skip fetch
lodmfjord Apr 12, 2024
f487d00
Update infra/scripts/Dockerfile
lodmfjord Apr 12, 2024
4eedba2
Update infra/scripts/Dockerfile
lodmfjord Apr 12, 2024
82423b4
fix: ble
lodmfjord Apr 12, 2024
9b1aac5
fix: debug
lodmfjord Apr 12, 2024
c204775
fix: oops
lodmfjord Apr 12, 2024
0f78f93
chore: nx format:write update dirty files
andes-it Apr 12, 2024
5a1cbf3
Merge branch 'main' into upgrade-node-version
lodmfjord Apr 13, 2024
32ca64e
fix: build
lodmfjord Apr 13, 2024
e3c42bd
fix: affect all
lodmfjord Apr 13, 2024
6eb6ced
Merge branch 'main' into upgrade-node-version
lodmfjord Apr 13, 2024
3474f4c
Merge branch 'main' into upgrade-node-version
lodmfjord Apr 16, 2024
741dcec
Merge branch 'main' into upgrade-node-version
lodmfjord Apr 18, 2024
e531c4d
fix: test skipping base tag
lodmfjord Apr 18, 2024
916e050
chore: nx format:write update dirty files
andes-it Apr 18, 2024
d7f338d
Merge branch 'main' into upgrade-node-version
lodmfjord May 22, 2024
e759d9e
fix: update script
lodmfjord May 22, 2024
90ce677
fix: build
lodmfjord May 22, 2024
b15ecb9
fix: main
lodmfjord May 22, 2024
098a47d
fix: build
lodmfjord May 22, 2024
c2ce0c4
Merge branch 'main' into upgrade-node-version
lodmfjord May 24, 2024
3a22b57
fix: revert
lodmfjord May 27, 2024
e81f2ae
Merge branch 'main' into upgrade-node-version
lodmfjord May 27, 2024
63eeb9f
fix: remove trash
lodmfjord May 27, 2024
ae6d7fe
fix: remove error
lodmfjord May 27, 2024
9b4ef6b
Merge branch 'main' into upgrade-node-version
lodmfjord May 28, 2024
2108b5e
Merge branch 'main' into upgrade-node-version
kodiakhq[bot] May 28, 2024
0a866cb
fix: ble
lodmfjord May 28, 2024
84266f6
Merge branch 'main' into upgrade-node-version
kodiakhq[bot] May 28, 2024
79340cd
Merge branch 'main' into upgrade-node-version
lodmfjord May 29, 2024
a753b02
add debug
lodmfjord May 29, 2024
6a01d30
fix: ok
lodmfjord May 29, 2024
f8dca88
fix: ok
lodmfjord May 29, 2024
5a10756
fix: bug
lodmfjord May 29, 2024
700b061
fix: bad test
lodmfjord May 29, 2024
04c2fd6
fix: ok
lodmfjord May 29, 2024
0d6104d
fix: ok
lodmfjord May 29, 2024
217e120
fix: ok
lodmfjord May 29, 2024
fc8041c
fix: ok
lodmfjord May 29, 2024
72b8f25
fix: ok
lodmfjord May 29, 2024
60f0929
fix: ok
lodmfjord May 29, 2024
c77054d
fix: ok
lodmfjord May 29, 2024
fee2546
fix: ok
lodmfjord May 29, 2024
11d69ee
fix: ok
lodmfjord May 29, 2024
68941a7
fix: ok
lodmfjord May 29, 2024
5fc722c
fix: ok
lodmfjord May 29, 2024
1c10926
Merge branch 'main' into upgrade-node-version
lodmfjord May 29, 2024
56b3866
fix: ok
lodmfjord May 29, 2024
4eb8ba3
chore: nx format:write update dirty files
andes-it May 29, 2024
9cee6d1
fix: revert
lodmfjord May 30, 2024
acf4a8d
fix: prog
lodmfjord May 30, 2024
0e014f7
Merge branch 'main' into upgrade-node-version
lodmfjord May 30, 2024
541e53c
Merge branch 'main' into upgrade-node-version
lodmfjord May 30, 2024
d20f2b6
Merge branch 'main' into upgrade-node-version
lodmfjord May 30, 2024
4a1b3c9
fix: build
lodmfjord May 30, 2024
c95bb28
fix: version
lodmfjord May 30, 2024
1fb7a74
chore: nx format:write update dirty files
andes-it May 30, 2024
612e927
Merge branch 'main' into upgrade-node-version
kodiakhq[bot] May 30, 2024
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
149 changes: 81 additions & 68 deletions .github/actions/change-detection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -113,80 +113,93 @@ export async function findBestGoodRefPR(
): Promise<LastGoodBuild> {
const log = app.extend('findBestGoodRefPR')
log(`Starting with head branch ${headBranch} and base branch ${baseBranch}`)
const lastCommitSha = await git.lastCommit()
const prCommits = await getCommits(git, headBranch, baseBranch, 'HEAD')
return new Promise(async (resolve) => {
const lastCommitSha = await git.lastCommit()
const prCommits = await getCommits(git, headBranch, baseBranch, 'HEAD')

const prRun = await githubApi.getLastGoodPRRun(
headBranch,
workflowId,
prCommits,
)
const prBuilds: {
distance: number
hash: string
run_nr: number
branch: string
ref: string
}[] = []
if (prRun) {
log(`Found a PR run candidate: ${JSON.stringify(prRun)}`)
try {
const tempBranch = `${headBranch}-${Math.round(Math.random() * 1000000)}`
await git.checkoutBranch(tempBranch, prRun.base_commit)
log(`Branch checked out`)
const mergeCommitSha = await git.merge(prRun.head_commit)
log(`Simulated previous PR merge commit`)
const distance = await githubApi.getChangedComponents(
const prRun = await githubApi.getLastGoodPRRun(
headBranch,
workflowId,
prCommits,
)
const prBuilds: {
distance: number
hash: string
run_nr: number
branch: string
ref: string
}[] = []
if (prRun) {
log(`Found a PR run candidate: ${JSON.stringify(prRun)}`)
try {
const tempBranch = `${headBranch}-${Math.round(
Math.random() * 1000000,
)}`
await git.checkoutBranch(tempBranch, prRun.base_commit)
log(`Branch checked out`)
lodmfjord marked this conversation as resolved.
Show resolved Hide resolved
const mergeCommitSha = await git.merge(prRun.head_commit)
log(`Simulated previous PR merge commit`)
const distance = await githubApi.getChangedComponents(
git,
lastCommitSha,
mergeCommitSha,
)
log(`Affected components since candidate PR run are ${distance}`)
prBuilds.push({
distance: diffWeight(distance),
hash: prRun.head_commit,
run_nr: prRun.run_nr,
branch: headBranch,
ref: mergeCommitSha,
})
} catch (e) {
log(
`Error processing PR candidate(${prRun.run_nr}) but continuing: %O`,
e,
)
} finally {
await git.checkout(prBranch)
}
}

const baseCommits = await getCommits(git, prBranch, baseBranch, 'HEAD~1')
log(`Base commits ${baseCommits.join(' ')}`)
const baseGoodBuilds = await githubApi.getLastGoodBranchBuildRun(
baseBranch,
'push',
baseCommits,
)
if (baseGoodBuilds) {
log(`Found Base good builds ${JSON.stringify(baseGoodBuilds)}`)
let affectedComponents = await githubApi.getChangedComponents(
git,
lastCommitSha,
mergeCommitSha,
baseGoodBuilds.head_commit,
)
log(`Affected components since candidate PR run are ${distance}`)
log(`Found affected components ${affectedComponents}`)
prBuilds.push({
distance: diffWeight(distance),
hash: prRun.head_commit,
run_nr: prRun.run_nr,
branch: headBranch,
ref: mergeCommitSha,
distance: diffWeight(affectedComponents),
hash: baseGoodBuilds.head_commit,
run_nr: baseGoodBuilds.run_nr,
branch: baseBranch,
ref: baseGoodBuilds.head_commit,
})
} catch (e) {
log(
`Error processing PR candidate(${prRun.run_nr}) but continuing: %O`,
e,
)
} finally {
await git.checkout(prBranch)
log('stops on push?!?!')
}
}

const baseCommits = await getCommits(git, prBranch, baseBranch, 'HEAD~1')

const baseGoodBuilds = await githubApi.getLastGoodBranchBuildRun(
baseBranch,
'push',
baseCommits,
)
if (baseGoodBuilds) {
let affectedComponents = await githubApi.getChangedComponents(
git,
lastCommitSha,
baseGoodBuilds.head_commit,
)
prBuilds.push({
distance: diffWeight(affectedComponents),
hash: baseGoodBuilds.head_commit,
run_nr: baseGoodBuilds.run_nr,
branch: baseBranch,
ref: baseGoodBuilds.head_commit,
})
}
prBuilds.sort((a, b) => (a.distance > b.distance ? 1 : -1))
if (prBuilds.length > 0)
return {
sha: prBuilds[0].hash,
run_number: prBuilds[0].run_nr,
branch: prBuilds[0].branch.replace('origin/', ''),
ref: prBuilds[0].ref,
log(`pr build ${JSON.stringify(prBuilds)}`)
prBuilds.sort((a, b) => (a.distance > b.distance ? 1 : -1))
log(`sort done`)
if (prBuilds.length > 0) {
log(`return message`)
resolve({
sha: prBuilds[0].hash,
run_number: prBuilds[0].run_nr,
branch: prBuilds[0].branch.replace('origin/', ''),
ref: prBuilds[0].ref,
})
return
}
return 'rebuild'
log(`return rebuild`)
resolve('rebuild')
})
lodmfjord marked this conversation as resolved.
Show resolved Hide resolved
}
137 changes: 75 additions & 62 deletions .github/actions/dist/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -26154,73 +26154,85 @@ function findBestGoodRefPR(diffWeight, git, githubApi, headBranch, baseBranch, p
return __async(this, null, function* () {
const log = app2.extend("findBestGoodRefPR");
log(`Starting with head branch ${headBranch} and base branch ${baseBranch}`);
const lastCommitSha = yield git.lastCommit();
const prCommits = yield getCommits(git, headBranch, baseBranch, "HEAD");
const prRun = yield githubApi.getLastGoodPRRun(
headBranch,
workflowId,
prCommits
);
const prBuilds = [];
if (prRun) {
log(`Found a PR run candidate: ${JSON.stringify(prRun)}`);
try {
const tempBranch = `${headBranch}-${Math.round(Math.random() * 1e6)}`;
yield git.checkoutBranch(tempBranch, prRun.base_commit);
log(`Branch checked out`);
const mergeCommitSha = yield git.merge(prRun.head_commit);
log(`Simulated previous PR merge commit`);
const distance = yield githubApi.getChangedComponents(
return new Promise((resolve) => __async(this, null, function* () {
const lastCommitSha = yield git.lastCommit();
const prCommits = yield getCommits(git, headBranch, baseBranch, "HEAD");
const prRun = yield githubApi.getLastGoodPRRun(
headBranch,
workflowId,
prCommits
);
const prBuilds = [];
if (prRun) {
log(`Found a PR run candidate: ${JSON.stringify(prRun)}`);
try {
const tempBranch = `${headBranch}-${Math.round(Math.random() * 1e6)}`;
yield git.checkoutBranch(tempBranch, prRun.base_commit);
log(`Branch checked out`);
const mergeCommitSha = yield git.merge(prRun.head_commit);
log(`Simulated previous PR merge commit`);
const distance = yield githubApi.getChangedComponents(
git,
lastCommitSha,
mergeCommitSha
);
log(`Affected components since candidate PR run are ${distance}`);
prBuilds.push({
distance: diffWeight(distance),
hash: prRun.head_commit,
run_nr: prRun.run_nr,
branch: headBranch,
ref: mergeCommitSha
});
} catch (e) {
log(
`Error processing PR candidate(${prRun.run_nr}) but continuing: %O`,
e
);
} finally {
yield git.checkout(prBranch);
}
}
const baseCommits = yield getCommits(git, prBranch, baseBranch, "HEAD~1");
log(`Base commits ${baseCommits.join(" ")}`);
const baseGoodBuilds = yield githubApi.getLastGoodBranchBuildRun(
baseBranch,
"push",
baseCommits
);
if (baseGoodBuilds) {
log(`Found Base good builds ${JSON.stringify(baseGoodBuilds)}`);
let affectedComponents = yield githubApi.getChangedComponents(
git,
lastCommitSha,
mergeCommitSha
baseGoodBuilds.head_commit
);
log(`Affected components since candidate PR run are ${distance}`);
log(`Found affected components ${affectedComponents}`);
prBuilds.push({
distance: diffWeight(distance),
hash: prRun.head_commit,
run_nr: prRun.run_nr,
branch: headBranch,
ref: mergeCommitSha
distance: diffWeight(affectedComponents),
hash: baseGoodBuilds.head_commit,
run_nr: baseGoodBuilds.run_nr,
branch: baseBranch,
ref: baseGoodBuilds.head_commit
});
} catch (e) {
log(
`Error processing PR candidate(${prRun.run_nr}) but continuing: %O`,
e
);
} finally {
yield git.checkout(prBranch);
log("stops on push?!?!");
}
log(`pr build ${JSON.stringify(prBuilds)}`);
prBuilds.sort((a, b) => a.distance > b.distance ? 1 : -1);
log(`sort done`);
if (prBuilds.length > 0) {
log(`return message`);
resolve({
sha: prBuilds[0].hash,
run_number: prBuilds[0].run_nr,
branch: prBuilds[0].branch.replace("origin/", ""),
ref: prBuilds[0].ref
});
return;
}
}
const baseCommits = yield getCommits(git, prBranch, baseBranch, "HEAD~1");
const baseGoodBuilds = yield githubApi.getLastGoodBranchBuildRun(
baseBranch,
"push",
baseCommits
);
if (baseGoodBuilds) {
let affectedComponents = yield githubApi.getChangedComponents(
git,
lastCommitSha,
baseGoodBuilds.head_commit
);
prBuilds.push({
distance: diffWeight(affectedComponents),
hash: baseGoodBuilds.head_commit,
run_nr: baseGoodBuilds.run_nr,
branch: baseBranch,
ref: baseGoodBuilds.head_commit
});
}
prBuilds.sort((a, b) => a.distance > b.distance ? 1 : -1);
if (prBuilds.length > 0)
return {
sha: prBuilds[0].hash,
run_number: prBuilds[0].run_nr,
branch: prBuilds[0].branch.replace("origin/", ""),
ref: prBuilds[0].ref
};
return "rebuild";
log(`return rebuild`);
resolve("rebuild");
}));
});
}

Expand Down Expand Up @@ -26345,11 +26357,12 @@ var FULL_REBUILD_NEEDED = "full_rebuild_needed";
);
if (rev === "rebuild") {
console.log(FULL_REBUILD_NEEDED);
return;
process.exit(0);
}
rev.branch = rev.branch.replace(/'/g, "");
rev.ref = rev.ref.replace(/'/g, "");
console.log(JSON.stringify(rev));
process.exit(0);
}))();
/*!
* is-plain-object <https://github.com/jonschlinkert/is-plain-object>
Expand Down
3 changes: 2 additions & 1 deletion .github/actions/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,10 @@ const FULL_REBUILD_NEEDED = 'full_rebuild_needed'

if (rev === 'rebuild') {
console.log(FULL_REBUILD_NEEDED)
return
process.exit(0)
}
rev.branch = rev.branch.replace(/'/g, '')
rev.ref = rev.ref.replace(/'/g, '')
console.log(JSON.stringify(rev))
process.exit(0)
})()
2 changes: 1 addition & 1 deletion .github/actions/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"@octokit/rest": "19.0.4",
"@types/debug": "4.1.7",
"@types/jest": "^27.4.1",
"@types/node": "20.11.4",
"@types/node": "20.12.12",
"debug": "4.3.4",
"esbuild": "0.15.10",
"esbuild-runner": "2.2.1",
Expand Down
2 changes: 1 addition & 1 deletion .github/actions/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"target": "es2015",
"module": "esnext",
"typeRoots": ["node_modules/@types"],
"lib": ["es2019", "esnext.array"],
"lib": ["es2019", "esnext.array", "esnext"],
"skipLibCheck": true,
"skipDefaultLibCheck": true,
"allowSyntheticDefaultImports": true,
Expand Down
4 changes: 2 additions & 2 deletions .github/actions/unit-test/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,9 @@ runs:
run: npm install -g yarn
shell: bash

- uses: actions/setup-node@v2
- uses: actions/setup-node@v4
with:
node-version: '18'
node-version-file: 'package.json'

- name: Setup yarn
run: npm install -g yarn
Expand Down
10 changes: 5 additions & 5 deletions .github/actions/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1610,12 +1610,12 @@ __metadata:
languageName: node
linkType: hard

"@types/node@npm:20.11.4":
version: 20.11.4
resolution: "@types/node@npm:20.11.4"
"@types/node@npm:20.12.12":
version: 20.12.12
resolution: "@types/node@npm:20.12.12"
dependencies:
undici-types: ~5.26.4
checksum: b9cf2c5397ea31f3355656edd204aee777a36db75b79b8b7aba2bed7ea5b29914fa808489da5c632c5eddbb33c3106188bef0bff3b7648bd39aa50dee466a73b
checksum: 5373983874b9af7c216e7ca5d26b32a8d9829c703a69f1e66f2113598b5be8582c0e009ca97369f1ec9a6282b3f92812208d06eb1e9fc3bd9b939b022303d042
languageName: node
linkType: hard

Expand Down Expand Up @@ -1715,7 +1715,7 @@ __metadata:
"@octokit/rest": 19.0.4
"@types/debug": 4.1.7
"@types/jest": ^27.4.1
"@types/node": 20.11.4
"@types/node": 20.12.12
debug: 4.3.4
esbuild: 0.15.10
esbuild-runner: 2.2.1
Expand Down
Loading
Loading