properties([
    parameters([
        string(name: 'ANNOTATIONS', defaultValue: '', description: '', trim: true),
        booleanParam(name: 'REPORT', defaultValue: true, description: ''),
    ])
])

catchError {
    def annotations = params.ANNOTATIONS
    if (!annotations) {
        annotations = "--annotation utf.daily_test=${new Date(currentBuild.startTimeInMillis).format("yyyy-MM-dd")}"
    }
    annotations += " --annotation jenkins.trigger=$BUILD_URL"

    def ok = true
    stage('Test') {
        for (suite in ["transaction", "rowformat", "ticdc", "readpool"]) {
            try {
                echo("test $suite")
                build(job: "test-utf-go", parameters: [
                    string(name: "SUITE", value: suite),
                    string(name: "ANNOTATIONS", value: annotations),
                    booleanParam(name: "REPORT", value: params.REPORT),
                ])
            } catch (e) { ok = false }
        }
    }
    assert ok
}
