Add Secrets and Rundeck stages

This commit is contained in:
sacha 2026-01-20 22:54:45 +00:00
parent c9121b4d5c
commit df09ffa0da
1 changed files with 39 additions and 1 deletions

40
Jenkinsfile vendored
View File

@ -4,6 +4,8 @@ pipeline {
environment { environment {
APP_NAME = 'devops-test' APP_NAME = 'devops-test'
VERSION = '1.0.0' VERSION = '1.0.0'
RUNDECK_URL = 'http://rundeck:4440'
RUNDECK_PROJECT = 'devops-test'
} }
stages { stages {
@ -14,12 +16,30 @@ pipeline {
} }
} }
stage('Secrets') {
steps {
echo "🔐 Retrieving secrets from Vaultwarden..."
script {
// Mount the scripts directory and run bw
sh '''
if [ -f /opt/scripts/init-bw-session.sh ]; then
echo "Loading Bitwarden session..."
# Note: For production, configure Jenkins credentials properly
echo "Secrets module available"
else
echo "Bitwarden scripts not mounted, skipping..."
fi
'''
}
}
}
stage('Validate') { stage('Validate') {
steps { steps {
echo "🔍 Validating scripts..." echo "🔍 Validating scripts..."
sh 'ls -la' sh 'ls -la'
sh 'chmod +x app.sh' sh 'chmod +x app.sh'
sh 'bash -n app.sh' // Syntax check sh 'bash -n app.sh'
} }
} }
@ -39,6 +59,24 @@ pipeline {
echo " Branch: ${GIT_BRANCH}" echo " Branch: ${GIT_BRANCH}"
} }
} }
stage('Deploy via Rundeck') {
when {
branch 'main'
}
steps {
echo "🚀 Triggering Rundeck deployment..."
script {
// Trigger Rundeck job via API
sh '''
echo "Deployment would be triggered here"
echo "Rundeck URL: ${RUNDECK_URL}"
echo "Project: ${RUNDECK_PROJECT}"
# curl -X POST "${RUNDECK_URL}/api/41/job/JOB_ID/run" ...
'''
}
}
}
} }
post { post {