From 7163ba40754262c7848268094d0838721b09dae4 Mon Sep 17 00:00:00 2001 From: Hu# Date: Fri, 8 Dec 2023 10:11:51 +0800 Subject: [PATCH] pd: support pd real cluster (#2655) rely on https://github.com/tikv/pd/pull/7493 --------- Signed-off-by: husharp Co-authored-by: wuhuizuo Co-authored-by: Purelind --- .../pull_integration_realcluster_test.groovy | 39 +++++++++++ ...pod-pull_integration_realcluster_test.yaml | 32 +++++++++ .../pull_integration_realcluster_test.groovy | 65 +++++++++++++++++++ 3 files changed, 136 insertions(+) create mode 100644 jobs/tikv/pd/latest/pull_integration_realcluster_test.groovy create mode 100644 pipelines/tikv/pd/latest/pod-pull_integration_realcluster_test.yaml create mode 100644 pipelines/tikv/pd/latest/pull_integration_realcluster_test.groovy diff --git a/jobs/tikv/pd/latest/pull_integration_realcluster_test.groovy b/jobs/tikv/pd/latest/pull_integration_realcluster_test.groovy new file mode 100644 index 000000000..fbc80a6b2 --- /dev/null +++ b/jobs/tikv/pd/latest/pull_integration_realcluster_test.groovy @@ -0,0 +1,39 @@ +// REF: https:///plugin/job-dsl/api-viewer/index.html +// For trunk and latest release branches. +pipelineJob('tikv/pd/pull_integration_realcluster_test') { + logRotator { + daysToKeep(30) + } + parameters { + // Ref: https://docs.prow.k8s.io/docs/jobs/#job-environment-variables + stringParam("BUILD_ID") + stringParam("PROW_JOB_ID") + stringParam("JOB_SPEC", "", "Prow job spec struct data") + } + properties { + buildFailureAnalyzer(false) + githubProjectUrl("https://github.com/tikv/pd") + } + + definition { + cpsScm { + lightweight(true) + scriptPath("pipelines/tikv/pd/latest/pull_integration_realcluster_test.groovy") + scm { + git{ + remote { + url('https://github.com/PingCAP-QE/ci.git') + } + branch('main') + extensions { + cloneOptions { + depth(1) + shallow(true) + timeout(5) + } + } + } + } + } + } +} diff --git a/pipelines/tikv/pd/latest/pod-pull_integration_realcluster_test.yaml b/pipelines/tikv/pd/latest/pod-pull_integration_realcluster_test.yaml new file mode 100644 index 000000000..1e88914c5 --- /dev/null +++ b/pipelines/tikv/pd/latest/pod-pull_integration_realcluster_test.yaml @@ -0,0 +1,32 @@ +apiVersion: v1 +kind: Pod +spec: + securityContext: + fsGroup: 1000 + containers: + - name: golang + image: "hub.pingcap.net/jenkins/centos7_golang-1.21:latest" + tty: true + resources: + requests: + memory: 16Gi + cpu: "6" + limits: + memory: 16Gi + cpu: "6" + - name: net-tool + image: wbitt/network-multitool + tty: true + resources: + limits: + memory: 128Mi + cpu: 100m + affinity: + nodeAffinity: + requiredDuringSchedulingIgnoredDuringExecution: + nodeSelectorTerms: + - matchExpressions: + - key: kubernetes.io/arch + operator: In + values: + - amd64 diff --git a/pipelines/tikv/pd/latest/pull_integration_realcluster_test.groovy b/pipelines/tikv/pd/latest/pull_integration_realcluster_test.groovy new file mode 100644 index 000000000..d54c4ad4a --- /dev/null +++ b/pipelines/tikv/pd/latest/pull_integration_realcluster_test.groovy @@ -0,0 +1,65 @@ +// 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-pd" +final POD_TEMPLATE_FILE = 'pipelines/tikv/pd/latest/pod-pull_integration_realcluster_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: 40, unit: 'MINUTES') + parallelsAlwaysFailFast() + } + stages { + stage('Debug info') { + steps { + sh label: 'Debug info', script: """ + printenv + echo "-------------------------" + go env + echo "-------------------------" + echo "debug command: kubectl -n ${K8S_NAMESPACE} exec -ti ${NODE_NAME} bash" + """ + container(name: 'net-tool') { + sh 'dig github.com' + } + } + } + stage('Checkout') { + options { timeout(time: 10, unit: 'MINUTES') } + steps { + dir("pd") { + cache(path: "./", includes: '**/*', key: prow.getCacheKey('git', REFS), restoreKeys: prow.getRestoreKeys('git', REFS)) { + retry(2) { + script { + prow.checkoutRefs(REFS) + } + } + } + } + } + } + stage('Tests') { + options { timeout(time: 20, unit: 'MINUTES') } + steps { + dir('pd') { + sh label: "PD Real Cluster Check", script: """ + cd tests/integrations/realtiup + make check + """ + } + } + } + } +}