Skip to content

Commit d034301

Browse files
Create design document for automated releases
Signed-off-by: Courtney Pacheco <6019922+courtneypacheco@users.noreply.github.com>
1 parent d3b06cf commit d034301

3 files changed

+133
-0
lines changed

.spellcheck-en-custom.txt

+1
Original file line numberDiff line numberDiff line change
@@ -215,6 +215,7 @@ safetensor
215215
safetensors
216216
Salawu
217217
scalable
218+
Schedulable
218219
SDG
219220
sdg
220221
SDK
+132
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,132 @@
1+
# Creating Automated Releases: Design Document
2+
3+
## Motivation & Overview
4+
5+
Presently, the release processes for every library within this `instructlab` GitHub organization is entirely manual:
6+
7+
For example, for a typical y-stream release, a maintainer has to:
8+
9+
1. Manually create a new release branch -- e.g., `release-0.y.0`,
10+
2. Manually create a pull request against `release-0.y.0` to cap the versions on some of the dependencies defined in their library's `requirements.txt` file,
11+
3. Optionally trigger an E2E test against that pull request,
12+
4. Wait for all pull request CI checks to complete,
13+
5. Manually request two maintainers to approve the pull request, and
14+
6. Manually create a release from the GitHub UI using that new branch
15+
16+
This entire process takes at least 10 minutes of manual work, plus however long it takes for the pull request's checks to complete. (In some repositories, like the core repo, this can take 2+ hours.)
17+
18+
Going forward, we should automate these release processes so that contributors and maintainers can focus more on development work and less on creating actual releases.
19+
20+
## Generic Automation Workflow: Major Releases, Minor Releases, and Z-Stream Releases
21+
22+
### Brief Overview of the Automation
23+
24+
The automation logic described in this dev-doc will be published in the form of an in-house GitHub action called `create-automated-release` and it will therefore be callable from any workflow file. Thus, it is strongly recommended that each repository maintainer creates a `.github/workflows/automated-release.yml` workflow file to call this `create-automated-release` GitHub action from.
25+
26+
### Goals of the Automation
27+
28+
The automated process should be:
29+
30+
1. Configurable so that any library maintainer can configure the automation to meet their specific repository's needs
31+
2. Schedulable so that releases are generated according to a specific cadence
32+
33+
Scheduled releases are generally important for setting expectations around release cadences, but they are by no means required for every library and may not even be applicable to some in this GitHub organization.
34+
35+
## Y-Stream Automation Workflow
36+
37+
### Overview of Y-Stream (Minor) Release Automation
38+
39+
Y-stream (minor) releases have historically been handled differently from Z-stream releases. Z-stream releases oftentimes involve backports for bugfixes and may require manual code rebasing to get those backports merged into the appropriate existing release branch. Therefore, we can think of Y-stream release logic as the "basis" for Z-stream release logic, which takes the Y-stream logic and builds upon it to account for backporting and other desirable actions.
40+
41+
### Configurable Components
42+
43+
As mentioned above, there are configurable components within this release process automation. The diagram in the next section references two configurable components:
44+
45+
#### Trigger Schedule
46+
47+
The trigger schedule defines the day and time (in UTC) when the release process will kick off. This schedule can be disabled if desired, and maintainers can trigger the release process manually when needed instead.
48+
49+
As mentioned in the brief overview of the automation, this in-house `create-automated-release` action will be callable from any workflow file. Thus, each library maintainer who wants to create a scheduled release should first create a `.github/workflows/automated-release.yml` workflow file in their repository and define a schedule for it. For example:
50+
51+
```yaml
52+
name: Create Y-Stream Release
53+
54+
on:
55+
schedule:
56+
- cron: '30 1 1,15 * *' # Triggers at 1:30am UTC every 2 weeks on the 1st and the 15th day of each month
57+
```
58+
59+
#### Custom List of Dependencies to Cap
60+
61+
With each release, some library maintainers may want to cap the version of certain dependencies within their `requirements.txt` file as well as specify the desired upper cap for each one.
62+
63+
The list of dependencies to cap should be provided in a file called `automated-release-config.yml`. This configuration file may be expanded in the future to accommodate more configurations as needed. Example:
64+
65+
```yaml
66+
release:
67+
68+
dependency_caps:
69+
enable: true # optional parameter. If set to false, then none of the dependencies in `requirements.txt` will be capped.
70+
packages:
71+
instructlab-sdg: "+0.1.0"
72+
instructlab-eval: "+0.2.0"
73+
instructlab-training: "+1.0.0"
74+
```
75+
76+
The keys specify the dependencies to cap. (In this case, we only have three: `instructlab-sdg`, `instructlab-eval`, and `instructlab-training`. The other dependencies in the `requirements.txt` file will be ignored and left untouched.)
77+
78+
The value for each key specifies the cap relative to the current lower bound. For example, let's say the current `requirements.txt` file looks like this:
79+
80+
```bash
81+
instructlab-sdg>0.20.0
82+
instructlab-eval>0.1.0
83+
instructlab-training
84+
```
85+
86+
In this case, the automated logic will create a pull request that updates the `requirements.txt` file like so (ignoring the inline explanations I provided as comments):
87+
88+
```bash
89+
instructlab-sdg>0.20.0,<=0.21.0 # increment by 0.1.0 because of the '+0.1.0' in the `cap-deps.cfg` file
90+
instructlab-eval>0.1.0,<=0.3.0 # increment by 0.2.0 because of the '+0.2.0' in the `cap-deps.cfg` file
91+
instructlab-training # do nothing because there was no lower bound set.
92+
```
93+
94+
If `dependency_caps` is not defined or `enable` is set to `False` under the `dependency_caps` key, then none of the dependencies defined in `requirements.txt` will be capped. If a dependency to cap is defined in `dependency_caps` and that dependency doesn't exist, then it will be ignored.
95+
96+
### Example Workflow File
97+
98+
Below is an example workflow file used to call this in-house GitHub action:
99+
100+
```yaml
101+
name: Create Y-Stream Release
102+
103+
on:
104+
# Run every Monday at 1AM UTC
105+
schedule:
106+
- cron: '0 7 * * 1 '
107+
108+
# Allow manual dispatch, too
109+
workflow_dispatch:
110+
inputs:
111+
pr_or_branch:
112+
description: 'pull request number or branch name'
113+
required: true
114+
default: 'main'
115+
116+
jobs:
117+
create-release:
118+
runs-on: ubuntu-latest
119+
steps:
120+
- name: "create-automated-release"
121+
uses: instructlab/ci-actions/create-automated-release@v1
122+
```
123+
124+
### Y-Stream Release Flow Diagram
125+
126+
![Automated workflow for creating new GitHub releases](../images/design-diagram-for-automated-releases.png)
127+
128+
## Z-Stream Release Automation Workflow
129+
130+
### Overview of Z-Stream Release Automation
131+
132+
To be added at a later date.
Loading

0 commit comments

Comments
 (0)