automated terminal push

This commit is contained in:
lenape
2025-08-05 19:37:59 +00:00
parent 8461e3032c
commit 2a4f45432c

View File

@@ -37,6 +37,7 @@ pipeline {
environment { environment {
PROJECT_NAME = 'nvhi-atsila-microservice' PROJECT_NAME = 'nvhi-atsila-microservice'
AWS_CREDENTIALS = 'aws-ci' AWS_CREDENTIALS = 'aws-ci'
AWS_ACCOUNT_ID_CREDENTIAL = 'AWS_ACCOUNT_ID'
AWS_REGION_CREDENTIAL = 'AWS_REGION' AWS_REGION_CREDENTIAL = 'AWS_REGION'
SONAR_PROJECT_KEY = 'nvhi-atsila-microservice-services' SONAR_PROJECT_KEY = 'nvhi-atsila-microservice-services'
DOCKER_BUILDKIT = '1' DOCKER_BUILDKIT = '1'
@@ -114,10 +115,13 @@ pipeline {
// Verify AWS credentials // Verify AWS credentials
withCredentials([ withCredentials([
string(credentialsId: env.AWS_CREDENTIALS, variable: 'AWS_ACCESS_KEY_ID'), [$class: 'AmazonWebServicesCredentialsBinding',
string(credentialsId: 'aws-secret', variable: 'AWS_SECRET_ACCESS_KEY'), credentialsId: 'aws-ci',
string(credentialsId: env.AWS_REGION_CREDENTIAL, variable: 'AWS_REGION') accessKeyVariable: 'AWS_ACCESS_KEY_ID',
]) { secretKeyVariable: 'AWS_SECRET_ACCESS_KEY'],
string(credentialsId: 'AWS_ACCOUNT_ID', variable: 'AWS_ACCOUNT_ID'),
string(credentialsId: 'AWS_REGION', variable: 'AWS_REGION')
])
sh ''' sh '''
echo "AWS CLI version:" echo "AWS CLI version:"
aws --version aws --version
@@ -231,10 +235,13 @@ with app.test_client() as client:
} }
steps { steps {
withCredentials([ withCredentials([
string(credentialsId: env.AWS_CREDENTIALS, variable: 'AWS_ACCESS_KEY_ID'), [$class: 'AmazonWebServicesCredentialsBinding',
string(credentialsId: 'aws-secret', variable: 'AWS_SECRET_ACCESS_KEY'), credentialsId: 'aws-ci',
string(credentialsId: env.AWS_REGION_CREDENTIAL, variable: 'AWS_REGION') accessKeyVariable: 'AWS_ACCESS_KEY_ID',
]) { secretKeyVariable: 'AWS_SECRET_ACCESS_KEY'],
string(credentialsId: 'AWS_ACCOUNT_ID', variable: 'AWS_ACCOUNT_ID'),
string(credentialsId: 'AWS_REGION', variable: 'AWS_REGION')
])
script { script {
sh ''' sh '''
echo "=== Docker Build & Push ===" echo "=== Docker Build & Push ==="
@@ -294,9 +301,12 @@ with app.test_client() as client:
steps { steps {
dir('infrastructure/services') { dir('infrastructure/services') {
withCredentials([ withCredentials([
string(credentialsId: env.AWS_CREDENTIALS, variable: 'AWS_ACCESS_KEY_ID'), [$class: 'AmazonWebServicesCredentialsBinding',
string(credentialsId: 'aws-secret', variable: 'AWS_SECRET_ACCESS_KEY'), credentialsId: 'aws-ci',
string(credentialsId: env.AWS_REGION_CREDENTIAL, variable: 'AWS_REGION') accessKeyVariable: 'AWS_ACCESS_KEY_ID',
secretKeyVariable: 'AWS_SECRET_ACCESS_KEY'],
string(credentialsId: 'AWS_ACCOUNT_ID', variable: 'AWS_ACCOUNT_ID'),
string(credentialsId: 'AWS_REGION', variable: 'AWS_REGION')
]) { ]) {
script { script {
sh ''' sh '''
@@ -329,10 +339,13 @@ EOF
steps { steps {
dir('infrastructure/services') { dir('infrastructure/services') {
withCredentials([ withCredentials([
string(credentialsId: env.AWS_CREDENTIALS, variable: 'AWS_ACCESS_KEY_ID'), [$class: 'AmazonWebServicesCredentialsBinding',
string(credentialsId: 'aws-secret', variable: 'AWS_SECRET_ACCESS_KEY'), credentialsId: 'aws-ci',
string(credentialsId: env.AWS_REGION_CREDENTIAL, variable: 'AWS_REGION') accessKeyVariable: 'AWS_ACCESS_KEY_ID',
]) { secretKeyVariable: 'AWS_SECRET_ACCESS_KEY'],
string(credentialsId: 'AWS_ACCOUNT_ID', variable: 'AWS_ACCOUNT_ID'),
string(credentialsId: 'AWS_REGION', variable: 'AWS_REGION')
])
script { script {
sh ''' sh '''
echo "=== Terraform Initialization ===" echo "=== Terraform Initialization ==="
@@ -392,10 +405,13 @@ EOF
steps { steps {
dir('infrastructure/services') { dir('infrastructure/services') {
withCredentials([ withCredentials([
string(credentialsId: env.AWS_CREDENTIALS, variable: 'AWS_ACCESS_KEY_ID'), [$class: 'AmazonWebServicesCredentialsBinding',
string(credentialsId: 'aws-secret', variable: 'AWS_SECRET_ACCESS_KEY'), credentialsId: 'aws-ci',
string(credentialsId: env.AWS_REGION_CREDENTIAL, variable: 'AWS_REGION') accessKeyVariable: 'AWS_ACCESS_KEY_ID',
]) { secretKeyVariable: 'AWS_SECRET_ACCESS_KEY'],
string(credentialsId: 'AWS_ACCOUNT_ID', variable: 'AWS_ACCOUNT_ID'),
string(credentialsId: 'AWS_REGION', variable: 'AWS_REGION')
])
script { script {
sh ''' sh '''
echo "=== Terraform Plan ===" echo "=== Terraform Plan ==="
@@ -469,9 +485,12 @@ EOF
steps { steps {
dir('infrastructure/services') { dir('infrastructure/services') {
withCredentials([ withCredentials([
string(credentialsId: env.AWS_CREDENTIALS, variable: 'AWS_ACCESS_KEY_ID'), [$class: 'AmazonWebServicesCredentialsBinding',
string(credentialsId: 'aws-secret', variable: 'AWS_SECRET_ACCESS_KEY'), credentialsId: 'aws-ci',
string(credentialsId: env.AWS_REGION_CREDENTIAL, variable: 'AWS_REGION') accessKeyVariable: 'AWS_ACCESS_KEY_ID',
secretKeyVariable: 'AWS_SECRET_ACCESS_KEY'],
string(credentialsId: 'AWS_ACCOUNT_ID', variable: 'AWS_ACCOUNT_ID'),
string(credentialsId: 'AWS_REGION', variable: 'AWS_REGION')
]) { ]) {
script { script {
sh ''' sh '''
@@ -503,9 +522,12 @@ EOF
steps { steps {
dir('infrastructure/services') { dir('infrastructure/services') {
withCredentials([ withCredentials([
string(credentialsId: env.AWS_CREDENTIALS, variable: 'AWS_ACCESS_KEY_ID'), [$class: 'AmazonWebServicesCredentialsBinding',
string(credentialsId: 'aws-secret', variable: 'AWS_SECRET_ACCESS_KEY'), credentialsId: 'aws-ci',
string(credentialsId: env.AWS_REGION_CREDENTIAL, variable: 'AWS_REGION') accessKeyVariable: 'AWS_ACCESS_KEY_ID',
secretKeyVariable: 'AWS_SECRET_ACCESS_KEY'],
string(credentialsId: 'AWS_ACCOUNT_ID', variable: 'AWS_ACCOUNT_ID'),
string(credentialsId: 'AWS_REGION', variable: 'AWS_REGION')
]) { ]) {
script { script {
sh ''' sh '''
@@ -580,9 +602,12 @@ EOF
steps { steps {
dir('infrastructure/services') { dir('infrastructure/services') {
withCredentials([ withCredentials([
string(credentialsId: env.AWS_CREDENTIALS, variable: 'AWS_ACCESS_KEY_ID'), [$class: 'AmazonWebServicesCredentialsBinding',
string(credentialsId: 'aws-secret', variable: 'AWS_SECRET_ACCESS_KEY'), credentialsId: 'aws-ci',
string(credentialsId: env.AWS_REGION_CREDENTIAL, variable: 'AWS_REGION') accessKeyVariable: 'AWS_ACCESS_KEY_ID',
secretKeyVariable: 'AWS_SECRET_ACCESS_KEY'],
string(credentialsId: 'AWS_ACCOUNT_ID', variable: 'AWS_ACCOUNT_ID'),
string(credentialsId: 'AWS_REGION', variable: 'AWS_REGION')
]) { ]) {
script { script {
def approver = input( def approver = input(
@@ -619,9 +644,12 @@ EOF
steps { steps {
dir('infrastructure/services') { dir('infrastructure/services') {
withCredentials([ withCredentials([
string(credentialsId: env.AWS_CREDENTIALS, variable: 'AWS_ACCESS_KEY_ID'), [$class: 'AmazonWebServicesCredentialsBinding',
string(credentialsId: 'aws-secret', variable: 'AWS_SECRET_ACCESS_KEY'), credentialsId: 'aws-ci',
string(credentialsId: env.AWS_REGION_CREDENTIAL, variable: 'AWS_REGION') accessKeyVariable: 'AWS_ACCESS_KEY_ID',
secretKeyVariable: 'AWS_SECRET_ACCESS_KEY'],
string(credentialsId: 'AWS_ACCOUNT_ID', variable: 'AWS_ACCOUNT_ID'),
string(credentialsId: 'AWS_REGION', variable: 'AWS_REGION')
]) { ]) {
script { script {
sh ''' sh '''