Skip to content

Commit 3ab4b8c

Browse files
authored
Update examples (#11)
* Update examples * Update examples
1 parent 30a1a32 commit 3ab4b8c

File tree

5 files changed

+112
-13
lines changed

5 files changed

+112
-13
lines changed

README.md

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -233,9 +233,66 @@ YAML anchors and aliases need to be in the same YAML file. When CUE import YAML,
233233

234234
## (Advanced) I want to use CUE to write CircleCI config
235235

236+
This Orb just pass the specified files to CUE, therefore, you can use CUE files if you want.
237+
If you use CUE format, you can use the power of CUE.
238+
239+
For example, you can write CircleCI build config with CUE:
240+
241+
```cue
242+
package config
243+
244+
version: "2.1"
245+
246+
jobs: {
247+
"service1-say-hello": {
248+
docker: [
249+
{image: "cimg/base:stable"},
250+
]
251+
steps: [
252+
"checkout",
253+
{
254+
run: {
255+
name: "Say hello"
256+
command: "echo Hello, World!1"
257+
}
258+
},
259+
]
260+
}
261+
}
262+
263+
workflows: {
264+
"service1-say-hello-workflow":
265+
{
266+
jobs: [
267+
"common-say-hello",
268+
"service1-say-hello",
269+
]
270+
}
271+
}
272+
```
273+
274+
And pass this file to the Orb:
275+
236276
```yaml
277+
version: 2.1
278+
279+
setup: true
280+
281+
orbs:
282+
# Please specify the latest version
283+
path-filtering: circleci/[email protected]
284+
285+
workflows:
286+
generate-config:
287+
jobs:
288+
- split-config/generate-config:
289+
find-config-regex: .*/\.circleci/config\.cue
237290
```
238291

292+
Then it is converted to YAML in the end and CircleCI starts with the YAML file.
293+
294+
Working example: https://github.com/bufferings/orb-split-config-example7
295+
239296
---
240297

241298
## Resources

src/examples/config-list-path.yml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
description: >
2+
You can write the split config paths in a file and set it to the config-list-path parameter.
3+
4+
Please check README in the GitHub repository for more details:
5+
https://github.com/bufferings/orb-split-config
6+
7+
usage:
8+
version: 2.1
9+
setup: true
10+
orbs:
11+
# Please specify the latest version
12+
split-config: bufferings/[email protected]
13+
workflows:
14+
generate-config:
15+
jobs:
16+
- split-config/generate-config:
17+
config-list-path: .circleci/config-list

src/examples/example.yml

Lines changed: 0 additions & 13 deletions
This file was deleted.

src/examples/find-config-regex.yml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
description: >
2+
You can use regex to specify the split configs.
3+
4+
Please check README in the GitHub repository for more details:
5+
https://github.com/bufferings/orb-split-config
6+
7+
usage:
8+
version: 2.1
9+
setup: true
10+
orbs:
11+
# Please specify the latest version
12+
split-config: bufferings/[email protected]
13+
workflows:
14+
generate-config:
15+
jobs:
16+
- split-config/generate-config:
17+
find-config-regex: .*/\.circleci/config\.yml
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
description: >
2+
You can use fixed-config-paths parameter to specify the split configs.
3+
4+
Please check README in the GitHub repository for more details:
5+
https://github.com/bufferings/orb-split-config
6+
7+
usage:
8+
version: 2.1
9+
setup: true
10+
orbs:
11+
# Please specify the latest version
12+
split-config: bufferings/[email protected]
13+
workflows:
14+
generate-config:
15+
jobs:
16+
- split-config/generate-config:
17+
fixed-config-paths: |
18+
./common/.circleci/config.yml
19+
./service1/.circleci/config.yml
20+
./service2/.circleci/config.yml
21+
./service3/.circleci/config.yml

0 commit comments

Comments
 (0)