#!groovy

properties([
    // H allow predefined but random minute see https://en.wikipedia.org/wiki/Cron#Non-standard_characters
    //CCD-3539 (Stop running Nightly builds on weekends). Original schedule was 'H 05 * * *'
    pipelineTriggers([cron('H 08 * * 1-5')])
])

@Library("Infrastructure@2.4.0")

def type = "nodejs"
def product = "ccd"
def component = "api-gateway-web"

// Prevent Docker hub rate limit errors by ensuring that testcontainers uses images from hmctsprod ACR
env.TESTCONTAINERS_HUB_IMAGE_NAME_PREFIX = "hmctsprod.azurecr.io/imported/"

withNightlyPipeline(type, product, component) {
    enableSlackNotifications('#ccd-nightly-builds')
    enableFortifyScan()

    afterAlways('checkOut')  {
        sh "yarn cache clean"
    }

    afterAlways('fortify-scan') {
        steps.archiveArtifacts allowEmptyArchive: true, artifacts: '**/Fortify Scan/**/*'
    }

}
