Skip to content

Commit 2901446

Browse files
author
Arvind Iyengar
authored
Merge pull request #89 from stormqueen1990/update-docs-formatting
Update docs formatting + small fixes
2 parents 2c83d79 + 59f938f commit 2901446

File tree

4 files changed

+46
-45
lines changed

4 files changed

+46
-45
lines changed

templates/template/docs/developing.md

Lines changed: 32 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -49,49 +49,50 @@ subdirectory: charts/mychart # optional
4949
### Making Changes To Packages
5050

5151
As a developer making changes to a particular package, you will usually follow the following steps:
52+
5253
0. If you are working with a single `Package`, set `export PACKAGE=<packageName>`
53-
- Note: This inform the scripts that you only want to make changes to a particular package. This will prevent the scripts from running commands on every package in this repository.
54-
- Note: Starting v0.3.0 of the scripts, `PACKAGE` can refer to a nested structure, e.g. you can place packages under `packages/my-stuff/package-1` and `packages/my-stuff/package-2`. If you want to target all packages in this nested structure, set `PACKAGE=my-stuff`. If you want to target a specific package in this nested structure, set `PACKAGE=my-stuff/package-1`. It should be noted, however, that `make patch` will **only** work if you point to a specific package, so setting `PACKAGE=my-stuff` would cause it to fail.
55-
1. If necessary, update the `version` or `packageVersion` field in the `package.yaml`. Then run `make charts` and commit the changes.
56-
- Note: It is recommended that your commit message says something along the lines of `Bump ${PACKAGE} version to ${NEW_VERSION}`.
54+
- Note: This informs the scripts that you only want to make changes to a particular package. This will prevent the scripts from running commands on every package in this repository.
55+
- Note: Starting v0.3.0 of the scripts, `PACKAGE` can refer to a nested structure, e.g. you can place packages under `packages/my-stuff/package-1` and `packages/my-stuff/package-2`. If you want to target all packages in this nested structure, set `PACKAGE=my-stuff`. If you want to target a specific package in this nested structure, set `PACKAGE=my-stuff/package-1`. It should be noted, however, that `make patch` will **only** work if you point to a specific package, so setting `PACKAGE=my-stuff` would cause it to fail.
56+
1. If necessary, update the `version` or `packageVersion` field in the `package.yaml`. Then run `make charts` and commit the changes.
57+
- Note: It is recommended that your commit message says something along the lines of `Bump ${PACKAGE} version to ${NEW_VERSION}`.
5758
2. Run `make prepare`. This will produce a chart under `packages/${PACKAGE}/charts` that will serve as your working copy of the chart.
58-
3. Make modifications **directly** to the working copy of the chart in `packages/${PACKAGE}/charts`.
59-
- Note: **Do not modify `charts/${PACKAGE}/${CHART}/${VERSION}/` directly** since it will be overridden by changes to `packages/${PACKAGE}/charts`.
59+
3. Make modifications **directly** to the working copy of the chart in `packages/${PACKAGE}/charts`.
60+
- Note: **Do not modify `charts/${PACKAGE}/${CHART}/${VERSION}/` directly** since it will be overridden by changes to `packages/${PACKAGE}/charts`.
6061
4. When you are happy with your changes, run `make patch`. This will automatically construct a `packages/${PACKAGE}/generated-changes` directory after assessing your current working directory in `packages/${PACKAGE}/charts`.
61-
- Note: **You should never directly modify `packages/${PACKAGE}/generated-changes`** unless you are trying to change `packages/${PACKAGE}/generated-changes/dependencies` to update your chart dependencies. This directory is automatically constructed / destroyed by `make patch` to save the least amount of information necessary to reconstruct your working directory on a `make prepare`.
62+
- Note: **You should never directly modify `packages/${PACKAGE}/generated-changes`** unless you are trying to change `packages/${PACKAGE}/generated-changes/dependencies` to update your chart dependencies. This directory is automatically constructed / destroyed by `make patch` to save the least amount of information necessary to reconstruct your working directory on a `make prepare`.
6263
5. Run `make clean` to clean up your working directory. Then, commit your changes to Git with a commit message that indicates what you have changed.
63-
- Note: **To avoid losing unsaved changes, do not run `make clean` unless you have already ran `make patch`.** `make clean` will delete the `packages/${PACKAGE}/charts` directory, so any modifications you made to the working copy of the chart will be lost.
64+
- Note: **To avoid losing unsaved changes, do not run `make clean` unless you have already ran `make patch`.** `make clean` will delete the `packages/${PACKAGE}/charts` directory, so any modifications you made to the working copy of the chart will be lost.
6465
6. To test your changes, run `make charts`. This will automatically create an `assets/${PACKAGE}/${CHART}-${VERSION}.tgz`, the `charts/${PACKAGE}/${CHART}/${VERSION}/` directory, and create or modify an existing `index.yaml`. Commit these changes to Git, usually with a commit titled `make charts`.
65-
- Note: If you push the `make charts` commit to a repository, that repository would be a valid Helm repository to serve your chart.
66+
- Note: If you push the `make charts` commit to a repository, that repository would be a valid Helm repository to serve your chart.
6667

67-
If you need to make additional changes after testing, repeat steps 2-6.
68+
If you need to make additional changes after testing, repeat steps 2-6.
6869

6970
If your repository is configured to use upstream validation (e.g. check if `validation.url` and `validation.branch` is specified in the root `configuration.yaml`), you will also need to add this new chart's name and version to the `release.yaml` or else you will fail CI. If you run `make validate` locally, it will automatically generate this file for you.
7071

71-
For more information on how to do this or why this is required, please see [`docs/validation.md`](docs/validation.md).
72+
For more information on how to do this or why this is required, please see [`docs/validation.md`](validation.md).
7273

7374
Otherwise, you are ready to make a PR!
7475

7576
### Rebasing An Existing Package
7677

77-
For forked charts only (e.g. any chart where the `package.yaml` does not have `url: local`), currently the scripts do not have good support for rebasing charts to a new upstream.
78+
For forked charts only (e.g. any chart where the `package.yaml` does not have `url: local`), currently the scripts do not have good support for rebasing charts to a new upstream.
7879

7980
The reason why this is the case is that the patch files defined under `packages/${PACKAGE}/generated-changes/patch/*` are based on the old upstream, so when you change the URL it is unable to reconcile how to apply the patch.
8081

8182
Therefore, the best way to currently rebase is to follow the following workflow:
8283

8384
0. Set `PACKAGE=<packageName>` pointing to the specific package you want to work with.
84-
1. If the chart has not been released yet, delete your existing charts, assets, and `index.yaml` entries corresponding to the chart you are rebasing by running `CHART=<chart> VERSION=<version> make remove` for each chart (e.g. if you have a chart that also packages a CRD chart, you will need to run `make remove` twice for the main chart and the CRD chart). Then, commit your changes to Git with a commit message that says "Remove charts/assets for ${CHART} ${VERSION}"
85+
1. If the chart has not been released yet, delete your existing charts, assets, and `index.yaml` entries corresponding to the chart you are rebasing by running `CHART=<chart> VERSION=<version> make remove` for each chart (e.g. if you have a chart that also packages a CRD chart, you will need to run `make remove` twice for the main chart and the CRD chart). Then, commit your changes to Git with a commit message that says "Remove charts/assets for <CHART> <VERSION>"
8586
2. Without making any other changes, run `make prepare`. This will apply your existing patches on your existing upstream to produce `packages/${PACKAGE}/${workingDir}` (usually `packages/${PACKAGE}/charts`).
8687
3. Modify the `package.yaml` to point to your new upstream.
87-
4. Run `make patch`. This will destroy the current contents of `packages/${PACKAGE}/generated-changes` and reconstruct everything as if you were patching the new upstream with your **existing** chart.
88-
5. Run `make clean`. Then, commit your changes to Git with a commit message that says "Rebase ${PACKAGE} from ${OLD_REF} to ${NEW_REF}"; this will make it easier for reviewers to see what you actually introduced in the next commit.
88+
4. Run `make patch`. This will destroy the current contents of `packages/${PACKAGE}/generated-changes` and reconstruct everything as if you were patching the new upstream with your **existing** chart.
89+
5. Run `make clean`. Then, commit your changes to Git with a commit message that says "Rebase <PACKAGE> from <OLD_REF> to <NEW_REF>"; this will make it easier for reviewers to see what you actually introduced in the next commit.
8990
6. Follow the same developer workflow as defined under `Making Changes to Packages` to change the version, add back in changes introduced by upstream, and generate charts / assets.
9091

9192
Once these steps are compplete, you should have something similar to the following four commits:
92-
1. "Remove charts/assets for ${CHART} ${VERSION}"
93-
2. "Rebase ${PACKAGE} from ${OLD_REF} to ${NEW_REF}"
94-
3. "Add changes from rebasing ${CHART} to ${NEW_VERSION}"
93+
1. "Remove charts/assets for <CHART> <VERSION>"
94+
2. "Rebase <PACKAGE> from <OLD_REF> to <NEW_REF>"
95+
3. "Add changes from rebasing <CHART> to <NEW_VERSION>"
9596
4. "make charts"
9697

9798
As a result, developers reviewing your chart can see changes made to `packages/` by reviewing changes between commit 2 and commit 3; they can also inspect changes introduced to `charts/` by viewing the overall diff on the PR, since the old assets will show as renamed / modified.
@@ -100,25 +101,25 @@ You are ready to make a PR!
100101

101102
### Known Issue: Making Changes to the Version of an Existing Package
102103

103-
If you are working with a repository using `charts-build-scripts` that uses remote validation (e.g. `validate.url` and `validate.branch` are provided in the `configuration.yaml`) and you are making a change that would modify the version of an existing package (e.g. replacing a version like `0.1.2-rc3` with `0.1.2-rc4`), please see the section `Modifying Chart Versions That Exist In Upstream` within [`docs/validation.md`](docs/validation.md) for how to ensure CI still passes after making your change.
104+
If you are working with a repository using `charts-build-scripts` that uses remote validation (e.g. `validate.url` and `validate.branch` are provided in the `configuration.yaml`) and you are making a change that would modify the version of an existing package (e.g. replacing a version like `0.1.2-rc3` with `0.1.2-rc4`), please see the section `Modifying Chart Versions That Exist In Upstream` within [`docs/validation.md`](validation.md) for how to ensure CI still passes after making your change.
104105

105106
### Versioning Packages
106107

107108
Generally, repositories that are using `charts-build-scripts` use one of the following two types of built-in versioning schemes for packages:
108109

109110
#### Version
110111

111-
This versioning scheme is used if `version` is specified in the `package.yaml`.
112+
This versioning scheme is used if `version` is specified in the `package.yaml`.
112113

113-
If a valid semver for `version` is provided, the final version of the chart will be the same as the `version` provided.
114+
If a valid semver for `version` is provided, the final version of the chart will be the same as the `version` provided.
114115

115-
The only caveat is that **if** the main chart corresponds to some upstream chart whose chart version is not the same as the `version` provided, then the upstream version will be appended as a build annotation following the pattern `<version>+up<upstreamVersion>`.
116+
The only caveat is that **if** the main chart corresponds to some upstream chart whose chart version is not the same as the `version` provided, then the upstream version will be appended as a build annotation following the pattern `<version>+up<upstreamVersion>`.
116117

117118
*e.g. If `version` is 100.0.0 and the upstream chart's version is `1.2.3`, the final version will be `100.0.0+up1.2.3`.*
118119

119120
#### PackageVersion
120121

121-
This versioning scheme is used if `packageVersion` is specified in the `package.yaml`.
122+
This versioning scheme is used if `packageVersion` is specified in the `package.yaml`.
122123

123124
If a two-digit `packageVersion` is provided, the final version of the chart that is produced under the generated assets will be the same as the version specified by the main chart in the package, except the patch version of will be `int(originalPatchVersion * 100 + packageVersion)`.
124125

@@ -132,21 +133,21 @@ Examples:
132133

133134
You should generally update the `packageVersion` **once per release**.
134135

135-
If the chart version you are currently modifying has already been released before, you should **bump the `packageVersion` by 1** to ensure you aren't modifying an already released chart.
136+
If the chart version you are currently modifying has already been released before, you should **bump the `packageVersion` by 1** to ensure you aren't modifying an already released chart.
136137

137138
*e.g. if chart version `1.2.301` is released, bumping the `packageVersion` to `2` will result in `1.2.302` being released next.*
138139

139-
If the chart version you are currently modifying has never been released before, you should **reset the `packageVersion` to 1**.
140+
If the chart version you are currently modifying has never been released before, you should **reset the `packageVersion` to 1**.
140141

141-
*e.g. if chart version `1.2.301` is released but you are currently working on releasing a package based on `1.3.0`, you should reset the `packageVersion` to `1` to release `1.3.1`.*
142+
*e.g. if chart version `1.2.301` is released, but you are currently working on releasing a package based on `1.3.0`, you should reset the `packageVersion` to `1` to release `1.3.1`.*
142143

143144
*Note: You should reset the packageVersion to 1 instead of 0 since the scripts will always introduce at least one change to the chart.*
144145

145146
### Updating Dependencies / Subcharts
146147

147-
The scripts used to maintain this repository natively supports managing dependencies / subcharts for Helm charts.
148+
The scripts used to maintain this repository natively supports managing dependencies / subcharts for Helm charts.
148149

149-
Subcharts can be added by creating a file under `packages/${PACKAGE}/generated-changes/dependencies/${SUBCHART}/dependency.yaml`.
150+
Subcharts can be added by creating a file under `packages/${PACKAGE}/generated-changes/dependencies/${SUBCHART}/dependency.yaml`.
150151

151152
The following utility script can be used to create the necessary `dependency.yaml` file in the right location:
152153

@@ -169,14 +170,14 @@ Once declared, `make prepare` will automatically pull in your dependency under `
169170

170171
#### Known Issue: Managed Files
171172

172-
In any Helm chart managed by these scripts, we consider the `Chart.yaml` / `requirements.yaml` to be `Managed Files` since they are the only files that end up going through a three-way merge.
173+
In any Helm chart managed by these scripts, we consider the `Chart.yaml` / `requirements.yaml` to be `Managed Files` since they are the only files that end up going through a three-way merge.
173174

174175
Specifically, the three-way merge occurs because there are three parties involved in applying changes on a `make prepare`:
175176
1. The upstream chart source, which provides the base `Chart.yaml` / `requirements.yaml`
176177
2. The scripts themselves, which make changes to support adding in dependencies based on those specified under `generated-changes/dependencies`.
177178
3. The user, who commits patches to those files after running `make patch`
178179

179-
As a result, on updating dependencies for charts, these files are prone to having conflicts.
180+
As a result, on updating dependencies for charts, these files are prone to having conflicts.
180181

181182
The only workaround for this issue is to delete the patch files manually (e.g. `rm packages/${PACKAGE}/generated-changes/patch/Chart.yaml.patch` and/or `rm packages/${PACKAGE}/generated-changes/patch/requirements.yaml.patch`), run `make prepare`, and redo the patches you added to these files manually.
182183

@@ -189,7 +190,7 @@ If a chart version that you want to make changes to has already been released (i
189190

190191
In addition, if your repository is configured to use upstream validation (e.g. check if `validation.url` and `validation.branch` is specified in the root `configuration.yaml`), you will also need to add this modified chart's name and version to the `release.yaml` or else you will fail CI. If you run `make validate` locally, it will automatically generate this file for you.
191192

192-
For more information on how to do this or why this is required, please see [`docs/validation.md`](docs/validation.md).
193+
For more information on how to do this or why this is required, please see [`docs/validation.md`](validation.md).
193194

194195
Otherwise, you are ready to make a PR!
195196

0 commit comments

Comments
 (0)