---
# System prepended metadata

title: '[THIS DOCUMENT HAS MOVED HERE](https://github.com/cloud-custodian/cloud-custodian/discussions/7509)'

---

# [THIS DOCUMENT HAS MOVED HERE](https://github.com/cloud-custodian/cloud-custodian/discussions/7509)

If you make significant changes tell Jorge  so we can fix it in github discussions

### Release Checklist Notes

## Package steps


## Set up keyring with test pypi/pypi

Edit `$HOME/.pypirc` to define `pypi` and `testpypi` repositories as follows:

```
[distutils]
index-servers =
    pypi
    testpypi

[pypi]
repository = https://upload.pypi.org/legacy/
username = __token__

[testpypi]
repository = https://test.pypi.org/legacy/
username = __token__
```

The `__token__` username works in tandem with a [PyPI API token](https://pypi.org/help/#apitoken). The token can be stored in [keyring](https://pypi.org/project/keyring/) rather than hardcoded into your config file, using commands like:

    echo "pypi-<rest of testpypi api token>" | keyring set https://test.pypi.org/legacy/ __token__
    echo "pypi-<rest of pypi api token>" | keyring set https://upload.pypi.org/legacy/ __token__

That will allow `twine` to fetch your token during the publishing step later.

## Clean checkout and clean virtualenv

Do a completely fresh checkout, never use a working branch for releases:

    make install-poetry

## Create Changelog

    python tools/dev/changelog.py --since 0.9.14.0 --path . --output Changelog.md

Some "bad commit" warnings here are OK - it means the changelog generation sees something off about the commit message and moves it to "other".

Open the Changelog in a text editor and adjust accordingly so that it makes sense for humans. 

## Generate frozen deps

    make pkg-freeze-setup
      
Comment out pywin32 dep here until we fix it for real:

    $EDITOR tools/c7n_azure/setup.py


    git diff
    poetry install
    
Note: be careful when publishing to pypi - you can only publish a given version of a package once. If you make a mistake, you need to bump the version number.

This command will build and test wheels _but not publish them_ yet.

    make pkg-publish-wheel

Once wheels are built, you can test installing all of them side-by-side in a new virtual environment to sort out any dependency conflicts locally before publishing:

    python -m venv test-custodian-release
    source test-custodian-release/bin/activate  # or activate.fish, etc
    find . -maxdepth 4 -iname "*.whl" | sort | xargs pip install
    
And run test policies across multiple providers as an additional smoke test. If everything looks good, you can continue to the publishing phase.

If there are new packages check https://test.pypi.org/project/c7n/ to check your work, then add the owner usernames. Then publish packages to test PyPI (it will not prompt you if you have your token/keychain set up correctly):

    make pkg-publish-wheel
    
We can derive the expected versions of all packages from the locally built wheels, and ensure that those versions install from testpypi without error into your release testing virtual environment:

    # translate wheel paths like ./dist/c7n-0.9.17-py3-none-any.whl to the
    # pip constraints like c7n==0.9.17 and install those hard dependencies
    # from testpypi, falling back to "real pypi" to fetch non-c7n dependencies
    #
    find . -maxdepth 4 -iname "*.whl" \
    | sort | sed -E 's/.*(c7n.*)-(.*)-py3.*/\1==\2/' \
    | xargs python -m pip install \
        --index-url https://test.pypi.org/simple \
        --extra-index-url https://pypi.org/simple

Ensure these commands finish and produce the expected output:

    custodian version
    custodian schema --json > file.txt 
    custodian schema gcp
    
Put the changelog in your copy buffer for the next step

    cat Changelog.md | pbcopy # OSX-only
    cat Changelog.md | xsel -c # Linux/X11 only
    
## Create a new release on c7n repo

Paste in changelog when making a release.

- Create a new tag
- 

Github [documentation on managing releases](https://docs.github.com/en/repositories/releasing-projects-on-github/managing-releases-in-a-repository)

## create a test policy to test it
 
 Grab an example policy from the examples repo or use your own:
 
    $EDITOR policies.yaml
    custodian run policies.yaml
    
Ensure you test a policy for AWS, GCP, Azure, and any other cloud provider c7n supports. [link to examples repo]

# update PKG_REPO in Makefile

    make pkg-publish-wheel

## Announce

Publish announcement to the [c7n mailing list] and [gitter channel].