when {
    anyOf {
        allOf {
            expression { return (env.ImgVariant).startsWith('Default-') } 
            environment name: 'BuildDefault', value: 'true'
        }
        allOf {
            expression { return (env.ImgVariant).startsWith('Extra-') }
            environment name: 'BuildExtra', value: 'true'
        }
    }
}


stage('Build Check') {
    steps {
        script {
            if (env.BuildDefault == 'true' && (env.ImgVariant).startsWith('Default-')) {
                echo 'Building Default'
                    BuildThisLocal = true
            } else if (env.BuildExtra == 'true' && (env.ImgVariant).startsWith('Extra-'))  {
                BuildThisLocal = true
                echo 'Building Extra'
            } else {
                BuildThisLocal = false
                echo 'not building'
            }
            env.BuildThis = BuildThisLocal                                
        }
        
    }
}