Compare commits
15 Commits
15ad26c505
..
prod
| Author | SHA1 | Date | |
|---|---|---|---|
| 3be0d38cf1 | |||
| a0e56f6a89 | |||
| 7cf7246abd | |||
| 8885e288ed | |||
| a888636487 | |||
| dad46d788d | |||
| 3619e33f44 | |||
| cf8e3b880c | |||
| a6e48d6b2b | |||
| 06a64fa018 | |||
| 1bec713692 | |||
| cea6d218f8 | |||
| 9065626d40 | |||
| 3dbecd171f | |||
| bdba683f00 |
Vendored
+113
@@ -0,0 +1,113 @@
|
|||||||
|
pipeline {
|
||||||
|
|
||||||
|
agent none
|
||||||
|
|
||||||
|
options {
|
||||||
|
buildDiscarder(logRotator(numToKeepStr: '10'))
|
||||||
|
}
|
||||||
|
|
||||||
|
environment {
|
||||||
|
DEPLOY_PATH = getDeployPath()
|
||||||
|
ENV_FILE_ID = getEnvFileId()
|
||||||
|
TARGET_URL = getHealthUrl()
|
||||||
|
}
|
||||||
|
|
||||||
|
stages {
|
||||||
|
|
||||||
|
stage('Checkout') {
|
||||||
|
agent { label getAgentLabel() }
|
||||||
|
steps {
|
||||||
|
checkout scm
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
stage('Inject Environment File') {
|
||||||
|
agent { label getAgentLabel() }
|
||||||
|
steps {
|
||||||
|
configFileProvider(
|
||||||
|
[configFile(
|
||||||
|
fileId: ENV_FILE_ID,
|
||||||
|
targetLocation: 'src/environments/environment.ts',
|
||||||
|
replaceTokens: true
|
||||||
|
)]
|
||||||
|
) {
|
||||||
|
echo "Environment file injected for ${env.BRANCH_NAME}"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
stage('Build Angular') {
|
||||||
|
agent { label getAgentLabel() }
|
||||||
|
steps {
|
||||||
|
sh '''
|
||||||
|
npm install
|
||||||
|
ng build --configuration production --base-href /admin/
|
||||||
|
'''
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
stage('Deploy') {
|
||||||
|
agent { label getAgentLabel() }
|
||||||
|
steps {
|
||||||
|
sh '''
|
||||||
|
rm -rf $DEPLOY_PATH/*
|
||||||
|
cp -r dist/portfolio-admin/browser/* $DEPLOY_PATH/
|
||||||
|
sudo /usr/bin/systemctl reload nginx
|
||||||
|
'''
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
stage('Health Check') {
|
||||||
|
agent { label getAgentLabel() }
|
||||||
|
steps {
|
||||||
|
sh """
|
||||||
|
sleep 2
|
||||||
|
curl -f ${TARGET_URL}
|
||||||
|
"""
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
post {
|
||||||
|
failure {
|
||||||
|
echo "Deployment failed!"
|
||||||
|
}
|
||||||
|
success {
|
||||||
|
echo "Deployment successful!"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// -------- Helper Methods --------
|
||||||
|
|
||||||
|
def getAgentLabel() {
|
||||||
|
if (env.BRANCH_NAME == 'prod') {
|
||||||
|
return 'oracle-node'
|
||||||
|
} else {
|
||||||
|
return 'built-in' // for develop
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
def getEnvFileId() {
|
||||||
|
if (env.BRANCH_NAME == 'prod') {
|
||||||
|
return 'admin-prod-properties'
|
||||||
|
} else {
|
||||||
|
return 'admin-uat-properties'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
def getDeployPath() {
|
||||||
|
if (env.BRANCH_NAME == 'prod') {
|
||||||
|
return "/var/www/bangararaju.kottedi.in/admin"
|
||||||
|
} else {
|
||||||
|
return "/var/www/bangararaju.kottedi.in/admin"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
def getHealthUrl() {
|
||||||
|
if (env.BRANCH_NAME == 'prod') {
|
||||||
|
return "https://bangararaju.kottedi.in/admin"
|
||||||
|
} else {
|
||||||
|
return "https://bangararaju-uat.kottedi.in/admin"
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -2,11 +2,11 @@
|
|||||||
<div class="verify-card">
|
<div class="verify-card">
|
||||||
|
|
||||||
@if(!isOtpSent()){
|
@if(!isOtpSent()){
|
||||||
<h2 class="title">🔐 Login</h2>
|
<h2 class="title">🔐 Login</h2>
|
||||||
}
|
}
|
||||||
|
|
||||||
@if(isOtpSent() && !isVerified()){
|
@if(isOtpSent() && !isVerified()){
|
||||||
<h2 class="title">🔐 OTP Verification</h2>
|
<h2 class="title">🔐 OTP Verification</h2>
|
||||||
}
|
}
|
||||||
|
|
||||||
<!-- Step 1: Enter Email -->
|
<!-- Step 1: Enter Email -->
|
||||||
@@ -21,19 +21,9 @@
|
|||||||
<!-- Step 2: OTP Input -->
|
<!-- Step 2: OTP Input -->
|
||||||
@if (isOtpSent() && !isVerified()) {
|
@if (isOtpSent() && !isVerified()) {
|
||||||
<div class="otp-section">
|
<div class="otp-section">
|
||||||
<p class="info-text">
|
|
||||||
OTP sent to <b>{{ emailForm.value.email }}</b>
|
|
||||||
</p>
|
|
||||||
|
|
||||||
<form [formGroup]="otpForm" (ngSubmit)="verifyOtp()">
|
<form [formGroup]="otpForm" (ngSubmit)="verifyOtp()">
|
||||||
<label for="otp">Enter 6-digit OTP</label>
|
<label for="otp">Enter 6-digit OTP</label>
|
||||||
<input id="otp" type="text" maxlength="6" formControlName="otp" placeholder="123456" />
|
<input id="otp" type="text" maxlength="6" formControlName="otp" placeholder="123456" />
|
||||||
@if (isError()) {
|
|
||||||
<div class="error-banner">
|
|
||||||
<i class="fa-solid fa-circle-exclamation"></i>
|
|
||||||
<span>{{ message() }}</span>
|
|
||||||
</div>
|
|
||||||
}
|
|
||||||
<button type="submit" [disabled]="otpForm.invalid">
|
<button type="submit" [disabled]="otpForm.invalid">
|
||||||
Verify OTP
|
Verify OTP
|
||||||
</button>
|
</button>
|
||||||
@@ -47,5 +37,19 @@
|
|||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@if (isError()) {
|
||||||
|
<div class="error-banner">
|
||||||
|
<i class="fa-solid fa-circle-exclamation"></i>
|
||||||
|
<span>{{ message() }}</span>
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
|
||||||
|
@if (!isError() && isOtpSent() && !isVerified()) {
|
||||||
|
<div class="success-banner">
|
||||||
|
<i class="fa-solid fa-circle-check"></i>
|
||||||
|
<span>{{ message() }}</span>
|
||||||
|
</div>
|
||||||
|
}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -170,4 +170,24 @@ button {
|
|||||||
color: #ccc;
|
color: #ccc;
|
||||||
font-size: 14px;
|
font-size: 14px;
|
||||||
margin-bottom: 10px;
|
margin-bottom: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Success banner for OTP sent */
|
||||||
|
.success-banner {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 8px;
|
||||||
|
background: rgba(120, 255, 140, 0.07);
|
||||||
|
border: 1px solid rgba(120, 255, 140, 0.25);
|
||||||
|
border-radius: 8px;
|
||||||
|
padding: 10px 14px;
|
||||||
|
margin: 10px 0 10px;
|
||||||
|
color: #78ff8c;
|
||||||
|
font-size: 13px;
|
||||||
|
|
||||||
|
i {
|
||||||
|
font-size: 15px;
|
||||||
|
flex-shrink: 0;
|
||||||
|
color: #78ff8c;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -48,15 +48,27 @@ export class OtpComponent implements OnInit {
|
|||||||
if (this.emailForm.invalid) return;
|
if (this.emailForm.invalid) return;
|
||||||
const email = this.emailForm.value.email;
|
const email = this.emailForm.value.email;
|
||||||
|
|
||||||
this.authService.sendOtp(email).subscribe(() => {
|
this.authService.sendOtp(email).subscribe({
|
||||||
this.isOtpSent.set(true);
|
next: () => {
|
||||||
this.message.set('OTP sent successfully!');
|
this.isOtpSent.set(true);
|
||||||
this.startTimer(30); // 30 seconds countdown
|
this.isError.set(false);
|
||||||
|
this.message.set(`OTP sent to ${email}.`);
|
||||||
|
this.startTimer(30); // 30 seconds countdown
|
||||||
|
},
|
||||||
|
error: (err) => {
|
||||||
|
this.isError.set(true);
|
||||||
|
if (err.status === 404) {
|
||||||
|
this.message.set('Email not found. Please check and try again.');
|
||||||
|
} else {
|
||||||
|
this.message.set('Failed to send OTP. Please try again.');
|
||||||
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
resendOtp() {
|
resendOtp() {
|
||||||
if (this.countdown() > 0) return;
|
if (this.countdown() > 0) return;
|
||||||
|
this.otpForm.reset();
|
||||||
this.sendOtp();
|
this.sendOtp();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user