Complete secure production delivery with restricted approvals and deployment evidence
startup-product-gitea-ci/pipeline/pr-main Build queued...
startup-product-gitea-ci/pipeline/pr-main Build queued...
This commit is contained in:
@@ -61,9 +61,18 @@ pipeline {
|
|||||||
set -eu
|
set -eu
|
||||||
export PATH=/opt/homebrew/bin:$PATH
|
export PATH=/opt/homebrew/bin:$PATH
|
||||||
export UV_CACHE_DIR="$WORKSPACE/.uv-cache"
|
export UV_CACHE_DIR="$WORKSPACE/.uv-cache"
|
||||||
uv tool run --from pip-audit==2.10.1 pip-audit --disable-pip -r pricing-service/requirements-production.lock.txt
|
uv tool run --from pip-audit==2.10.1 pip-audit --disable-pip -r pricing-service/requirements-production.lock.txt > pip-audit-report.txt 2>&1 || {
|
||||||
|
cat pip-audit-report.txt
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
cat pip-audit-report.txt
|
||||||
'''
|
'''
|
||||||
}
|
}
|
||||||
|
post {
|
||||||
|
always {
|
||||||
|
archiveArtifacts artifacts: 'pip-audit-report.txt', allowEmptyArchive: false
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
stage('Container Security Gate') {
|
stage('Container Security Gate') {
|
||||||
steps {
|
steps {
|
||||||
@@ -103,19 +112,80 @@ pipeline {
|
|||||||
stage('Production Approval') {
|
stage('Production Approval') {
|
||||||
steps {
|
steps {
|
||||||
timeout(time: 30, unit: 'MINUTES') {
|
timeout(time: 30, unit: 'MINUTES') {
|
||||||
input message: 'Approve Chapter 6 production promotion?',
|
script {
|
||||||
|
def approver = input(
|
||||||
|
message: 'Approve Chapter 6 production promotion?',
|
||||||
ok: 'Approve Production',
|
ok: 'Approve Production',
|
||||||
submitter: 'chapter6-approver',
|
submitter: 'chapter6-approver',
|
||||||
submitterParameter: 'APPROVED_BY'
|
submitterParameter: 'APPROVED_BY'
|
||||||
|
)
|
||||||
|
if (approver != 'chapter6-approver') {
|
||||||
|
error('Production approval requires the designated approver')
|
||||||
|
}
|
||||||
|
echo "Production approved by: ${approver}"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
stage('Server Authorization') {
|
||||||
|
steps {
|
||||||
|
timeout(time: 10, unit: 'MINUTES') {
|
||||||
|
input message: 'Administrator: confirm server-side authorization is ready',
|
||||||
|
ok: 'Authorization Ready',
|
||||||
|
submitter: 'chapter6-approver'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
stage('Production Promotion') {
|
||||||
|
steps {
|
||||||
|
sh '''
|
||||||
|
set -eu
|
||||||
|
date -u > production-promotion.txt
|
||||||
|
|
||||||
|
ssh -o BatchMode=yes -o IdentitiesOnly=yes -o StrictHostKeyChecking=yes -o ConnectTimeout=10 -i "$HOME/.ssh/chapter6_deploy" chapter6deploy@git.nageshwaran.dev promote-production >> production-promotion.txt 2>&1 || {
|
||||||
|
cat production-promotion.txt
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
|
cat production-promotion.txt
|
||||||
|
date -u
|
||||||
|
'''
|
||||||
|
}
|
||||||
|
post {
|
||||||
|
always {
|
||||||
|
archiveArtifacts artifacts: 'production-promotion.txt', allowEmptyArchive: false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
stage('Production HTTPS Verification') {
|
||||||
|
steps {
|
||||||
|
sh '''
|
||||||
|
set -eu
|
||||||
|
date -u > production-verification.txt
|
||||||
|
curl -fsS --max-time 10 https://pricing.nageshwaran.dev/health > production-health.json
|
||||||
|
curl -fsS --max-time 10 https://pricing.nageshwaran.dev/pricing > production-pricing.json
|
||||||
|
|
||||||
|
python3 -c 'import json; h=json.load(open("production-health.json")); p=json.load(open("production-pricing.json")); assert h["status"]=="healthy" and h["version"]=="v2"; assert p["version"]=="v2"; assert {x["name"]:x["price"] for x in p["plans"]}=={"Starter":5,"Basic":12,"Pro":30,"Enterprise":60}'
|
||||||
|
|
||||||
|
cat production-health.json production-pricing.json >> production-verification.txt
|
||||||
|
echo "SUCCESS: Production HTTPS smoke tests passed" >> production-verification.txt
|
||||||
|
cat production-verification.txt
|
||||||
|
'''
|
||||||
|
}
|
||||||
|
post {
|
||||||
|
always {
|
||||||
|
archiveArtifacts artifacts: 'production-verification.txt,production-health.json,production-pricing.json', allowEmptyArchive: true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
post {
|
post {
|
||||||
success {
|
success {
|
||||||
echo 'CI PASSED: Node.js tests and staging smoke tests completed.'
|
echo 'DELIVERY PASSED: Security gates, approval, production promotion and HTTPS verification completed.'
|
||||||
}
|
}
|
||||||
|
|
||||||
failure {
|
failure {
|
||||||
|
|||||||
Reference in New Issue
Block a user