pipeline {
    agent {
        kubernetes {
            label "liquidata-inc-ld-build"
        }
    }
    stages {
        stage ("Update Liquidata/dolt-sql-performance:releases") {
            environment {
                PATH = "${pwd()}/.ci_bin/node_modules/.bin:${env.PATH}"
                TMPDIR = "${pwd()}/tempDir"
                DOLT_ROOT_PATH="${pwd()}/tempRoot"
                DOLT_CREDS = credentials("system-account-dolthub-creds")
                DOLT_RELEASE_URL = "https://github.com/dolthub/dolt/releases/download/v${DOLT_RELEASE}/dolt-linux-amd64.tar.gz"
            }
            steps {
                sh "rm -rf $TMPDIR && mkdir $TMPDIR"
                sh "rm -rf $DOLT_ROOT_PATH && mkdir $DOLT_ROOT_PATH"
                dir ("sqllogictest") {
                    git url: "https://github.com/dolthub/sqllogictest.git"
                }
                dir ("benchmark/sql_regressions") {
                    sh "nice ./run_regressions.sh ./releases.vars"
                }
            }
        }
    }
    post {
        always {
            node ("liquidata-inc-ld-build") {
                cleanWs() // cleanup
            }
        }
    }
}
