// This Jenkins file uses a brute force method to promote the application images from TEST to PROD.
// In other words all of the images that are currently deployed in TEST will be tagged for deployment to PROD.

// Define these in the order they should be deployed.
def APP_NAMES = ['postgresql', 'nginx-proxy', 'weasyprint', 'edivorce-django', 'backup']
def SOURCE_TAG = 'test'
def DESTINATION_TAG = 'prod'

node {
  properties([[$class: 'BuildDiscarderProperty', strategy: [$class: 'LogRotator', artifactDaysToKeepStr: '', artifactNumToKeepStr: '', daysToKeepStr: '', numToKeepStr: '10']]])

  APP_NAMES.each { appName ->
    stage('Deploying ' + appName + ' to ' + DESTINATION_TAG) {
      openshiftTag destStream: appName, verbose: 'true', destTag: DESTINATION_TAG, srcStream: appName, srcTag: SOURCE_TAG
    }
  }
}