
def make(cmd) {
    sh "make ${cmd}"
}

pipeline {
    agent any
    options {
        disableConcurrentBuilds()
        timeout(time: 1, unit: 'HOURS')
        ansiColor('xterm')
        timestamps()
    }
    stages {
        stage('Test') {
            steps {
                sshagent(['git-aws-read-key']) {
                    echo "Build environment"
                    sh "env"
                    echo "Ensuring vendor tree checkout"
                    make("vendor-docker")
                    echo "Running tests with `make test`"
                    make("test")
                }
            }
        }
        stage('Lint') {
            steps {
                echo "Linting"
                make("lint")
            }
        }
    }
}