String GITHUB_REPOSITORY = 'python-aws-testing-utils'
String ECR_ACCOUNT_ID = '086679231553'
List<String> AWS_REGIONS = ['us-east-1']

pipeline {
    agent any

    options {
        ansiColor('xterm')
        disableConcurrentBuilds()
        timestamps()
    }

    triggers {
        issueCommentTrigger('.*retest this please.*')
    }

    parameters {
        string(name: 'SHARED_LIBRARIES_VERSION', defaultValue: 'master', description: 'The version of the Jenkins shared libraries to use. Can be a branch, tag or Git revision.')
    }

    stages {
        stage('Load Shared Libraries') {
            steps {
                library "jenkins-global-libraries@${params.SHARED_LIBRARIES_VERSION}"
            }
        }

        stage('Unit Tests and Style Checks') {
            steps {
                echo 'Running Unit Tests for PR...'
                withEcr {
                    script {
                        try {
                            sh "make docker_run_lint_and_test"
                        } finally {
                            sh "docker compose down"
                        }
                    }
                }
            }
        }
    }
}
