Compare commits
2
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6cee97faa6 | ||
|
|
570f024fa2 |
@@ -0,0 +1,126 @@
|
||||
pipeline {
|
||||
agent any
|
||||
|
||||
options {
|
||||
disableConcurrentBuilds()
|
||||
skipDefaultCheckout(true)
|
||||
timeout(time: 10, unit: 'MINUTES')
|
||||
buildDiscarder(logRotator(
|
||||
numToKeepStr: '5',
|
||||
artifactNumToKeepStr: '3'
|
||||
))
|
||||
}
|
||||
|
||||
stages {
|
||||
stage('Checkout') {
|
||||
steps {
|
||||
checkout scm
|
||||
sh 'git log -1 --oneline'
|
||||
}
|
||||
}
|
||||
|
||||
stage('Verify Build Tools') {
|
||||
steps {
|
||||
sh '''
|
||||
node --version
|
||||
npm --version
|
||||
python3 --version
|
||||
'''
|
||||
}
|
||||
}
|
||||
|
||||
stage('JavaScript Validation') {
|
||||
steps {
|
||||
dir('app') {
|
||||
sh 'npm run check'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
stage('JavaScript Unit Tests') {
|
||||
steps {
|
||||
dir('app') {
|
||||
sh 'npm test'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
stage('Python Validation') {
|
||||
steps {
|
||||
dir('pricing-service') {
|
||||
sh '''
|
||||
python3 -m py_compile app.py test_app.py
|
||||
echo "Python syntax validation PASSED"
|
||||
'''
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
stage('Versioned Package') {
|
||||
steps {
|
||||
sh '''
|
||||
set -eu
|
||||
|
||||
VERSION="1.0.${BUILD_NUMBER}"
|
||||
|
||||
mkdir -p dist
|
||||
printf '%s\\n' "$VERSION" > dist/VERSION
|
||||
git rev-parse HEAD > dist/COMMIT
|
||||
|
||||
python3 -m zipfile -c \
|
||||
"dist/startup-product-${VERSION}.zip" \
|
||||
app/package.json \
|
||||
app/src \
|
||||
app/test \
|
||||
pricing-service/app.py \
|
||||
pricing-service/test_app.py \
|
||||
pricing-service/requirements.txt \
|
||||
pricing-service/Dockerfile \
|
||||
dist/VERSION \
|
||||
dist/COMMIT
|
||||
|
||||
echo "Package version: $VERSION"
|
||||
ls -lh dist/
|
||||
'''
|
||||
}
|
||||
}
|
||||
|
||||
stage('Verify Package Integrity') {
|
||||
steps {
|
||||
sh '''
|
||||
set -eu
|
||||
|
||||
python3 -m zipfile -t \
|
||||
"dist/startup-product-1.0.${BUILD_NUMBER}.zip"
|
||||
|
||||
echo "Package integrity PASSED"
|
||||
'''
|
||||
}
|
||||
}
|
||||
|
||||
stage('Archive Artifacts') {
|
||||
steps {
|
||||
archiveArtifacts(
|
||||
artifacts: 'dist/*',
|
||||
fingerprint: true,
|
||||
onlyIfSuccessful: true
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
post {
|
||||
success {
|
||||
echo 'FINAL PROJECT BASELINE BUILD PASSED'
|
||||
}
|
||||
|
||||
failure {
|
||||
echo 'FINAL PROJECT BASELINE BUILD FAILED'
|
||||
}
|
||||
|
||||
always {
|
||||
echo "Build number: ${env.BUILD_NUMBER}"
|
||||
echo "Build URL: ${env.BUILD_URL}"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -15,3 +15,10 @@ test("reports unhealthy when database is disconnected", () => {
|
||||
database: "disconnected"
|
||||
});
|
||||
});
|
||||
|
||||
test("reports unhealthy when database status is missing", () => {
|
||||
assert.deepEqual(getHealthStatus(), {
|
||||
status: "unhealthy",
|
||||
database: "disconnected"
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user