pipeline {
    agent any

    options {
        ansiColor('xterm')
        disableConcurrentBuilds()
        timestamps()
        timeout(time: 20, unit: 'MINUTES')
        buildDiscarder(logRotator(numToKeepStr: '60'))
    }

    triggers {
        cron('H/15 * * * *')
        upstream(
            upstreamProjects: 'theorchard/ows-permissions/master',
            threshold: hudson.model.Result.SUCCESS
        )
    }

    stages {
        stage('Load Shared Libraries') {
            steps {
                library "jenkins-global-libraries@master"
            }
        }

        stage('Run Playwright E2E Prod Tests') {
            environment {
                TAGS = "@settings_prod"
            }
            steps {
                script {
                    playwrightTests(tags: env.TAGS, configEnvironment: 'prod', slackNotificationChannels: ['#prod-e2e-results', '#platform-team', '#accounts-team-alerts'])
                }
            }
        }
    }
}
