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

feat(sage-monorepo): create Nx plugin to centralize task definitions #2884

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
c5da209
rebase with main
tschaffter Oct 8, 2024
88db415
centralize config for `buil-image` task
tschaffter Oct 4, 2024
9e5e8d6
rename task
tschaffter Oct 4, 2024
ad438eb
add code to register task for e2e (not activated)
tschaffter Oct 4, 2024
27e045c
remove local `build-image` task definition from openchallenges-apex
tschaffter Oct 4, 2024
ae7c44f
prototype dockerzed app target with Nx API v1
tschaffter Oct 5, 2024
b638720
can run build-image of openchallenges-apex using Nx Project Crystal
tschaffter Oct 5, 2024
e29480b
pass plugin options from nx.json
tschaffter Oct 5, 2024
33774a9
reorganize files
tschaffter Oct 5, 2024
6ced20b
minor update
tschaffter Oct 5, 2024
6f4463e
get project name from project file
tschaffter Oct 5, 2024
9824f0e
minor update
tschaffter Oct 5, 2024
dfec04d
split code across multiple files
tschaffter Oct 5, 2024
ffb1b7e
infer project type from projectRoot
tschaffter Oct 5, 2024
4339b37
infer if the app is dockerized
tschaffter Oct 6, 2024
98741b1
infer project builder
tschaffter Oct 6, 2024
a6a5c61
rename targets to projectCOnfigurations
tschaffter Oct 6, 2024
91e1a7c
minor update
tschaffter Oct 6, 2024
8d70d90
add projectConfiguration.tags
tschaffter Oct 6, 2024
d11d6ba
add project configuration builder options
tschaffter Oct 6, 2024
141e086
dynamically add the tag `builder` to projects
tschaffter Oct 6, 2024
8624261
set the plugin to only consider OC projects
tschaffter Oct 6, 2024
01657da
continue rebase
tschaffter Oct 8, 2024
27249d2
the task `build-image` now depends on `build`
tschaffter Oct 7, 2024
933f0d7
update build-image task to support gradle projects
tschaffter Oct 7, 2024
d82b6e9
remove the task `build-image` from Java projects
tschaffter Oct 8, 2024
afae16d
remove task `build-image` from OC Python projects
tschaffter Oct 8, 2024
100bb52
tell pnpm to ignore nx plugin project
tschaffter Oct 9, 2024
26491e3
update package.json
tschaffter Oct 9, 2024
2fb47b5
configure VS Code to not auto-activate Python envs
tschaffter Oct 9, 2024
22a9a61
create ProjectMetadata
tschaffter Oct 9, 2024
5932f25
remove old build code
tschaffter Oct 9, 2024
7dcf730
finalize build-image task for OC app
tschaffter Oct 9, 2024
7e7a06b
fix path to index.ts
tschaffter Oct 9, 2024
3bad724
Merge branch 'main' into sage-monorepo/centralize-build-image
tschaffter Oct 9, 2024
0658bfc
remove nx patch
tschaffter Oct 9, 2024
6526c50
disable nx plugin
tschaffter Oct 9, 2024
83623f0
restore plugin package.json
tschaffter Oct 9, 2024
e0b8235
Merge branch 'main' into sage-monorepo/centralize-build-image
tschaffter Oct 9, 2024
17e7395
re-enable plugin
tschaffter Oct 9, 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
5 changes: 5 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@
"ignorePatterns": ["**/*"],
"plugins": ["@nx"],
"overrides": [
{
"files": "*.json",
"parser": "jsonc-eslint-parser",
"rules": {}
},
{
"files": ["*.ts", "*.tsx", "*.js", "*.jsx"],
"rules": {}
Expand Down
11 changes: 9 additions & 2 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,14 @@
"editor.inlayHints.enabled": "off",
"eslint.enable": true,
"eslint.workingDirectories": ["."],
"eslint.validate": ["javascript", "javascriptreact", "typescript", "typescriptreact", "html"],
"eslint.validate": [
"javascript",
"javascriptreact",
"typescript",
"typescriptreact",
"html",
"json"
],
// We need to explicitly set Prettier as the format for JSON formats, otherwise the formatter
// provided with VS Code will set itself as the default one, despite us specifying that Prettier
// is the default formatter (editor.defaultFormatter).
Expand All @@ -45,7 +52,7 @@
// Python settings
"python.analysis.autoImportCompletions": true,
"python.analysis.typeCheckingMode": "basic",
// "python.terminal.activateEnvironment": false,
"python.terminal.activateEnvironment": false,
"python.terminal.activateEnvInCurrentTerminal": false,
"[python]": {
"editor.defaultFormatter": "ms-python.black-formatter",
Expand Down
22 changes: 0 additions & 22 deletions apps/openchallenges/apex/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,28 +17,6 @@
"command": "docker/openchallenges/serve-detach.sh openchallenges-apex"
}
},
"build-image": {
"executor": "@nx-tools/nx-container:build",
"options": {
"context": "{projectRoot}"
},
"configurations": {
"local": {
"metadata": {
"images": ["ghcr.io/sage-bionetworks/{projectName}"],
"tags": ["type=edge,branch=main", "type=raw,value=local", "type=sha"]
}
},
"ci": {
"metadata": {
"images": ["ghcr.io/sage-bionetworks/{projectName}"],
"tags": ["type=semver,pattern={{version}},value=${VERSION}", "type=sha"]
},
"push": true
}
},
"defaultConfiguration": "local"
},
"publish-image": {
"executor": "@nx-tools/nx-container:build",
"options": {
Expand Down
12 changes: 0 additions & 12 deletions apps/openchallenges/api-docs/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,18 +31,6 @@
"command": "docker/openchallenges/serve-detach.sh openchallenges-api-docs"
}
},
"build-image": {
"executor": "@nx-tools/nx-container:build",
"options": {
"context": "apps/openchallenges/api-docs",
"metadata": {
"images": ["ghcr.io/sage-bionetworks/openchallenges-api-docs"],
"tags": ["type=edge,branch=main", "type=raw,value=local", "type=sha"]
},
"push": false
},
"dependsOn": ["build"]
},
"publish-image": {
"executor": "@nx-tools/nx-container:build",
"options": {
Expand Down
12 changes: 0 additions & 12 deletions apps/openchallenges/api-gateway/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -67,18 +67,6 @@
},
"dependsOn": ["^install"]
},
"build-image": {
"executor": "@nx-tools/nx-container:build",
"options": {
"context": "apps/openchallenges/api-gateway",
"metadata": {
"images": ["ghcr.io/sage-bionetworks/openchallenges-api-gateway"],
"tags": ["type=edge,branch=main", "type=raw,value=local", "type=sha"]
},
"push": false
},
"dependsOn": ["build-image-base"]
},
"publish-image": {
"executor": "@nx-tools/nx-container:build",
"options": {
Expand Down
12 changes: 0 additions & 12 deletions apps/openchallenges/app/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -132,18 +132,6 @@
"jestConfig": "apps/openchallenges/app/jest.config.ts"
}
},
"build-image": {
"executor": "@nx-tools/nx-container:build",
"options": {
"context": ".",
"metadata": {
"images": ["ghcr.io/sage-bionetworks/openchallenges-app"],
"tags": ["type=edge,branch=main", "type=raw,value=local", "type=sha"]
},
"push": false
},
"dependsOn": ["server"]
},
"publish-image": {
"executor": "@nx-tools/nx-container:build",
"options": {
Expand Down
12 changes: 0 additions & 12 deletions apps/openchallenges/challenge-service/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -75,18 +75,6 @@
},
"dependsOn": ["^install"]
},
"build-image": {
"executor": "@nx-tools/nx-container:build",
"options": {
"context": "apps/openchallenges/challenge-service",
"metadata": {
"images": ["ghcr.io/sage-bionetworks/{projectName}"],
"tags": ["type=edge,branch=main", "type=raw,value=local", "type=sha"]
},
"push": false
},
"dependsOn": ["build-image-base"]
},
"publish-image": {
"executor": "@nx-tools/nx-container:build",
"context": "apps/openchallenges/challenge-service",
Expand Down
12 changes: 0 additions & 12 deletions apps/openchallenges/config-server/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -67,18 +67,6 @@
},
"dependsOn": ["^install"]
},
"build-image": {
"executor": "@nx-tools/nx-container:build",
"options": {
"context": "apps/openchallenges/config-server",
"metadata": {
"images": ["ghcr.io/sage-bionetworks/openchallenges-config-server"],
"tags": ["type=edge,branch=main", "type=raw,value=local", "type=sha"]
},
"push": false
},
"dependsOn": ["build-image-base"]
},
"publish-image": {
"executor": "@nx-tools/nx-container:build",
"options": {
Expand Down
11 changes: 0 additions & 11 deletions apps/openchallenges/edam-etl/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,17 +31,6 @@
"command": "docker/openchallenges/serve-detach.sh {projectName}"
}
},
"build-image": {
"executor": "@nx-tools/nx-container:build",
"options": {
"context": "{projectRoot}",
"metadata": {
"images": ["ghcr.io/sage-bionetworks/{projectName}"],
"tags": ["type=edge,branch=main", "type=raw,value=local", "type=sha"]
},
"push": false
}
},
"publish-image": {
"executor": "@nx-tools/nx-container:build",
"options": {
Expand Down
11 changes: 0 additions & 11 deletions apps/openchallenges/elasticsearch/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,6 @@
},
"dependsOn": []
},
"build-image": {
"executor": "@nx-tools/nx-container:build",
"options": {
"context": "apps/openchallenges/elasticsearch",
"metadata": {
"images": ["ghcr.io/sage-bionetworks/openchallenges-elasticsearch"],
"tags": ["type=edge,branch=main", "type=raw,value=local", "type=sha"]
},
"push": false
}
},
"publish-image": {
"executor": "@nx-tools/nx-container:build",
"options": {
Expand Down
11 changes: 0 additions & 11 deletions apps/openchallenges/grafana/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,17 +21,6 @@
},
"dependsOn": []
},
"build-image": {
"executor": "@nx-tools/nx-container:build",
"options": {
"context": "apps/openchallenges/grafana",
"metadata": {
"images": ["ghcr.io/sage-bionetworks/openchallenges-grafana"],
"tags": ["type=edge,branch=main", "type=raw,value=local", "type=sha"]
},
"push": false
}
},
"publish-image": {
"executor": "@nx-tools/nx-container:build",
"options": {
Expand Down
12 changes: 0 additions & 12 deletions apps/openchallenges/image-service/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -75,18 +75,6 @@
},
"dependsOn": ["^install"]
},
"build-image": {
"executor": "@nx-tools/nx-container:build",
"options": {
"context": "apps/openchallenges/image-service",
"metadata": {
"images": ["ghcr.io/sage-bionetworks/openchallenges-image-service"],
"tags": ["type=edge,branch=main", "type=raw,value=local", "type=sha"]
},
"push": false
},
"dependsOn": ["build-image-base"]
},
"publish-image": {
"executor": "@nx-tools/nx-container:build",
"options": {
Expand Down
11 changes: 0 additions & 11 deletions apps/openchallenges/mariadb/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,6 @@
"command": "docker/openchallenges/serve-detach.sh {projectName}"
}
},
"build-image": {
"executor": "@nx-tools/nx-container:build",
"options": {
"context": "{projectRoot}",
"metadata": {
"images": ["ghcr.io/sage-bionetworks/{projectName}"],
"tags": ["type=edge,branch=main", "type=raw,value=local", "type=sha"]
},
"push": false
}
},
"publish-image": {
"executor": "@nx-tools/nx-container:build",
"options": {
Expand Down
11 changes: 0 additions & 11 deletions apps/openchallenges/mysqld-exporter/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,6 @@
},
"dependsOn": []
},
"build-image": {
"executor": "@nx-tools/nx-container:build",
"options": {
"context": "apps/openchallenges/mysqld-exporter",
"metadata": {
"images": ["ghcr.io/sage-bionetworks/openchallenges-mysqld-exporter"],
"tags": ["type=edge,branch=main", "type=raw,value=local", "type=sha"]
},
"push": false
}
},
"publish-image": {
"executor": "@nx-tools/nx-container:build",
"options": {
Expand Down
12 changes: 0 additions & 12 deletions apps/openchallenges/organization-service/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -75,18 +75,6 @@
},
"dependsOn": ["^install"]
},
"build-image": {
"executor": "@nx-tools/nx-container:build",
"options": {
"context": "{projectRoot}",
"metadata": {
"images": ["ghcr.io/sage-bionetworks/{projectName}"],
"tags": ["type=edge,branch=main", "type=raw,value=local", "type=sha"]
},
"push": false
},
"dependsOn": ["build-image-base"]
},
"publish-image": {
"executor": "@nx-tools/nx-container:build",
"options": {
Expand Down
11 changes: 0 additions & 11 deletions apps/openchallenges/prometheus/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,6 @@
},
"dependsOn": []
},
"build-image": {
"executor": "@nx-tools/nx-container:build",
"options": {
"context": "apps/openchallenges/prometheus",
"metadata": {
"images": ["ghcr.io/sage-bionetworks/openchallenges-prometheus"],
"tags": ["type=edge,branch=main", "type=raw,value=local", "type=sha"]
},
"push": false
}
},
"publish-image": {
"executor": "@nx-tools/nx-container:build",
"options": {
Expand Down
12 changes: 0 additions & 12 deletions apps/openchallenges/service-registry/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -67,18 +67,6 @@
},
"dependsOn": ["^install"]
},
"build-image": {
"executor": "@nx-tools/nx-container:build",
"options": {
"context": "apps/openchallenges/service-registry",
"metadata": {
"images": ["ghcr.io/sage-bionetworks/openchallenges-service-registry"],
"tags": ["type=edge,branch=main", "type=raw,value=local", "type=sha"]
},
"push": false
},
"dependsOn": ["build-image-base"]
},
"publish-image": {
"executor": "@nx-tools/nx-container:build",
"options": {
Expand Down
11 changes: 0 additions & 11 deletions apps/openchallenges/thumbor/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,6 @@
"command": "docker/openchallenges/serve-detach.sh openchallenges-thumbor"
}
},
"build-image": {
"executor": "@nx-tools/nx-container:build",
"options": {
"context": "apps/openchallenges/thumbor",
"metadata": {
"images": ["ghcr.io/sage-bionetworks/openchallenges-thumbor"],
"tags": ["type=edge,branch=main", "type=raw,value=local", "type=sha"]
},
"push": false
}
},
"publish-image": {
"executor": "@nx-tools/nx-container:build",
"options": {
Expand Down
11 changes: 0 additions & 11 deletions apps/openchallenges/zipkin/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,6 @@
"command": "docker/openchallenges/serve-detach.sh openchallenges-zipkin"
}
},
"build-image": {
"executor": "@nx-tools/nx-container:build",
"options": {
"context": "apps/openchallenges/zipkin",
"metadata": {
"images": ["ghcr.io/sage-bionetworks/openchallenges-zipkin"],
"tags": ["type=edge,branch=main", "type=raw,value=local", "type=sha"]
},
"push": false
}
},
"publish-image": {
"executor": "@nx-tools/nx-container:build",
"options": {
Expand Down
37 changes: 37 additions & 0 deletions libs/sage-monorepo/nx-sage-monorepo/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
{
"extends": ["../../../.eslintrc.json"],
"ignorePatterns": ["!**/*"],
"overrides": [
{
"files": ["*.ts", "*.tsx", "*.js", "*.jsx"],
"rules": {}
},
{
"files": ["*.ts", "*.tsx"],
"rules": {}
},
{
"files": ["*.js", "*.jsx"],
"rules": {}
},
{
"files": ["*.json"],
"parser": "jsonc-eslint-parser",
"rules": {
"@nx/dependency-checks": [
"error",
{
"ignoredFiles": ["{projectRoot}/eslint.config.{js,cjs,mjs}"]
}
]
}
},
{
"files": ["./package.json"],
"parser": "jsonc-eslint-parser",
"rules": {
"@nx/nx-plugin-checks": "error"
}
}
]
}
Loading
Loading