keptn destroy to jenkins file

main
ermisw 2024-11-22 16:46:39 +01:00
parent 057fe4c676
commit abe599f95c
2 changed files with 33 additions and 2 deletions

View File

@ -11,6 +11,10 @@ pipeline {
TF_VAR_DT_API_TOKEN="dt0c01.N2PBLK767N76X77W4DKPZBW3.RPIRL6HTSX6OOPFB4REGWBQEN62LYYVYYR3O5VAWGFW37OVXKB4G6ZQUHPL33LMP" TF_VAR_DT_API_TOKEN="dt0c01.N2PBLK767N76X77W4DKPZBW3.RPIRL6HTSX6OOPFB4REGWBQEN62LYYVYYR3O5VAWGFW37OVXKB4G6ZQUHPL33LMP"
} }
parameters {
choice(name: 'mode', choices: ['apply', 'destroy'], description: '', defaultValue: 'apply')
}
// parameters { // parameters {
// booleanParam(name: 'refresh', defaultValue: false, description: 'Refresh pipeline properties') // booleanParam(name: 'refresh', defaultValue: false, description: 'Refresh pipeline properties')
// } // }
@ -26,7 +30,12 @@ pipeline {
// } // }
// } // }
// } // }
stage('TF Plan') { stage('Deploy Keptn') {
when {
expression {
return params.mode == 'apply'
}
}
steps { steps {
container('terraform') { container('terraform') {
withCredentials([[ withCredentials([[
@ -49,6 +58,28 @@ pipeline {
} }
} }
} }
stage('Destroy Keptn') {
when {
expression {
return params.mode == 'destroy'
}
}
steps {
container('terraform') {
withCredentials([[
$class: 'AmazonWebServicesCredentialsBinding',
credentialsId: "f89b3f7d-23ec-42b9-9687-e4acf01d7507",
accessKeyVariable: 'AWS_ACCESS_KEY_ID',
secretKeyVariable: 'AWS_SECRET_ACCESS_KEY']]) {
sh 'chmod -R 777 ./terraform-kubernetes-get-secret/bin'
sh 'terraform version'
sh 'terraform init -backend-config="key=keptn-demo"'
sh 'terraform destroy -auto-approve'
}
}
}
}
} }
} }

View File

@ -41,7 +41,7 @@ set {
set { set {
name = "remoteControlPlane.topicSubscription" name = "remoteControlPlane.topicSubscription"
value = "sh.keptn.event.deployment.triggered\\,sh.keptn.event.test.triggered\\,sh.keptn.event.action.triggered" value = "sh.keptn.event.deployment.triggered\\,sh.keptn.event.test.triggered\\,sh.keptn.event.action.triggered\\,sh.keptn.event.uninstall.triggered"
} }
depends_on = [ depends_on = [