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

TTT #123

Open
wants to merge 62 commits into
base: main
Choose a base branch
from
Open

TTT #123

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
62 commits
Select commit Hold shift + click to select a range
41e0820
Bring kogito-serverless-operator code over
thiagoelg Apr 19, 2024
51a7ca5
Merge branch 'main' of github.com:apache/incubator-kie-tools into kog…
thiagoelg Apr 19, 2024
8496159
Go tidy
thiagoelg Apr 22, 2024
31b5503
v1 flag on api
thiagoelg Apr 22, 2024
034eb2f
Build and test scripts
thiagoelg Apr 23, 2024
2b30664
Tmp: Faster CI
thiagoelg Apr 23, 2024
0c6502a
Merge branch 'main' of github.com:apache/incubator-kie-tools into kog…
thiagoelg Apr 23, 2024
6d7a3e9
Merge branch 'main' of github.com:apache/incubator-kie-tools into kog…
thiagoelg Apr 23, 2024
f77ee13
Build images before testing
thiagoelg Apr 23, 2024
18ebedb
Activate python env
thiagoelg Apr 23, 2024
703f858
Add Dockerfile back
thiagoelg Apr 23, 2024
59f2b7d
One more Dockerfile
thiagoelg Apr 23, 2024
874a883
Python scripts on Windows
thiagoelg Apr 23, 2024
ee7cfc9
Skip builds on Windows and macOS
thiagoelg Apr 23, 2024
20787ed
Add python venv dep
thiagoelg Apr 23, 2024
2cfee83
Oops
thiagoelg Apr 23, 2024
7939978
Oops, I did it again
thiagoelg Apr 23, 2024
958bfa4
Increase timeout
thiagoelg Apr 24, 2024
c1f6f0e
Fix package.json
thiagoelg Apr 24, 2024
cb99cfe
Add s2i deps to devbox
thiagoelg Apr 24, 2024
076ec4c
Merge branch 'main' of github.com:apache/incubator-kie-tools into kog…
thiagoelg Apr 24, 2024
23d855e
Diff and devbox
thiagoelg Apr 24, 2024
b1bed81
Format after generate
thiagoelg Apr 24, 2024
20be691
Fix lockfile
thiagoelg Apr 24, 2024
0a05376
Fix image:build
thiagoelg Apr 24, 2024
31c88ec
Default to -nightly, latest and 0.0.0
thiagoelg Apr 24, 2024
4a2e6bf
bump-version fix
thiagoelg Apr 24, 2024
da0a628
bump-version fix
thiagoelg Apr 24, 2024
dd9c8e3
format bump version
thiagoelg Apr 24, 2024
fdeb24b
bump-version fix
thiagoelg Apr 24, 2024
4ed3404
remove ci files from operator and fix format
thiagoelg Apr 24, 2024
f907702
Merge branch 'main' of github.com:apache/incubator-kie-tools into kog…
thiagoelg Apr 24, 2024
9385ca2
revert kn-plugin-workflow
thiagoelg Apr 24, 2024
527d4a2
Rename kogito-images yamls + script
thiagoelg Apr 25, 2024
4d46545
Fix format
thiagoelg Apr 25, 2024
f523fad
Fix format
thiagoelg Apr 25, 2024
1e62d90
Change format script and bump-version
thiagoelg Apr 25, 2024
5924f8e
Change image name on -image.yaml file
thiagoelg Apr 25, 2024
e32bb52
Disable script_debug on kogit-swf-devmode
thiagoelg Apr 25, 2024
dbb1155
Merge branch 'main' of github.com:apache/incubator-kie-tools into kog…
thiagoelg Apr 25, 2024
ffbbcbe
Replace version in bundle and manager.yaml
thiagoelg Apr 25, 2024
831bd6b
Remove sed requirement
tiagobento Apr 25, 2024
cfb5c83
Oops. Forgot to commit these.
tiagobento Apr 25, 2024
eedbde1
Skip operator image build on macOS
tiagobento Apr 26, 2024
a20eb7a
Create exclusive job for it
tiagobento Apr 26, 2024
49a11aa
Oops. Forgot to commit the new job.
tiagobento Apr 26, 2024
0719f92
Testing...
tiagobento Apr 26, 2024
bae68c7
Test again
tiagobento Apr 26, 2024
246ad15
Revert changes to checkout & clone
tiagobento Apr 26, 2024
96c8127
kie-issues-1035-work
thiagoelg Apr 26, 2024
4f46a2d
CI splitting
tiagobento Apr 26, 2024
4f8536a
Oops. Fix version
tiagobento Apr 26, 2024
fdf5cff
Fix array spreading in Bash
tiagobento Apr 26, 2024
e9f6069
Fix kogito-swf-builder image build
tiagobento Apr 26, 2024
f419d2a
Oops
tiagobento Apr 26, 2024
0e1eee9
Bootstrap only relevant packages on SWF stack CI
tiagobento Apr 26, 2024
0694167
One more
tiagobento Apr 26, 2024
cc7767a
Copy m2 artifacts to kogito-swf-devmode image
thiagoelg Apr 26, 2024
8b34a43
Add maven.config to devmode image
thiagoelg Apr 26, 2024
6813d8b
Test
tiagobento Apr 28, 2024
3070e15
Build using all cores
tiagobento Apr 30, 2024
05a1a02
Testing partial build
tiagobento Apr 28, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
14 changes: 7 additions & 7 deletions .github/actions/setup-ci-patterns/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,9 @@ runs:
const pnpmWorkspacePackagesRootPaths = ["packages", "examples"].map(p => path.join(cwd, p)).join("\n");
const nonSourceFilesPatterns = fs.readFileSync(path.join(cwd, "./.github/supporting-files/ci/non-source-files-patterns.txt"), "utf-8");
const nonSourceFilesPatterns = fs.readFileSync(path.join(cwd, "./.github/supporting-files/ci/patterns/non-source-files-patterns.txt"), "utf-8");
const nonSourceFilesPatternsForGitDiff = nonSourceFilesPatterns.split("\n").filter(p => p.trim() !== "").map(p => `':!${p}'`).join(" ");
const testSourceFilesPatterns = fs.readFileSync(path.join(cwd, "./.github/supporting-files/ci/tests-source-files-patterns.txt"), "utf-8");
const testSourceFilesPatterns = fs.readFileSync(path.join(cwd, "./.github/supporting-files/ci/patterns/tests-source-files-patterns.txt"), "utf-8");
core.setOutput("pnpm_workspace_packages_root_paths", pnpmWorkspacePackagesRootPaths);
core.setOutput("non_source_files_patterns", nonSourceFilesPatterns);
Expand All @@ -78,14 +78,14 @@ runs:
core.setOutput(outputName, patterns);
}
await outputPatternsPrefixedWithRoots("tests_reports_patterns", path.join(cwd, "./.github/supporting-files/ci/tests-reports-patterns.txt"));
await outputPatternsPrefixedWithRoots("end_to_end_tests_reports_patterns", path.join(cwd, "./.github/supporting-files/ci/end-to-end-tests-reports-patterns.txt"));
await outputPatternsPrefixedWithRoots("end_to_end_tests_artifacts_patterns", path.join(cwd, "./.github/supporting-files/ci/end-to-end-tests-artifacts-patterns.txt"));
await outputPatternsPrefixedWithRoots("build_artifacts_patterns", path.join(cwd, "./.github/supporting-files/ci/build-artifacts-patterns.txt"));
await outputPatternsPrefixedWithRoots("tests_reports_patterns", path.join(cwd, "./.github/supporting-files/ci/patterns/tests-reports-patterns.txt"));
await outputPatternsPrefixedWithRoots("end_to_end_tests_reports_patterns", path.join(cwd, "./.github/supporting-files/ci/patterns/end-to-end-tests-reports-patterns.txt"));
await outputPatternsPrefixedWithRoots("end_to_end_tests_artifacts_patterns", path.join(cwd, "./.github/supporting-files/ci/patterns/end-to-end-tests-artifacts-patterns.txt"));
await outputPatternsPrefixedWithRoots("build_artifacts_patterns", path.join(cwd, "./.github/supporting-files/ci/patterns/build-artifacts-patterns.txt"));
core.setOutput(
"end_to_end_tests_reports_patterns_for_find",
prefixWithRoots(fs.readFileSync("./.github/supporting-files/ci/end-to-end-tests-reports-patterns.txt", "utf-8"))
prefixWithRoots(fs.readFileSync("./.github/supporting-files/ci/patterns/end-to-end-tests-reports-patterns.txt", "utf-8"))
.split("\n")
.map(p => `-path '${p}'`)
.join(" -o ")
Expand Down
28 changes: 28 additions & 0 deletions .github/supporting-files/ci/build-partitioning/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Build partitioning

This script uses `bun` as runtime and has the purpose of splitting the monorepo build in 2 partitions that, when built, will ensure the entire monorepo has been covered.

Each partition is completely independent from each other, and partition builds will be assigned a mode:

- `none`: No source code changes or none of the changes affect this partition.
- `full`: All packages in the partition need to be built and tested.
- `partial`: Only selected packages of the partition were affected by the changes, so only this subset needs to be rebuilt and tested.

### Usage

At the root of the monorepo, you can run

```bash
npx bun .github/supporting-files/ci/build-partitioning/build_partitioning.ts \
--outputPath='/tmp/partitions.json' \
--forceFull="false" \
--baseSha="$(git rev-parse HEAD~1)" \
--headSha="$(git rev-parse HEAD~0)" \
--graphJsonPath='./repo/graph.json'
```

- `--outputPath`: Where the resulting JSON should be written to.
- `--forceFull`: Wheter or not to force `full` mode
- `--baseSha`: Base Git commit SHA.
- `--headSha`: HEAD Git commit SHA.
- `--graphJsonPath`: Where to find the `graph.json` of the monorepo in Datavis graph format.
119 changes: 119 additions & 0 deletions .github/supporting-files/ci/build-partitioning/assertions.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/

import { PartitionDefinition } from "./types";

export async function assertLeafPackagesInPartitionsExist({
packageNames,
allLeafPackages,
}: {
packageNames: string[];
allLeafPackages: Set<string>;
}) {
const nonLeafPackagesInPartitions = new Set(packageNames.filter((l) => !allLeafPackages.has(l)));
console.log(
`[build-partitioning] Partition definitions only use leaf packages (${
nonLeafPackagesInPartitions.size > 0 ? "❌" : "✅"
}):`
);
if (nonLeafPackagesInPartitions.size > 0) {
console.error(`[build-partitioning] Non-leaf packages found in partition definitions. Aborting.`);
console.error(nonLeafPackagesInPartitions);
process.exit(1);
}
}

export async function assertLeafPackagesInPartitionDefinitionsDontOverlap({
allLeafPackages,
partitionDefinitions,
}: {
allLeafPackages: Set<string>;
partitionDefinitions: PartitionDefinition[];
}) {
const leafPackagesOverlap = partitionDefinitions.flatMap((s) => [...s.leafPackageNames]);
const hasPartitionOverlap = allLeafPackages.size !== leafPackagesOverlap.length;

console.log(`[build-partitioning] Partition definitions don't overlap (${hasPartitionOverlap ? "❌" : "✅"}):`);
if (hasPartitionOverlap) {
console.error(`[build-partitioning] Partitions definitions declare overlapping leaf packages. Aborting.`);
console.error(leafPackagesOverlap);
process.exit(1);
}
}

export async function assertCompleteness({
packageDirsByName,
partitions,
allPackageDirs,
}: {
packageDirsByName: Map<string, string>;
partitions: PartitionDefinition[];
allPackageDirs: Set<string>;
}) {
const partitionsByPkgDir = new Map<string, string[]>();
for (const p of partitions) {
for (const pkgDir of p.dirs) {
partitionsByPkgDir.set(pkgDir, [...(partitionsByPkgDir.get(pkgDir) ?? []), p.name]);
}
}

const redundancyOnPartitionCombinations = new Map<string, string[]>();
partitionsByPkgDir.forEach((partitions, pkgDir) => {
if (partitions.length > 1) {
// We're only interested in packages that are going to be built as part of more than one partition.
const key = partitions.sort().join(" & ");
redundancyOnPartitionCombinations.set(key, [...(redundancyOnPartitionCombinations.get(key) ?? []), pkgDir]);
}
});

console.log(`[build-partitioning] Packages that will be built by more than one partition:`);
console.log(redundancyOnPartitionCombinations);

const completenessCheck = [...allPackageDirs].filter((pkgDir) => !partitionsByPkgDir.has(pkgDir)).length <= 0;
console.log(`[build-partitioning] Partition definitions completeness (${!completenessCheck ? "❌" : "✅"}):`);
if (!completenessCheck) {
console.error(`[build-partitioning] All packages count: ${allPackageDirs.size}`);
for (const p of partitions) {
console.error(`[build-partitioning] ${p.name} packages count: ${p.dirs.size}`);
}
process.exit(1);
}
return allPackageDirs;
}

export async function assertOptimalPartialBuild(args: {
partition: PartitionDefinition;
upstreamPackageNamesInPartition: Set<string>;
affectedPackageNamesInPartition: Set<string>;
relevantPackageNamesInPartition: Set<string>;
}) {
const isOptimalPartialPartitionBuild =
args.upstreamPackageNamesInPartition.size + args.affectedPackageNamesInPartition.size ===
args.relevantPackageNamesInPartition.size;

console.log(
`[build-partitioning] 'Partial' build of '${args.partition.name}': Optimal build check ((${
!isOptimalPartialPartitionBuild ? "❌" : "✅"
}))`
);
if (!isOptimalPartialPartitionBuild) {
console.error(`[build-partitioning] Non-optimal 'Partial' build. Aborting.`);
process.exit(1);
}
}
Loading
Loading