pipeline {
  agent none

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

  stages {
    stage('lint:tf') {
      agent { docker { image 'hashicorp/terraform:light' } }
      steps {
        sh 'terraform fmt -check=true'
      }
    }

    stage('lint:go') {
      agent {
        docker {
          image 'docker.internal.justin.tv/devtools/bionic/go1.12.1:latest'
          args '-u root'
        }
      }
      steps {
        sh 'make setup-jenkins-go'
        sh 'make lint-go'
      }
      post { cleanup { sh 'git clean -dfx' } }
    }
  }
}
