-
Notifications
You must be signed in to change notification settings - Fork 26
/
initial.yml
152 lines (140 loc) · 5.53 KB
/
initial.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
# This file is never read -- it's just a copy of the pipeline's
# configuration in the Buildkite UI.
# This config is intended for running the rails/buildkite-config CI.
steps:
- block: "Review Build Script"
branches: "!main"
prompt: |
Our CI scripts run outside the docker containers, which are a necessary security layer.
Approving a build here is equivalent to copy & pasting it into a production ssh window.
Prefer a second opinion for any nontrivial change, especially outside `pipeline-generate`.
- @matthewd
- group:
label: ":pipeline: buildkite-config meta-ci"
key: "meta"
steps:
- command: |
git config --global --add safe.directory /workdir
bundle install
bundle exec rubocop
label: ":nail_care: buildkite-config: lint"
plugins:
- docker#v5.8.0:
image: "ruby:latest"
- command: |
git config --global --add safe.directory /workdir
bundle install
bundle exec rake test
label: ":test_tube: buildkite-config: rake test"
plugins:
- docker#v5.8.0:
image: "ruby:latest"
environment:
- CI
- BUILDKITE
- BUILDKITE_BUILD_ID
- command: |
mkdir -p tmp
sh -c "$$ANNOTATE_COMMAND" > tmp/annotate.diff
if [[ -z $(grep '[^[:space:]]' tmp/annotate.diff) ]]; then
echo "annotate.diff is empty"
else
echo "annotate.diff is not empty"
cat tmp/annotate.diff
printf '%b\n' "$(cat tmp/annotate.diff)" | buildkite-agent annotate --style info --context config
fi
label: ":writing_hand: buildkite-config: annotate diff"
env:
BUNDLE_FROZEN: true
ANNOTATE_COMMAND: >-
docker run --rm
-v "$$PWD":/app:ro -w /app
-v "$$PWD/tmp":/app/tmp:rw
-e BUNDLE_FROZEN
ruby:latest
./bin/pipeline-annotate
- command: |
mkdir -p tmp
sh -c "$$ANNOTATE_COMMAND" > tmp/annotate-nightly.diff
if [[ -z $(grep '[^[:space:]]' tmp/annotate-nightly.diff) ]]; then
echo "annotate-nightly.diff is empty"
else
echo "annotate-nightly.diff is not empty"
cat tmp/annotate-nightly.diff
printf '%b\n' "$(cat tmp/annotate-nightly.diff)" | buildkite-agent annotate --style info --context nightly
fi
label: ":writing_hand: buildkite-config: annotate nightly diff"
env:
RAILS_CI_NIGHTLY: true
BUNDLE_FROZEN: true
ANNOTATE_COMMAND: >-
docker run --rm
-v "$$PWD":/app:ro -w /app
-v "$$PWD/tmp":/app/tmp:rw
-e RAILS_CI_NIGHTLY
-e BUNDLE_FROZEN
ruby:latest
./bin/pipeline-annotate
- group:
label: ":rails: Rails CI"
depends_on: meta
steps:
- block: "Rails CI main"
key: block-rails-ci-main
prompt: |
Are you sure you want to trigger a build of Rails CI pipeline for the main branch with this config?
We have a finite number of CI resources, so we want to avoid unnecessary builds.
- trigger: "rails-ci"
label: ":pipeline: Build Rails main with new config"
depends_on: block-rails-ci-main
build:
message: "[${BUILDKITE_BRANCH}] ${BUILDKITE_MESSAGE}"
branch: "main"
env:
CONFIG_REPO: "${BUILDKITE_PULL_REQUEST_REPO}"
CONFIG_BRANCH: "${BUILDKITE_BRANCH}"
- block: "Rails CI stable"
key: block-rails-ci-stable
depends_on: ~
prompt: |
Are you sure you want to trigger a build of Rails CI pipeline for the stable branch with this config?
We have a finite number of CI resources, so we want to avoid unnecessary builds.
- trigger: "rails-ci"
label: ":pipeline: Build Rails 6-1-stable with new config"
depends_on: block-rails-ci-stable
build:
message: "[${BUILDKITE_BRANCH} / 6-1-stable] ${BUILDKITE_MESSAGE}"
branch: "6-1-stable"
env:
CONFIG_REPO: "${BUILDKITE_PULL_REQUEST_REPO}"
CONFIG_BRANCH: "${BUILDKITE_BRANCH}"
- block: "Rails CI nightly"
key: block-rails-ci-nightly-main
depends_on: ~
prompt: |
Are you sure you want to trigger a build of Rails CI Nightly pipeline for the main branch with this config?
We have a finite number of CI resources, so we want to avoid unnecessary builds.
- trigger: "rails-ci-nightly"
label: ":pipeline: Build Rails main with new nightly config"
depends_on: block-rails-ci-nightly-main
build:
message: "[${BUILDKITE_BRANCH}] ${BUILDKITE_MESSAGE}"
branch: "main"
env:
CONFIG_REPO: "${BUILDKITE_PULL_REQUEST_REPO}"
CONFIG_BRANCH: "${BUILDKITE_BRANCH}"
- block: "Rails CI nightly stable"
key: block-rails-ci-nightly-stable
depends_on: ~
prompt: |
Are you sure you want to trigger a build of Rails CI Nightly pipeline for the stable branch with this config?
We have a finite number of CI resources, so we want to avoid unnecessary builds.
- trigger: "rails-ci-nightly"
label: ":pipeline: Build Rails 6-1-stable with new nightly config"
depends_on: block-rails-ci-nightly-stable
build:
message: "[${BUILDKITE_BRANCH} / 6-1-stable] ${BUILDKITE_MESSAGE}"
branch: "6-1-stable"
env:
CONFIG_REPO: "${BUILDKITE_PULL_REQUEST_REPO}"
CONFIG_BRANCH: "${BUILDKITE_BRANCH}"