pipeline {
  agent {
    kubernetes {
      defaultContainer 'jnlp'
      yamlFile 'ci/docker-gcr-sync/jenkins-slave-pod.yaml'
    }
  }

  stages {
    stage("Cleanup") {
      steps {
        container('toolbox'){
          deleteDir()
        }
      }
    }

    stage("Checkout Code") {
      steps {
        container('toolbox'){
          dir('Tidb'){
          git(
            branch: 'src',
            url: 'https://github.com/pingcap/pingcap.github.io.git'
            )
        }
      }
    }
  }

    stage('Build and Publish') {
      steps {
        container('toolbox'){
          dir('Tidb/data'){
            sh 'set -euo pipefail && python -m pip install awscli && ./../../ci/docker-gcr-sync/docker_push.sh'

          }
        }
      }
    }
  }
}
