forked from vmware/splinterdb
-
Notifications
You must be signed in to change notification settings - Fork 0
/
jobs.lib.yml
165 lines (150 loc) · 4.44 KB
/
jobs.lib.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
#! Copyright 2018-2021 VMware, Inc.
#! SPDX-License-Identifier: Apache-2.0
#@ load("@ytt:template", "template")
#@ load("steps.lib.yml",
#@ "step_build_splinterdb_image",
#@ "step_test_with_image",
#@ "step_collect_tags",
#@ "step_build_test",
#@ "step_set_pr_status",
#@ "step_set_commit_status",
#@ "get_task_timeout",
#@ )
---
#! Build and push a container image
#@ def job_recreate_image(resource_name):
name: #@ "recreate-" + resource_name
public: true
plan:
- get: #@ resource_name + "-source"
trigger: true
- load_var: git-commit-sha
file: #@ resource_name + "-source/.git/ref"
reveal: true
- task: create-image
timeout: #@ get_task_timeout()
privileged: true
params:
LABEL_git_sha: ((.:git-commit-sha))
config:
platform: linux
image_resource:
type: registry-image
source:
repository: harbor-repo.vmware.com/dockerhub-proxy-cache/concourse/oci-build-task
inputs:
- name: #@ resource_name + "-source"
path: .
outputs:
- name: image
params:
BUILD_ARG_base_image: harbor-repo.vmware.com/dockerhub-proxy-cache/library/ubuntu:20.04
DOCKERFILE: #@ "Dockerfile." + resource_name
LABEL_created_by: "SplinterDB Concourse CI"
run:
path: build
- put: #@ resource_name + "-image-latest"
params:
image: image/image.tar
additional_tags: #@ resource_name + "-source/.git/ref"
#@ end
---
#! Build, test and publish container images
#@ def job_publish_container(compiler, branch, also_latest=False):
name: #@ branch + "-push-" + compiler
public: true
on_success: #@ step_set_commit_status("success", compiler)
on_failure: #@ step_set_commit_status("failure", compiler)
on_error: #@ step_set_commit_status("error", compiler)
plan:
- in_parallel:
- get: source
resource: #@ "branch-" + branch
trigger: true
- get: run-env-image-latest
passed: [ recreate-run-env ]
params: { format: oci }
trigger: true
- get: build-env-image-latest
passed: [ recreate-build-env ]
params: { format: oci }
trigger: true
- load_var: git-commit-sha
file: source/.git/ref
reveal: true
- #@ step_set_commit_status("pending", compiler)
- #@ step_build_splinterdb_image("source", compiler)
- #@ step_test_with_image()
- #@ step_collect_tags("source", compiler)
- put: #@ "splinterdb-image-" + compiler
attempts: 2 #! allow 1 retry, since Distribution Harbor can be flaky
params:
image: image/image.tar
additional_tags: tags/tags
#@ if also_latest:
- put: splinterdb-image-latest
attempts: 2 #! allow 1 retry, since Distribution Harbor can be flaky
params:
image: image/image.tar
additional_tags: source/.git/ref
#@ end
#@ end
---
#@ def friendly_name(compiler, debug, sanitize, nightly_test):
#@ ret = ""
#@ if debug:
#@ ret += "debug-"
#@ end
#@ if sanitize:
#@ ret += sanitize + "-"
#@ end
#@ if nightly_test:
#@ ret += "nightly-test-"
#@ end
#@ return ret + compiler
#@ end
#! Debug build and test
#@ def job_test(compiler, branch, sanitize="", trigger="commit", is_debug=False, test_nightly=False):
#@ name = friendly_name(compiler, is_debug, sanitize, test_nightly)
name: #@ branch + "-" + name
public: true
on_success: #@ step_set_commit_status("success", name)
on_failure: #@ step_set_commit_status("failure", name)
on_error: #@ step_set_commit_status("error", name)
plan:
- in_parallel:
- get: source
resource: #@ "branch-" + branch
trigger: #@ (trigger == "commit")
- get: build-env-image-latest
passed: [ recreate-build-env ]
trigger: true
#@ if trigger == "nightly":
- get: nightly-timer
trigger: true
#@ end
- #@ step_set_commit_status("pending", name)
- #@ step_build_test(compiler, "source", is_debug=is_debug, sanitize=sanitize, test_nightly=test_nightly)
#@ end
---
#! Job to run against every PR
#@ def job_pr_check(job_name, branch, sequence, depends_on=[], description=""):
name: #@ branch + "-pr-" + job_name
public: true
on_success: #@ step_set_pr_status(job_name, branch, "success", description)
on_failure: #@ step_set_pr_status(job_name, branch, "failure", description)
on_error: #@ step_set_pr_status(job_name, branch, "error", description)
plan:
- get: github-pull-request
resource: #@ "github-prs-" + branch
trigger: true
#@ if depends_on:
passed: #@ depends_on
#@ else:
version: every
#@ end
params:
list_changed_files: true
- #@ step_set_pr_status(job_name, branch, "pending", description)
- #@ template.replace(sequence)
#@ end