Advertisement
Guest User

Untitled

a guest
Dec 5th, 2018
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Groovy 6.95 KB | None | 0 0
  1. #!groovy
  2.  
  3. pipeline {
  4.   node('docker-cd') {
  5.     wrap([$class: 'AnsiColorBuildWrapper']) {
  6.  
  7.         stage("Checkout Code CD-Tools") { checkout scm }
  8.         stage("Raise the Integration Test") {
  9.           parallel {
  10.             stage("Raise the Integration Test Provider A") {
  11.               steps {
  12.                 // - Check if we have currently an Integration Test.
  13.                 // - Raise the new DB Backend for Fixtures.
  14.                 // - Populate Fixtures.
  15.               }
  16.             }
  17.             stage("Raise the Integration Test Provider B") {
  18.               steps {
  19.                 // - Check if we have currently an Integration Test.
  20.                 // - Raise the new DB Backend for Fixtures.
  21.                 // - Populate Fixtures.
  22.               }
  23.             }
  24.           }
  25.         }
  26.  
  27.         stage('Blue Deployment') {
  28.           parallel {
  29.               parallel {
  30.                 stage('Blue Deployment Provider A') {
  31.                   stage('Run Integration Tests') {
  32.                       agent { label "node-provider-a" }
  33.                       steps { }
  34.                   }
  35.                   stage('Deploy the new version in Blue Provider A') {
  36.                       agent { label "node-provider-a" }
  37.                       steps {
  38.                         // - Get the secrets vars.
  39.                         // - Update the Task Definition.
  40.                         // - Register the new Task Definition in the orchestrator.
  41.                         // - Rolling Update with the new task version
  42.                       }
  43.                   }
  44.                   stage('Run Contract Tests') {
  45.                       agent { label "node-provider-a" }
  46.                       steps { }
  47.                   }
  48.                   post {
  49.                     success {
  50.                       // - Notification Integration Tests Passed,
  51.                       //   Blue Deployment Success Provider A.
  52.                     }
  53.                     failure {
  54.                       // - Rollback update with the previous version of the
  55.                       //   Blue enviroment Provider A.
  56.                     }
  57.                   }
  58.                 }
  59.  
  60.                 stage('Blue Deployment Provider B') {
  61.                   stage('Run Integration Tests') {
  62.                       agent { label "node-provider-b" }
  63.                       steps { }
  64.                   }
  65.                   stage('Deploy the new version in Blue Provider B') {
  66.                       agent { label "node-provider-b" }
  67.                       steps {
  68.                         // - Get the secrets vars.
  69.                         // - Update the Task Definition.
  70.                         // - Register the new Task Definition in the orchestrator.
  71.                         // - Rolling Update with the new task version
  72.                       }
  73.                   }
  74.                   stage('Run Contract Tests') {
  75.                       agent { label "node-provider-b" }
  76.                       steps { }
  77.                   }
  78.                   post {
  79.                     success {
  80.                       // - Notification Integration Tests Passed,
  81.                       //   Blue Deployment Success Provider B.
  82.                     }
  83.                     failure {
  84.                       // - Rollback update with the previous version of the
  85.                       //   Blue enviroment Provider B.
  86.                     }
  87.                   }
  88.                 }
  89.              }
  90.           }
  91.         }
  92.  
  93.         stage('New Green Deployment') {
  94.           stage('Scale-UP Blue Enviroment') {
  95.             parallel {
  96.                 stage('Scale-UP Blue Deployment on Provider A, Region X') {
  97.                     agent { label "node-provider-a" }
  98.                     steps { }
  99.                 }
  100.                 stage('Scale-UP Blue Deployment on Provider B, Region Y') {
  101.                     agent { label "node-provider-b" }
  102.                     steps { }
  103.                 }
  104.             }
  105.           }
  106.  
  107.           stage('Registring Blue deployment on the services mesh') {
  108.             parallel {
  109.                 stage('Register Blue Deployment into Service Mesh on Provider A, Region X') {
  110.                     agent { label "node-provider-a" }
  111.                     steps { }
  112.                 }
  113.                 stage('Register Blue Deployment into Service Mesh on Provider B, Region Y') {
  114.                     agent { label "node-provider-b" }
  115.                     steps { }
  116.                 }
  117.             }
  118.           }
  119.           post {
  120.             failure {
  121.               // - Deregistring Blue deployment to the service mesh for each provider.
  122.             }
  123.           }
  124.         }
  125.  
  126.         stage('Traffic shifting in a Canary Release') {
  127.           stage('Traffic shifting') {
  128.             parallel {
  129.               stage('Traffic shifting Blue on Provider A, Region X') {
  130.                   agent { label "node-provider-a" }
  131.                   steps { }
  132.               }
  133.               stage('Traffic shifting Blue on Provider B, Region X') {
  134.                   agent { label "node-provider-b" }
  135.                   steps { }
  136.               }
  137.             }
  138.           }
  139.           post {
  140.             failure {
  141.               // - Traffic shifting 100% to the Green service
  142.             }
  143.           }
  144.  
  145.           stage('Registring new Green') {
  146.             parallel {
  147.               stage('Registring Blue as new Green on Provider A, Region X') {
  148.                   agent { label "node-provider-a" }
  149.                   steps { }
  150.               }
  151.               stage('Registring Blue as new Green on Provider B, Region X') {
  152.                   agent { label "node-provider-b" }
  153.                   steps { }
  154.               }
  155.             }
  156.           }
  157.           post {
  158.             success {
  159.               // - Notification New Green is currently Deployed.
  160.             }
  161.             failure {
  162.               // - Emergency Scale-UP Old Green.
  163.               // - Registring Old Green as Green and NewGreen as Blue in service mesh
  164.               //   without traffic shipping.
  165.               // - Scale down the Blue service.
  166.             }
  167.           }
  168.  
  169.           stage('Scale-Down new Blue') {
  170.             parallel {
  171.               stage('Scale-Down Blue on Provider A, Region X') {
  172.                   agent { label "node-provider-a" }
  173.                   steps { }
  174.               }
  175.               stage('Scale-Down Blue on Provider B, Region X') {
  176.                   agent { label "node-provider-b" }
  177.                   steps { }
  178.               }
  179.             }
  180.           }
  181.  
  182.           stage('Post Deployment Tests on New Green') {
  183.             parallel {
  184.               stage('Run Post Deployment Tests on Provider A, Region X') {
  185.                   agent { label "node-provider-a" }
  186.                   steps { }
  187.               }
  188.               stage('Run Post Deployment Tests on Provider B, Region X') {
  189.                   agent { label "node-provider-b" }
  190.                   steps { }
  191.               }
  192.             }
  193.           }
  194.         }
  195.      }
  196.   }
  197. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement