-
Notifications
You must be signed in to change notification settings - Fork 104
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(pingcap/tidb): add a new ut canary job (#2119)
Signed-off-by: wuhuizuo <[email protected]>
- Loading branch information
Showing
4 changed files
with
204 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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/canary_ghpr_unit_test') { | ||
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/canary-ghpr_unit_test.groovy") | ||
scm { | ||
git{ | ||
remote { | ||
url('https://github.com/PingCAP-QE/ci.git') | ||
} | ||
branch('main') | ||
extensions { | ||
cloneOptions { | ||
depth(1) | ||
shallow(true) | ||
timeout(5) | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} |
48 changes: 48 additions & 0 deletions
48
pipelines/pingcap/tidb/latest/canary-ghpr_unit_test.groovy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
// 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-canary-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('Checkout') { | ||
steps { | ||
dir(REFS.repo) { | ||
cache(path: "./", filter: '**/*', 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') { | ||
steps { | ||
dir(REFS.repo) { | ||
sh 'make bazel_coverage_test' | ||
} | ||
} | ||
} | ||
} | ||
} |
110 changes: 110 additions & 0 deletions
110
pipelines/pingcap/tidb/latest/pod-canary-ghpr_unit_test.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,110 @@ | ||
apiVersion: v1 | ||
kind: Pod | ||
spec: | ||
securityContext: | ||
fsGroup: 1000 | ||
containers: | ||
- name: golang | ||
# TODO(wuhuizuo): using standard bazel build image to shrink the image size | ||
# and keep image simple,so no need to refresh image to update basic bazel out data. | ||
image: hub.pingcap.net/ee/ci/base:v20230530-go1.20.4 | ||
securityContext: | ||
privileged: true | ||
tty: true | ||
resources: | ||
limits: | ||
memory: 128Gi | ||
cpu: "32" | ||
env: | ||
- name: GOPATH | ||
value: /share/.go | ||
- name: GOCACHE | ||
value: /share/.cache/go-build | ||
volumeMounts: | ||
- name: gocache | ||
mountPath: /share/.cache/go-build | ||
- name: gopathcache | ||
mountPath: /share/.go | ||
- name: bazel-rc | ||
mountPath: /data/ | ||
readOnly: true | ||
- name: containerinfo | ||
mountPath: /etc/containerinfo | ||
lifecycle: | ||
postStart: | ||
exec: | ||
command: | ||
- /bin/sh | ||
- /data/bazel-prepare-in-container.sh | ||
- name: deno | ||
image: "denoland/deno:1.31.2" | ||
command: [sh] | ||
tty: true | ||
env: | ||
- name: DENO_DIR | ||
value: /cache/deno | ||
resources: | ||
requests: | ||
memory: "128Mi" | ||
cpu: "100m" | ||
limits: | ||
memory: "512Mi" | ||
cpu: "500m" | ||
volumeMounts: | ||
- mountPath: /cache/deno | ||
name: deno-dir | ||
- name: net-tool | ||
image: wbitt/network-multitool | ||
tty: true | ||
resources: | ||
limits: | ||
memory: 128Mi | ||
cpu: 100m | ||
- name: report | ||
image: hub.pingcap.net/jenkins/python3-requests:latest | ||
tty: true | ||
resources: | ||
limits: | ||
memory: 256Mi | ||
cpu: 100m | ||
volumes: | ||
- name: deno-dir | ||
persistentVolumeClaim: | ||
claimName: deno-dir | ||
- name: gopathcache | ||
persistentVolumeClaim: | ||
claimName: gopathcache | ||
- name: gocache | ||
persistentVolumeClaim: | ||
claimName: gocache | ||
- name: bazel-rc | ||
secret: | ||
secretName: bazel | ||
- name: containerinfo | ||
downwardAPI: | ||
items: | ||
- path: cpu_limit | ||
resourceFieldRef: | ||
containerName: golang | ||
resource: limits.cpu | ||
- path: cpu_request | ||
resourceFieldRef: | ||
containerName: golang | ||
resource: requests.cpu | ||
- path: mem_limit | ||
resourceFieldRef: | ||
containerName: golang | ||
resource: limits.memory | ||
- path: mem_request | ||
resourceFieldRef: | ||
containerName: golang | ||
resource: requests.memory | ||
affinity: | ||
nodeAffinity: | ||
requiredDuringSchedulingIgnoredDuringExecution: | ||
nodeSelectorTerms: | ||
- matchExpressions: | ||
- key: kubernetes.io/arch | ||
operator: In | ||
values: | ||
- amd64 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters