Skip to content

Commit 57fa7ab

Browse files
author
Elliot Boschwitz
authored
Release docs updated (#390)
1 parent 192edbf commit 57fa7ab

File tree

1 file changed

+98
-88
lines changed

1 file changed

+98
-88
lines changed

doc/release_guide.md

Lines changed: 98 additions & 88 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
1-
mssql-cli release guide
1+
mssql-cli Release Guide
22
========================================
33
# Table of Contents
4-
1. [Requirements](#Requirements)
5-
2. [Local builds](#Local)
6-
3. [Daily builds](#Daily)
7-
4. [Official builds](#Official)
8-
9-
# <a name="Requirements"></a> Requirements
10-
### Install Dependencies
4+
1. [Requirements](#requirements)
5+
2. [Creating a New Version](#creating-a-new-version)
6+
3. [Generating Release Files](#generating-release-files)
7+
4. [Publishing Release Files](#publishing-release-files)
8+
5. [Installing Specific Release Files from Azure Storage](#installing-specific-release-files-from-azure-storage)
9+
10+
11+
# Requirements
12+
## Installing Dependencies
1113
1. Add `<clone_root>` to your PYTHONPATH environment variable:
1214
#### Windows
1315
```
@@ -21,59 +23,24 @@ mssql-cli release guide
2123
```
2224
python <clone_root>/dev_setup.py
2325
```
24-
### Configure Azure Storage Account
26+
## Azure Storage Account Configuration
2527
1. The Azure Storage account needs a container named **daily**.
2628
2729
2. A sub folder named **mssql-cli** under the previous container.
2830
2931
3. Set the Azure Storage account connection string via environment variable. This will be the storage account where builds get published to.
30-
#### Windows
32+
33+
**Windows:**
3134
```
3235
set AZURE_STORAGE_CONNECTION_STRING=<connection string>
3336
```
3437
35-
#### MacOS/Linux
38+
**MacOS/Linux:**
3639
```
3740
export AZURE_STORAGE_CONNECTION_STRING='<connection_string>'
3841
```
3942
40-
# Create Builds
41-
## <a name="Local"></a>Local Builds
42-
The steps below outline how to build mssql-cli locally on your dev environment.
43-
### Build Instructions
44-
1. To build a wheel package for the current platform, run:
45-
```
46-
python build.py build
47-
```
48-
49-
### Installation Instructions
50-
2. The prior build step created a wheel package, located in the `./dist/` folder. To test the installation of this wheel package, execute the following from `<clone_root>`, replacing values for `<version>` and `<timestamp>`:
51-
```
52-
sudo pip install --no-index -i ./dist/mssql_cli-<version>.dev<timestamp>-py2.py3-none-win_amd64.whl
53-
```
54-
55-
## <a name="Daily"></a>Daily Builds
56-
The steps below outline how daily builds of mssql-cli are generated. These steps run on each supported platform via Visual Studio Team Services.
57-
### Build Instructions
58-
1. Build mssql-cli:
59-
```
60-
python build.py build
61-
```
62-
63-
2. Publish build to daily storage account:
64-
```
65-
python release.py publish_daily
66-
```
67-
### Installation Instructions
68-
3. Test install from daily storage account:
69-
```
70-
pip install --pre --no-cache --extra-index-url https://mssqlcli.blob.core.windows.net/daily/whl mssql-cli
71-
```
72-
73-
## <a name="Official"></a>Official Builds
74-
The steps below outline how to build official builds and publish to PYPI.
75-
76-
### <a name="BumpVersion"></a>Bump Version
43+
# Creating a New Version
7744
The versioning format for `mssql-cli` uses the following naming scheme:
7845
7946
Versioning schema: {major}.{minor}.{patch}
@@ -83,60 +50,103 @@ To bump a particular segment of the version, from `<clone_root>` execute:
8350
> bumpversion major          ->  <b>2</b>.0
8451
> bumpversion minor          ->  1.<b>1</b>
8552
> bumpversion patch          -> 1.0.<b>1</b>
86-
8753
</pre>
8854
Check-in changes after running `bumpversion` and **validating the build output following a version bump**.
8955
9056
**Note**: bumpversion does not allow version bumping if your workspace has pending changes. This is to protect against any manual updates that may have been made which can lead to inconsistent versions across files. If you know what you are doing you can override this by appending `--allow-dirty` to the bumpversion command.
9157
92-
### Publish Build
93-
**Important: ensure that the build is uploaded from macOS.**
9458
95-
1. Add a .pypirc configuration file:
59+
# Generating Release Files
60+
The steps below outline how to create wheel and source distribution files to publish to Azure Storage, and eventually PyPI for official release.
9661
97-
- Create a .pypirc file in your user directory:
98-
#### Windows:
99-
Example: C:\Users\bob\.pypirc
100-
#### MacOS/Linux:
101-
Example: /Users/bob/.pypirc
102-
103-
- Add the following content to the .pypirc file, replace `your_username` and `your_passsword` with your account information created from step 1:
104-
```
105-
[distutils]
106-
index-servers=
107-
pypi
108-
109-
[pypi]
110-
username = sqlcli
111-
password = <Get Password from Azure Key Vault> (https://sqltoolssecretstore.vault.azure.net/secrets/PYPI-AccountName-sqlcli/)
112-
113-
```
114-
2. Set env var to indicate a official build:
115-
#### Windows
116-
```
117-
set MSSQL_CLI_OFFICIAL_BUILD=True
118-
```
62+
## Daily Release Configuration
63+
Release files are generated for daily release by default, as long as the `MSSQL_CLI_OFFICIAL_BUILD` environment variable is **not** set to `True`.
64+
65+
## Official Release Configuration
66+
The `MSSQL_CLI_OFFICIAL_BUILD` enviornment variable must be set to `True` before build files are created. Although this step can be completed locally, we recommend running production pipelines in Azure DevOps with the enviornment variable set for each run.
67+
68+
If configured locally, instructions per OS are as follows:
69+
- **Windows**: `set MSSQL_CLI_OFFICIAL_BUILD=True`
70+
- **macOS/Linux**: `export MSSQL_CLI_OFFICIAL_BUILD=True`
71+
72+
## Building Release Files
73+
To build a release package with wheel and source distribution files for the current platform, run:
74+
```
75+
python build.py build
76+
```
77+
Distribution files will be generated in `./dist/`. These files are eventually published to Azure Storage and PyPI for distribution.
78+
79+
**Note:** source distribution files will only get created on macOS. This platform was arbitrarily chosen to prevent redundant copies of source distributions when `build` is run on each platform in Azure DevOps.
80+
81+
# Publishing Release Files
82+
The following instructions outline how to publish release files once generated n the `./dist/` folder.
83+
84+
## Publishing Daily Builds to Azure Storage
85+
Publish build to daily storage account by calling:
86+
```
87+
python release.py publish_daily
88+
```
11989
120-
#### MacOS/Linux
121-
```
122-
export MSSQL_CLI_OFFICIAL_BUILD=True
123-
```
124-
3. Build for the current platform:
125-
```
126-
python build.py build
127-
```
90+
## Publishing Official Builds
91+
The steps below outline how to build official builds and publish to PyPI.
12892
129-
4. Publish to daily storage account:
130-
```
131-
python release.py publish_daily
132-
```
93+
### Configuration with PyPI
94+
A `.pypirc` configuration file must be created in order to publish to PyPI. Place in the following user directories.
95+
96+
Examples for each OS:
97+
* Windows: `C:\Users\bob\.pypirc`
98+
* MacOS/Linux: `/Users/bob/.pypirc`
99+
100+
Add the below contents to the `.pypirc` file. **Note**: consult the mssql-cli OneNote for obtaining access to Azure Key Vault credentials, needed below.
101+
102+
```
103+
[distutils]
104+
index-servers=
105+
pypi
106+
testpypi
107+
108+
[pypi]
109+
username: sqlcli
110+
password: <Get Password from Azure Key Vault>
111+
112+
[testpypi]
113+
repository: https://test.pypi.org/legacy/
114+
username: sqlcli
115+
password: <Get Password from Azure Key Vault>
116+
```
117+
118+
### Test Publishing with TestPyPI
119+
120+
[TestPyPi](test.pypi.org) can be used to test distribution before going to production. To test publishing to TestPyPI, use the above `.pypirc` file and call:
121+
```
122+
twine upload --repository testpypi dist/*
123+
```
124+
125+
[Click here](https://packaging.python.org/guides/using-testpypi/) to view TestPyPI docs.
126+
127+
### Publishing Official Release Files to PyPI
128+
**Important: ensure that the build is uploaded from macOS.**
129+
130+
Follow the instructions below to publish a new release to PyPI after official release build files have been published to Azure Storage:
133131
134-
5. Download official wheels from storage account:
132+
1. Download official wheels from storage account:
135133
```
136134
python release.py download_official_wheels
137135
```
138136
139-
6. Publish downloaded wheels to PYPI:
137+
2. Publish downloaded wheels to PyPI:
140138
```
141139
python release.py publish_official
142140
```
141+
142+
# Installing Specific Release Files from Azure Storage
143+
To test the installation a wheel or source distribution, execute the following from `<clone_root>`, replacing values for `<version>` and `<timestamp>`:
144+
```
145+
pip install --no-index -i ./dist/mssql_cli-<version>.dev<timestamp>-py2.py3-none-win_amd64.whl
146+
```
147+
148+
149+
To install the latest release file from the daily storage account, call:
150+
```
151+
pip install --pre --no-cache --extra-index-url https://mssqlcli.blob.core.windows.net/daily/whl mssql-cli
152+
```

0 commit comments

Comments
 (0)