Skip to content
Open
Show file tree
Hide file tree
Changes from all 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
37 changes: 37 additions & 0 deletions Jenkins Shared-Liabrary
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
@Library('Shared-Liabrary') _
pipeline{
agent { label 'Shared-Liabrary' }
Comment on lines +1 to +3
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Fix the typo in the shared library name.

The library name "Shared-Liabrary" contains a typo - it should be "Shared-Library". This typo appears in both the library import and agent label, which will cause the pipeline to fail.

Apply this diff to fix the typo:

-@Library('Shared-Liabrary') _
+@Library('Shared-Library') _
 pipeline{
-    agent { label 'Shared-Liabrary' }
+    agent { label 'Shared-Library' }
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
@Library('Shared-Liabrary') _
pipeline{
agent { label 'Shared-Liabrary' }
@Library('Shared-Library') _
pipeline{
agent { label 'Shared-Library' }
🤖 Prompt for AI Agents
In Jenkins Shared-Liabrary file at lines 1 to 3, fix the typo in the shared
library name by changing "Shared-Liabrary" to "Shared-Library" in both the
@Library annotation and the agent label to ensure the pipeline references the
correct library and runs successfully.

stages{
stage('clone'){
steps{
code_clone('https://github.com/abhishek26w/node-todo-cicd.git','master')

}
}

stage('build'){
steps{
docker_build('node-apk','latest')
}
}

stage('Test'){
steps{
echo "Tested Successfully"
}
}
Comment on lines +18 to +22
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Implement actual testing or document as placeholder.

The test stage only echoes a success message without running any actual tests. This defeats the purpose of having a test stage in a CI/CD pipeline.

Consider implementing actual tests:

         stage('Test'){
             steps{
-                echo "Tested Successfully"
+                script {
+                    // Run unit tests
+                    sh 'npm test'
+                    // Or if using Docker for testing
+                    // sh 'docker run --rm node-apk:latest npm test'
+                }
             }
         }

Alternatively, if this is intentionally a placeholder, add a comment to clarify:

         stage('Test'){
             steps{
+                // TODO: Implement actual tests
                 echo "Tested Successfully"
             }
         }
🤖 Prompt for AI Agents
In Jenkins Shared-Liabrary around lines 18 to 22, the 'Test' stage only echoes a
success message without running any real tests, which is not useful for CI/CD
validation. Replace the echo statement with actual test commands relevant to the
project, such as running unit tests or integration tests. If this stage is a
placeholder, add a clear comment indicating that actual tests will be
implemented later to avoid confusion.


stage('Push to DockerHUb'){
steps{
docker_push('DOCKER-USER','node-apk','latest')
}
}

stage('Deploy'){
steps{
docker_compose()

}
}
Comment on lines +30 to +35
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick (assertive)

LGTM - Consider adding deployment configuration clarity.

The Docker Compose deployment stage is properly structured. Consider documenting which Docker Compose file is used and the deployment target if not obvious from the shared library implementation.

🤖 Prompt for AI Agents
In Jenkins Shared-Liabrary around lines 30 to 35, the deployment stage uses
docker_compose() without specifying which Docker Compose file or deployment
target is used. To improve clarity, add comments or documentation in this stage
indicating the exact Docker Compose file being applied and the deployment
environment or target, so users of the shared library understand the deployment
context clearly.

}
}
230 changes: 122 additions & 108 deletions views/todo.ejs
Original file line number Diff line number Diff line change
@@ -1,111 +1,125 @@
<!DOCTYPE html>
<html lang="en">
<head>
<title>Todo List APP test</title>
<style>
body {
font-family: Arial, sans-serif;
background-color: #f4f4f4;
color: #333;
margin: 0;
padding: 0;
}

h1 {
background-color: #4CAF50;
color: white;
margin: 0;
padding: 20px;
text-align: center;
}

ul {
list-style: none;
padding: 0;
}

ul li {
background: #fff;
border: 1px solid #ddd;
margin-bottom: 10px;
padding: 10px;
position: relative;
}

ul li a {
color: #333;
text-decoration: none;
font-weight: bold;
}

ul li a:hover {
color: #4CAF50;
}

.delete-btn {
color: red;
position: absolute;
right: 10px;
top: 10px;
}

.edit-btn {
color: #FFC107;
position: absolute;
right: 40px;
top: 10px;
}

form {
background: #fff;
padding: 20px;
margin-top: 20px;
}

label {
display: block;
margin-bottom: 10px;
}

input[type="text"] {
width: 100%;
padding: 10px;
margin-bottom: 10px;
border: 1px solid #ddd;
}

input[type="submit"] {
background-color: #4CAF50;
color: white;
border: none;
padding: 10px 20px;
cursor: pointer;
}

input[type="submit"]:hover {
background-color: #45a049;
}
</style>
</head>

<body>
<h1>Hello Junoon Batch 8 (Jenkins), Write your plan on Learning Jenkins</h1>
<ul>
<% todolist.forEach(function(todo, index) { %>
<li>
<a href="/todo/delete/<%= index %>" class="delete-btn">✘</a>
<a href="/todo/<%= index %>" class="edit-btn">✎</a>
<%- todo %>
</li>
<% }); %>
</ul>

<form action="/todo/add/" method="post">
<p>
<label for="newtodo">What should I do?</label>
<input type="text" name="newtodo" id="newtodo" autofocus />
<input type="submit" value="Add" />
</p>
</form>
</body>
<head>
<title>Todo List APP - DevOps CI/CD</title>
<style>
body {
font-family: Arial, sans-serif;
background-color: #f4f4f4;
color: #333;
margin: 0;
padding: 0;
}

.header {
background-color: #4CAF50;
color: white;
padding: 20px;
text-align: center;
}

.header h1 {
margin: 0;
font-size: 32px;
}

.header p {
margin-top: 10px;
font-size: 18px;
}

ul {
list-style: none;
padding: 0;
}

ul li {
background: #fff;
border: 1px solid #ddd;
margin-bottom: 10px;
padding: 10px;
position: relative;
}

ul li a {
color: #333;
text-decoration: none;
font-weight: bold;
}

ul li a:hover {
color: #4CAF50;
}

.delete-btn {
color: red;
position: absolute;
right: 10px;
top: 10px;
}

.edit-btn {
color: #FFC107;
position: absolute;
right: 40px;
top: 10px;
}

form {
background: #fff;
padding: 20px;
margin-top: 20px;
}

label {
display: block;
margin-bottom: 10px;
}

input[type="text"] {
width: 100%;
padding: 10px;
margin-bottom: 10px;
border: 1px solid #ddd;
}

input[type="submit"] {
background-color: #4CAF50;
color: white;
border: none;
padding: 10px 20px;
cursor: pointer;
}

input[type="submit"]:hover {
background-color: #45a049;
}
</style>
</head>
<body>

<div class="header">
<h1>🚀 Welcome to the DevOps CI/CD Pipeline Workshop</h1>
<p>Empowering Junoon Batch 8 to master automation using Jenkins!</p>
</div>

<ul>
<% todolist.forEach(function(todo, index) { %>
<li>
<a href="/todo/delete/<%= index %>" class="delete-btn">✘</a>
<a href="/todo/<%= index %>" class="edit-btn">✎</a>
<%- todo %>
</li>
<% }); %>
</ul>

<form action="/todo/add/" method="post">
<p>
<label for="newtodo">What should I do?</label>
<input type="text" name="newtodo" id="newtodo" autofocus />
<input type="submit" value="Add" />
</p>
</form>

</body>
</html>