-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Master #6
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
base: main
Are you sure you want to change the base?
Master #6
Changes from all commits
f5e744d
5a3fb12
f7a6beb
b79e6df
93904d1
3f01809
838ec1d
7650fd6
94b9d96
5243305
a29a27d
c21e396
59a93f2
5004469
f501ec6
5c031e7
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,14 +1,9 @@ | ||
| @Library('Shared') _ | ||
| @Library('shared') _ | ||
| pipeline { | ||
| agent {label 'Node'} | ||
| agent any | ||
|
|
||
| environment{ | ||
| SONAR_HOME = tool "Sonar" | ||
| } | ||
|
|
||
| parameters { | ||
| string(name: 'FRONTEND_DOCKER_TAG', defaultValue: '', description: 'Setting docker image for latest push') | ||
| string(name: 'BACKEND_DOCKER_TAG', defaultValue: '', description: 'Setting docker image for latest push') | ||
| SONAR_HOME = tool "Sonarqube" | ||
| } | ||
|
|
||
| stages { | ||
|
|
@@ -18,49 +13,47 @@ pipeline { | |
| script{ | ||
| cleanWs() | ||
| } | ||
| sh "docker system prune -a -f" | ||
| } | ||
| } | ||
|
|
||
| stage('Git: Code Checkout') { | ||
| steps { | ||
| script{ | ||
| code_checkout("https://github.com/DevMadhup/Wanderlust-Mega-Project.git","main") | ||
| code_clone("https://github.com/Mr-Dusara/Wanderlust-Mega-Project.git","master") | ||
| } | ||
| } | ||
| } | ||
|
|
||
| stage("Trivy: Filesystem scan"){ | ||
| steps{ | ||
| script{ | ||
| trivy_scan() | ||
| } | ||
| } | ||
| } | ||
|
|
||
| stage("OWASP: Dependency check"){ | ||
| steps{ | ||
| script{ | ||
| owasp_dependency() | ||
| } | ||
| } | ||
| } | ||
| stage("Trivy: Filesystem scan"){ | ||
| steps{ | ||
| script{ | ||
| trivy_scan() | ||
| } | ||
| } | ||
| } | ||
| // stage("OWASP: Dependency check"){ | ||
| // steps{ | ||
| // script{ | ||
| // owasp_dependency() | ||
| // } | ||
| // } | ||
| // } | ||
|
|
||
| stage("SonarQube: Code Analysis"){ | ||
| steps{ | ||
| script{ | ||
| sonarqube_analysis("Sonar","wanderlust","wanderlust") | ||
| sonar_analysis("Sonar","wanderlust","wanderlust") | ||
| } | ||
| } | ||
| } | ||
|
|
||
| stage("SonarQube: Code Quality Gates"){ | ||
| stage("SonarQube: Code Quality Gates"){ | ||
| steps{ | ||
| script{ | ||
| sonarqube_code_quality() | ||
| code_quality() | ||
| } | ||
| } | ||
| } | ||
|
|
||
| stage('Exporting environment variables') { | ||
| parallel{ | ||
| stage("Backend env setup"){ | ||
|
|
@@ -84,37 +77,35 @@ pipeline { | |
| } | ||
| } | ||
| } | ||
|
|
||
| stage("Docker: Build Images"){ | ||
| stage("Docker: Build Images"){ | ||
| steps{ | ||
| script{ | ||
| dir('backend'){ | ||
| docker_build("wanderlust-backend-beta","${params.BACKEND_DOCKER_TAG}","madhupdevops") | ||
| image_build("wanderlust-backend","$BUILD_NUMBER","dooms002") | ||
| } | ||
|
|
||
| dir('frontend'){ | ||
| docker_build("wanderlust-frontend-beta","${params.FRONTEND_DOCKER_TAG}","madhupdevops") | ||
| } | ||
| image_build("wanderlust-frontend","$BUILD_NUMBER","dooms002") | ||
| } | ||
| } | ||
| } | ||
| } | ||
|
|
||
| stage("Docker: Push to DockerHub"){ | ||
| steps{ | ||
| script{ | ||
| docker_push("wanderlust-backend-beta","${params.BACKEND_DOCKER_TAG}","madhupdevops") | ||
| docker_push("wanderlust-frontend-beta","${params.FRONTEND_DOCKER_TAG}","madhupdevops") | ||
| docker_push("wanderlust-backend","$BUILD_NUMBER","dooms002") | ||
| docker_push("wanderlust-frontend","$BUILD_NUMBER","dooms002") | ||
| } | ||
| } | ||
| } | ||
| } | ||
| post{ | ||
| success{ | ||
| archiveArtifacts artifacts: '*.xml', followSymlinks: false | ||
| build job: "Wanderlust-CD", parameters: [ | ||
| string(name: 'FRONTEND_DOCKER_TAG', value: "${params.FRONTEND_DOCKER_TAG}"), | ||
| string(name: 'BACKEND_DOCKER_TAG', value: "${params.BACKEND_DOCKER_TAG}") | ||
| ] | ||
| } | ||
| } | ||
| } | ||
| // post{ | ||
| // success{ | ||
| // archiveArtifacts artifacts: '*.xml', followSymlinks: false | ||
| // // build job: "Wanderlust-CD", parameters: [ | ||
| // // string(name: 'FRONTEND_DOCKER_TAG', value: "$BUILD_NUMBER"), | ||
| // // string(name: 'BACKEND_DOCKER_TAG', value: "$BUILD_NUMBER") | ||
| // // ] | ||
| // } | ||
| // } | ||
|
Comment on lines
+102
to
+110
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chain🏁 Script executed: # First, find the Jenkinsfile in the repository
find . -name "Jenkinsfile" -type f | head -20Repository: DevMadhup/Wanderlust-Mega-Project Length of output: 112 🏁 Script executed: # Check the total lines in main Jenkinsfile and read around lines 102-110
wc -l ./Jenkinsfile
echo "---"
sed -n '95,115p' ./JenkinsfileRepository: DevMadhup/Wanderlust-Mega-Project Length of output: 716 🏁 Script executed: # Check Argo-cd/Jenkinsfile around lines 5-8
wc -l ./Argo-cd/Jenkinsfile
echo "---"
sed -n '1,20p' ./Argo-cd/JenkinsfileRepository: DevMadhup/Wanderlust-Mega-Project Length of output: 672 🏁 Script executed: # Search for references to FRONTEND_DOCKER_TAG and BACKEND_DOCKER_TAG in the codebase
rg "FRONTEND_DOCKER_TAG|BACKEND_DOCKER_TAG" -nRepository: DevMadhup/Wanderlust-Mega-Project Length of output: 1074 🏁 Script executed: # Search for references to "Wanderlust-CD" and any webhook/trigger configurations
rg "Wanderlust-CD|webhook|trigger|parameterized" -i -nRepository: DevMadhup/Wanderlust-Mega-Project Length of output: 344 The CI→CD handoff is currently broken. Lines 102-109 comment out the only mechanism that supplied 🤖 Prompt for AI Agents |
||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,10 +1,10 @@ | ||
| MONGODB_URI="mongodb://mongo-service/wanderlust" | ||
| MONGODB_URI="mongodb://mongo-service:27017/wanderlust" | ||
| REDIS_URL="redis://redis-service:6379" | ||
| PORT=8080 | ||
| FRONTEND_URL="http://34.213.249.66:5173" | ||
| FRONTEND_URL="http://34.213.249.66:31000" | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This In the provided backend wiring, 🧰 Tools🪛 dotenv-linter (4.0.0)[warning] 4-4: [QuoteCharacter] The value has quote characters (', ") (QuoteCharacter) [warning] 4-4: [UnorderedKey] The FRONTEND_URL key should go before the MONGODB_URI key (UnorderedKey) 🤖 Prompt for AI Agents |
||
| ACCESS_COOKIE_MAXAGE=120000 | ||
| ACCESS_TOKEN_EXPIRES_IN='120s' | ||
| REFRESH_COOKIE_MAXAGE=120000 | ||
| REFRESH_TOKEN_EXPIRES_IN='120s' | ||
| JWT_SECRET=70dd8b38486eee723ce2505f6db06f1ee503fde5eb06fc04687191a0ed665f3f98776902d2c89f6b993b1c579a87fedaf584c693a106f7cbf16e8b4e67e9d6df | ||
| NODE_ENV=Development | ||
| NODE_ENV=Development | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chain🏁 Script executed: # Find and check if backend/.env.docker exists
find . -type f -name ".env.docker" | head -20Repository: DevMadhup/Wanderlust-Mega-Project Length of output: 121 🏁 Script executed: # List files in backend directory to understand structure
ls -la backend/ 2>/dev/null | head -20Repository: DevMadhup/Wanderlust-Mega-Project Length of output: 1260 🏁 Script executed: # Check if Dockerfile exists in backend directory
ls -la backend/Dockerfile* 2>/dev/nullRepository: DevMadhup/Wanderlust-Mega-Project Length of output: 143 🏁 Script executed: # Read the backend/.env.docker file with line numbers
cat -n backend/.env.dockerRepository: DevMadhup/Wanderlust-Mega-Project Length of output: 573 🏁 Script executed: # Read the backend/Dockerfile with line numbers to check line 25
cat -n backend/DockerfileRepository: DevMadhup/Wanderlust-Mega-Project Length of output: 657 🌐 Web query:
💡 Result: In Node.js, access to environment variables via process.env is case-sensitive on Unix-like systems (Linux, macOS) and case-insensitive on Windows. This behavior mirrors the underlying operating system's handling of environment variables. NODE_ENV specifically follows this pattern: process.env.NODE_ENV === process.env.node_env on Windows (both return the value if set), but on Unix, process.env.node_env is undefined if only NODE_ENV is set. This is intentional Node.js behavior, tested since v6 (commit 1d79af6), using Windows APIs like GetEnvironmentVariableW which perform case-insensitive lookups. Official Node.js process documentation confirms: "On Windows operating systems, environment variables are case-insensitive." with example: env.TEST = 1; console.log(env.test); // => 1 Note: In worker threads prior to recent fixes, behavior differed on Windows, but main thread access is consistent. .env files and dotenv parse keys case-sensitively before assigning to process.env. For cross-platform code, always use consistent casing (convention: uppercase like NODE_ENV) to avoid issues. Citations:
🌐 Web query:
💡 Result: In Node.js, there is no official standard or enforced set of values for the NODE_ENV environment variable. Node.js core does not define or use NODE_ENV specifically; it treats all environment variables as arbitrary strings via process.env. NODE_ENV is a community convention popularized by frameworks like Express.js and libraries in the npm ecosystem. Standard conventional values (all lowercase): - 'production': Optimizes libraries for performance (e.g., Express caching, less verbose errors). - 'development': Enables debugging features in many libraries (default assumption if unset in some contexts). - 'test': Commonly used for testing environments. 'development' (lowercase) vs 'Development' (title case): All authoritative sources and examples use lowercase 'development'. No sources recommend or show title case 'Development' as standard. Using title case would not trigger expected behaviors in libraries checking for exact string matches like === 'development' or === 'production', potentially causing apps to fall back to development mode or undefined behavior. Environment variable values are case-sensitive strings. Official Node.js docs confirm no special handling for NODE_ENV and note some libraries default to 'development' if unset. Node.js guides recommend always setting NODE_ENV=production (lowercase) everywhere for consistency, even in development/testing, to avoid antipatterns where behavior changes based on the value. Examples: - Official Node.js: NODE_ENV=production - Express convention: if (process.env.NODE_ENV === 'production') - package.json scripts: "start": "NODE_ENV=production node app.js" Best practice: Use lowercase strings matching library expectations. Avoid setting from within code; set externally (CLI, .env files, deployment configs). Citations:
Use lowercase Line 10 sets 🧰 Tools🪛 dotenv-linter (4.0.0)[warning] 10-10: [EndingBlankLine] No blank line at the end of the file (EndingBlankLine) [warning] 10-10: [UnorderedKey] The NODE_ENV key should go before the PORT key (UnorderedKey) 🤖 Prompt for AI Agents |
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -28,4 +28,4 @@ COPY .env.docker .env | |
| EXPOSE 8080 | ||
|
|
||
| # App | ||
| CMD ["npm", "start"] | ||
| CMD ["npm", "start"] | ||
This file was deleted.
This file was deleted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 Analysis chain
🏁 Script executed:
Repository: DevMadhup/Wanderlust-Mega-Project
Length of output: 112
🏁 Script executed:
Repository: DevMadhup/Wanderlust-Mega-Project
Length of output: 4039
🏁 Script executed:
Repository: DevMadhup/Wanderlust-Mega-Project
Length of output: 225
🏁 Script executed:
Repository: DevMadhup/Wanderlust-Mega-Project
Length of output: 95
🏁 Script executed:
Repository: DevMadhup/Wanderlust-Mega-Project
Length of output: 816
🏁 Script executed:
Repository: DevMadhup/Wanderlust-Mega-Project
Length of output: 1012
🏁 Script executed:
Repository: DevMadhup/Wanderlust-Mega-Project
Length of output: 232
Hardcoded
masterbranch checkout conflicts with repository's defaultmainbranch.Line 23 hardcodes
code_clone("...","master")while the repository's default branch ismain(confirmed in git config). This causes PR builds andmainbranch builds to checkout the wrong commit, leading to incorrect scans, builds, and image pushes. Usecheckout scminstead to dynamically track the triggering revision.Recommended fix
Note: The same issue exists in
Argo-cd/Jenkinsfileat line 23.🤖 Prompt for AI Agents