Skip to content

feat(agora): centralize the task definition build-image (ARCH-307) #2892

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

Merged
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
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
11 changes: 0 additions & 11 deletions apps/agora/apex/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,6 @@
"command": "docker/agora/serve-detach.sh agora-apex"
}
},
"build-image": {
"executor": "@nx-tools/nx-container:build",
"options": {
"context": "apps/agora/apex",
"metadata": {
"images": ["ghcr.io/sage-bionetworks/agora-apex"],
"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/agora/api-docs/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,18 +30,6 @@
"command": "docker/agora/serve-detach.sh agora-api-docs"
}
},
"build-image": {
"executor": "@nx-tools/nx-container:build",
"options": {
"context": "apps/agora/api-docs",
"metadata": {
"images": ["ghcr.io/sage-bionetworks/agora-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/agora/api/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -60,18 +60,6 @@
"fix": true
}
},
"build-image": {
"executor": "@nx-tools/nx-container:build",
"options": {
"context": ".",
"metadata": {
"images": ["ghcr.io/sage-bionetworks/agora-api"],
"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/agora/app/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -156,18 +156,6 @@
},
"defaultConfiguration": "development"
},
"build-image": {
"executor": "@nx-tools/nx-container:build",
"options": {
"context": ".",
"metadata": {
"images": ["ghcr.io/sage-bionetworks/agora-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
16 changes: 0 additions & 16 deletions apps/agora/data/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,22 +31,6 @@
"command": "docker/agora/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",
"type=raw,value=$DATA_FILE.$DATA_VERSION"
]
},
"push": false
}
},
"publish-image": {
"executor": "@nx-tools/nx-container:build",
"options": {
Expand Down
11 changes: 0 additions & 11 deletions apps/agora/mongo/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,6 @@
"command": "docker/agora/serve-detach.sh {projectName}"
}
},
"build-image": {
"executor": "@nx-tools/nx-container:build",
"options": {
"context": "apps/agora/mongo",
"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
4 changes: 2 additions & 2 deletions libs/sage-monorepo/nx-plugin/src/plugins/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import { inferProjectMetadata } from './project-metadata';
function readProjectCOnfigurationsCache(
cachePath: string,
): Record<string, SageMonorepoProjectConfiguration> {
console.log(`cachePath: ${cachePath}`);
// console.log(`cachePath: ${cachePath}`);
return existsSync(cachePath) ? readJsonFile(cachePath) : {};
}

Expand All @@ -34,7 +34,7 @@ function writeProjectConfigurationsToCache(
writeJsonFile(cachePath, results);
}

const projectFilePattern = '{apps,libs}/openchallenges/**/project.json';
const projectFilePattern = '{apps,libs}/{openchallenges,agora}/**/project.json';

export const createNodesV2: CreateNodesV2<SageMonorepoPluginOptions> = [
projectFilePattern,
Expand Down
12 changes: 8 additions & 4 deletions libs/sage-monorepo/nx-plugin/src/plugins/project-metadata.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ function inferProjectType(projectRoot: string): ProjectType {
} else if (projectRoot.startsWith('libs/')) {
return 'library';
}

throw new Error(`Unknown project type for project root: ${projectRoot}`);
}

Expand All @@ -55,16 +56,19 @@ function inferBuilder(
): Builder | null {
if (siblingFiles.includes('poetry.lock')) return 'poetry';
if (siblingFiles.includes('build.gradle')) return 'gradle';
if (
localProjectConfiguration?.targets?.['build']?.executor ===
'@angular-devkit/build-angular:browser'
) {

const executor = localProjectConfiguration?.targets?.['build']?.executor ?? '';
const webpackExecutors = ['@angular-devkit/build-angular:browser', '@nx/webpack:webpack'];

if (webpackExecutors.includes(executor)) {
return 'webpack';
}

return null;
}

function inferContainerType(siblingFiles: string[]): ContainerType | null {
if (siblingFiles.includes('Dockerfile')) return 'Docker';

return null;
}
Loading