Skip to content

Commit a15c357

Browse files
authored
HLD - Build Profiles (#2076)
* Propose Build Profile HLD * Propose Build Profile HLD
1 parent d47f769 commit a15c357

File tree

1 file changed

+65
-0
lines changed

1 file changed

+65
-0
lines changed
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
## SONiC Build Profiles
2+
3+
### Revision History
4+
5+
| Rev | Author | Change Description |
6+
|:---:|:----------------------:|-----------------------------|
7+
| 0.1 | Justin Sherman (Cisco) | Initial version |
8+
9+
### Overview
10+
11+
This adds a build profile feature, which allows developers to easily build SONiC with sets of pre-defined build flags, rather than manually specifiying all flags in the `make` invocation.
12+
13+
For example:
14+
15+
```
16+
make ENABLE_ZTP=y SECURE_UPGRADE_SIGNING_CERT=/some/cert SECURE_UPGRADE_PROD_SIGNING_TOOL=/some/script.sh SECURE_UPGRADE_MODE=prod USERNAME=ztp PASSWORD=ztp CHANGE_DEFAULT_PASSWORD=y all
17+
```
18+
19+
becomes...
20+
21+
```
22+
make PROFILE=ztp.signed all
23+
```
24+
25+
The build infra will then automatically include the contents of `rules/profiles/ztp.signed.mk`:
26+
27+
```make
28+
ENABLE_ZTP=y
29+
SECURE_UPGRADE_SIGNING_CERT=/some/cert
30+
SECURE_UPGRADE_PROD_SIGNING_TOOL=/some/script.sh
31+
SECURE_UPGRADE_MODE=prod
32+
USERNAME=ztp
33+
PASSWORD=ztp
34+
CHANGE_DEFAULT_PASSWORD=y # Force a password change on first login
35+
```
36+
37+
### Details
38+
39+
The power of this feature comes from having multiple different build profiles present. This enables developers to easily build with multiple different sets of coherent build flags.
40+
41+
Unlike `rules/config.user`, the contents of the `rules/profiles/` directory will be committed, to enable consistent builds across users.
42+
Common default build flags will remain in `rules/config`. Developers can still create the optional, temporary `rules/config.user` file in their workspace, if needed.
43+
44+
Order of precedence will be:
45+
46+
1. `rules/config`
47+
2. `rules/config.user` - only if it exists
48+
3. `rules/profiles/$(PROFILE).mk` - only if `$(PROFILE)` is defined
49+
50+
The changes required to implement this are very simple and completely backwards compatible: if the new `PROFILE` build flag is not provided, build behavior is identical to baseline.
51+
52+
### Questions and Answers
53+
54+
#### Why not just use `rules/config.user` or `rules/config`?
55+
56+
There are two advantages to the build profile approach over the existing files: the profiles are commited, enabling easy, consistent use by the whole team, and multiple profiles can co-exist, enabling easy use of multiple different sets of build flags.
57+
58+
#### Can't this just be handled by CI/CD?
59+
60+
Yes, but that approach only works for CI/CD builds. Builds done outside of CI/CD, like manual development builds, don't get any benefit. By committing the build profiles as includable makefiles, all builds can make use of this feature. Sources shared with customers no longer need to be accompanied by build instruction README files. The build process becomes portable, self-contained, and requires no extra infra besides that required by SONiC build itself.
61+
62+
#### Will this break my existing build/CI flow?
63+
64+
No. This feature is completely backwards compatible. No behavior change occurs unless the feature is explicitly used.
65+

0 commit comments

Comments
 (0)