Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 38 additions & 0 deletions jobs/pingcap/tidb/latest/pull_unit_test_ddlv1.groovy
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
// REF: https://<your-jenkins-server>/plugin/job-dsl/api-viewer/index.html
// For trunk and latest release branches.
pipelineJob('pingcap/tidb/pull_unit_test_ddlv1') {
logRotator {
daysToKeep(30)
}
parameters {
stringParam("BUILD_ID")
stringParam("PROW_JOB_ID")
stringParam("JOB_SPEC", "", "Prow job spec struct data")
}
properties {
// priority(0) // 0 fast than 1
githubProjectUrl("https://github.com/pingcap/tidb")
}

definition {
cpsScm {
lightweight(true)
scriptPath("pipelines/pingcap/tidb/latest/pull_unit_test_ddlv1.groovy")
scm {
git{
remote {
url('https://github.com/PingCAP-QE/ci.git')
}
branch('main')
extensions {
cloneOptions {
depth(1)
shallow(true)
timeout(5)
}
}
}
}
}
}
}
75 changes: 75 additions & 0 deletions pipelines/pingcap/tidb/latest/pull_unit_test_ddlv1.groovy
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
// REF: https://www.jenkins.io/doc/book/pipeline/syntax/#declarative-pipeline
// Keep small than 400 lines: https://issues.jenkins.io/browse/JENKINS-37984
@Library('tipipeline') _

final K8S_NAMESPACE = "jenkins-tidb"
final GIT_CREDENTIALS_ID = 'github-sre-bot-ssh'
final GIT_FULL_REPO_NAME = 'pingcap/tidb'
final POD_TEMPLATE_FILE = 'pipelines/pingcap/tidb/latest/pod-ghpr_unit_test.yaml'
final REFS = readJSON(text: params.JOB_SPEC).refs

pipeline {
agent {
kubernetes {
namespace K8S_NAMESPACE
yamlFile POD_TEMPLATE_FILE
defaultContainer 'golang'
}
}
environment {
FILE_SERVER_URL = 'http://fileserver.pingcap.net'
}
options {
timeout(time: 90, unit: 'MINUTES')
}
stages {
stage('Debug info') {
steps {
sh label: 'Debug info', script: """
printenv
echo "-------------------------"
go env
echo "-------------------------"
ls -l /dev/null
echo "debug command: kubectl -n ${K8S_NAMESPACE} exec -ti ${NODE_NAME} bash"
"""
container(name: 'net-tool') {
sh 'dig github.com'
script {
prow.setPRDescription(REFS)
}
}
}
}
stage('Checkout') {
steps {
dir(REFS.repo) {
cache(path: "./", includes: '**/*', key: prow.getCacheKey('git', REFS), restoreKeys: prow.getRestoreKeys('git', REFS)) {
script {
git.setSshKey(GIT_CREDENTIALS_ID)
retry(2) {
prow.checkoutRefs(REFS, timeout = 5, credentialsId = '', gitBaseUrl = 'https://github.com', withSubmodule=true)
}
}
}
}
}
}
stage('Test') {
environment { CODECOV_TOKEN = credentials('codecov-token-tidb') }
steps {
dir(REFS.repo) {
sh """
sed -i 's|repository_cache=/home/jenkins/.tidb/tmp|repository_cache=/share/.cache/bazel-repository-cache|g' Makefile.common
git diff .
git status
"""
sh """#! /usr/bin/env bash
set -o pipefail
make bazel_coverage_test_ddlargsv1
"""
}
}
}
}
}
12 changes: 12 additions & 0 deletions prow-jobs/pingcap/tidb/latest-presubmits.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,18 @@ presubmits:
branches:
- ^master$
- ^feature/.+
- name: pingcap/tidb/pull_unit_test_ddlv1
agent: jenkins
decorate: false # need add this.
# skip_if_only_changed: "(\\.(md|png|jpeg|jpg|gif|svg|pdf)|Dockerfile|OWNERS|OWNERS_ALIASES)$"
context: wip/pull-unit-test-ddlv1
always_run: false
optional: true
trigger: "(?m)^/test (?:.*? )?pull-unit-test-ddlv1(?: .*?)?$"
rerun_command: "/test pull-unit-test-ddlv1"
branches:
- ^master$
- ^feature/.+
- name: pingcap/tidb/pull_integration_mysql_test
agent: jenkins
decorate: false # need add this.
Expand Down