Skip to content

Commit

Permalink
Merge pull request #124 from freedomofpress/wheels-via-git-lfs
Browse files Browse the repository at this point in the history
Converts wheel storage from S3 to git-lfs
  • Loading branch information
conorsch committed Jan 14, 2020
2 parents f72825d + deba9e7 commit 1284cd5
Show file tree
Hide file tree
Showing 74 changed files with 288 additions and 165 deletions.
31 changes: 0 additions & 31 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,6 @@ common-steps:
name: Install Debian packaging dependencies
command: make install-deps

- &fetchwheels
run:
name: Download wheels and sources
command: make fetch-wheels

- &getlatestreleasedversion
run:
name: Get latest released version of the project
Expand Down Expand Up @@ -104,18 +99,6 @@ common-steps:
make $PKG_NAME
ls ~/debbuild/packaging/*.deb
- &installgitlfs
run:
name: Install Git LFS.
command: |
export GIT_LFS_VERSION=2.7.2
export GIT_LFS_CHECKSUM=89f5aa2c29800bbb71f5d4550edd69c5f83e3ee9e30f770446436dd7f4ef1d4c
wget https://github.com/git-lfs/git-lfs/releases/download/v$GIT_LFS_VERSION/git-lfs-linux-amd64-v$GIT_LFS_VERSION.tar.gz
sha256sum git-lfs-linux-amd64-v$GIT_LFS_VERSION.tar.gz | grep $GIT_LFS_CHECKSUM
tar xzf git-lfs-linux-amd64-v$GIT_LFS_VERSION.tar.gz
sudo mv git-lfs /usr/local/bin/git-lfs
git lfs install
- &addsshkeys
add_ssh_keys:
fingerprints:
Expand Down Expand Up @@ -190,7 +173,6 @@ jobs:
steps:
- checkout
- *installdeps
- *fetchwheels
- *clonesecuredroplog
- *getlatestreleasedversion
- *makesourcetarball
Expand All @@ -202,13 +184,11 @@ jobs:
steps:
- checkout
- *installdeps
- *fetchwheels
- *clonesecuredroplog
- *getnightlyversion
- *makesourcetarball
- *updatedebianchangelog
- *builddebianpackage
- *installgitlfs
- *addsshkeys
- *commitworkstationdebs

Expand All @@ -218,7 +198,6 @@ jobs:
steps:
- checkout
- *installdeps
- *fetchwheels
- *clonesecuredropclient
- *getlatestreleasedversion
- *makesourcetarball
Expand All @@ -230,13 +209,11 @@ jobs:
steps:
- checkout
- *installdeps
- *fetchwheels
- *clonesecuredropclient
- *getnightlyversion
- *makesourcetarball
- *updatedebianchangelog
- *builddebianpackage
- *installgitlfs
- *addsshkeys
- *commitworkstationdebs

Expand All @@ -246,7 +223,6 @@ jobs:
steps:
- checkout
- *installdeps
- *fetchwheels
- *clonesecuredropproxy
- *getlatestreleasedversion
- *makesourcetarball
Expand All @@ -258,13 +234,11 @@ jobs:
steps:
- checkout
- *installdeps
- *fetchwheels
- *clonesecuredropproxy
- *getnightlyversion
- *makesourcetarball
- *updatedebianchangelog
- *builddebianpackage
- *installgitlfs
- *addsshkeys
- *commitworkstationdebs

Expand All @@ -274,7 +248,6 @@ jobs:
steps:
- checkout
- *installdeps
- *fetchwheels
- *clonesecuredropexport
- *getlatestreleasedversion
- *makesourcetarball
Expand All @@ -286,13 +259,11 @@ jobs:
steps:
- checkout
- *installdeps
- *fetchwheels
- *clonesecuredropexport
- *getnightlyversion
- *makesourcetarball
- *updatedebianchangelog
- *builddebianpackage
- *installgitlfs
- *addsshkeys
- *commitworkstationdebs

Expand All @@ -302,7 +273,6 @@ jobs:
steps:
- checkout
- *installdeps
- *fetchwheels
- *setsvsdispname
- *setmetapackageversion
- *builddebianpackage
Expand All @@ -313,7 +283,6 @@ jobs:
steps:
- checkout
- *installdeps
- *fetchwheels
- *setsdgrsecname
- *setmetapackageversion
- *builddebianpackage
Expand Down
4 changes: 4 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
*.deb filter=lfs diff=lfs merge=lfs -text
*.rpm filter=lfs diff=lfs merge=lfs -text
*.tar.gz filter=lfs diff=lfs merge=lfs -text
*.whl filter=lfs diff=lfs merge=lfs -text
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
debhelper-build-stamp
*.debhelper.log
localwheels/
8 changes: 2 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,13 +1,9 @@
DEFAULT_GOAL: help

.PHONY: wheel-urls
wheel-urls: ## Creates download URLs from s3 bucket from sha256sums.txt file
wheel-urls: ## Creates download URLs for PyPI mirror from sha256sums.txt file
./scripts/createdownloadurls.py > wheelsurls.txt

.PHONY: fetch-wheels
fetch-wheels: ## Downloads wheels and sources from the remote server
./scripts/fetch-wheels

.PHONY: securedrop-proxy
securedrop-proxy: ## Builds Debian package for securedrop-proxy code
PKG_NAME="securedrop-proxy" ./scripts/build-debianpackage
Expand Down Expand Up @@ -44,7 +40,7 @@ requirements: ## Creates requirements files for the Python projects
./scripts/update-requirements

.PHONY: build-wheels
build-wheels: fetch-wheels ## Builds the wheels and adds them to the localwheels directory
build-wheels: ## Builds the wheels and adds them to the localwheels directory
./scripts/verify-sha256sum-signature
./scripts/build-sync-wheels -p ${PKG_DIR}
./scripts/sync-sha256sums
Expand Down
33 changes: 18 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,14 @@ In a Debian AppVM in Qubes:

```
make install-deps
make fetch-wheels
```

**Note:** either run `make install-deps` each time you start your debian packaging AppVM, or make
sure that you install them into the template for your debian packaging AppVM.

The install target will configure [git-lfs](https://git-lfs.github.com/), used for storing
binary wheel files.

## Updating Python wheels

Maintainers of `securedrop-client` and `securedrop-proxy` must ensure that
Expand All @@ -36,11 +38,7 @@ If new dependencies were added in the `requirements.txt` of that
repo that are not in the FPF PyPI mirror, then the maintainer needs
to do the following (we are taking `securedrop-client` project as example):

### 1. Sync the wheels locally

Sync all of the latest wheels `make fetch-wheels`

### 2. Create updated build-requirements.txt for the project
### 1. Create updated build-requirements.txt for the project

From the `securedrop-debian-packaging` directory,

Expand All @@ -59,8 +57,8 @@ pytest==3.10.1
Please build the wheel by using the following command.
PKG_DIR=/home/user/code/securedrop-client make build-wheels
Then sync the newly built wheels and sources to the s3 bucket.
Also update the index HTML files accordingly and sync to s3.
Then add the newly built wheels and sources to ./localwheels/.
Also update the index HTML files accordingly commit your changes.
After these steps, please rerun the command again.
```

Expand All @@ -84,18 +82,18 @@ python3 setup.py sdist
```


### 3. Sync the localwheels directory back to the s3 bucket. (if only any update of wheels)
### 2. Commit changes to the localwheels directory (if only any update of wheels)

This has to be manual step for security reasons. In future all of these wheel
building steps should be done by a different system, not with the devloper's
laptop.

```
cd localwheels/
aws s3 sync . s3://dev-bin.ops.securedrop.org/localwheels/
git add localwheels/
git commit
```

### 4. Update the index files for the bucket (required for Debian builds)
### 3. Update the index files for the bucket (required for Debian builds)

If there is any completely new Python package (source/wheel), then only we will have to update our index.

Expand All @@ -110,13 +108,18 @@ If there is a new package, then update the main index.
./scripts/updateindex.py
```

Finally sync the index.
Finally, submit a PR containing the new wheels and updated files.
If you wish to test the new wheels in a local build before submitting a PR,
or as part of PR review, you can do so by:

```
cd simple/
s3 sync . s3://dev-bin.ops.securedrop.org/simple/
python3 -m http.server # serve local wheels via HTTP
vim $PKG_NAME/debian/rules # edit index URL to http://localhost:8000/simple
```

Then run e.g. `PKG_VERSION=0.0.11 make securedrop-client`, and you'll see the GET
requests in the console running the HTTP server.

## Make a release

Summarizing release manager steps:
Expand Down
3 changes: 3 additions & 0 deletions localwheels/Mako-1.0.7-py3-none-any.whl
Git LFS file not shown
3 changes: 3 additions & 0 deletions localwheels/Mako-1.0.7.tar.gz
Git LFS file not shown
3 changes: 3 additions & 0 deletions localwheels/MarkupSafe-1.0-cp35-cp35m-linux_x86_64.whl
Git LFS file not shown
3 changes: 3 additions & 0 deletions localwheels/MarkupSafe-1.0-cp37-cp37m-linux_x86_64.whl
Git LFS file not shown
3 changes: 3 additions & 0 deletions localwheels/MarkupSafe-1.0.tar.gz
Git LFS file not shown
3 changes: 3 additions & 0 deletions localwheels/PyYAML-3.13-cp35-cp35m-linux_x86_64.whl
Git LFS file not shown
3 changes: 3 additions & 0 deletions localwheels/PyYAML-3.13.tar.gz
Git LFS file not shown
3 changes: 3 additions & 0 deletions localwheels/PyYAML-5.1-cp35-cp35m-linux_x86_64.whl
Git LFS file not shown
3 changes: 3 additions & 0 deletions localwheels/PyYAML-5.1-cp37-cp37m-linux_x86_64.whl
Git LFS file not shown
3 changes: 3 additions & 0 deletions localwheels/PyYAML-5.1.tar.gz
Git LFS file not shown
3 changes: 3 additions & 0 deletions localwheels/SQLAlchemy-1.2.13-cp35-cp35m-linux_x86_64.whl
Git LFS file not shown
3 changes: 3 additions & 0 deletions localwheels/SQLAlchemy-1.2.13.tar.gz
Git LFS file not shown
3 changes: 3 additions & 0 deletions localwheels/SQLAlchemy-1.3.3-cp35-cp35m-linux_x86_64.whl
Git LFS file not shown
3 changes: 3 additions & 0 deletions localwheels/SQLAlchemy-1.3.3-cp37-cp37m-linux_x86_64.whl
Git LFS file not shown
3 changes: 3 additions & 0 deletions localwheels/SQLAlchemy-1.3.3.tar.gz
Git LFS file not shown
3 changes: 3 additions & 0 deletions localwheels/Werkzeug-0.14.1-py2.py3-none-any.whl
Git LFS file not shown
3 changes: 3 additions & 0 deletions localwheels/Werkzeug-0.14.1.tar.gz
Git LFS file not shown
3 changes: 3 additions & 0 deletions localwheels/alembic-1.0.2-py2.py3-none-any.whl
Git LFS file not shown
3 changes: 3 additions & 0 deletions localwheels/alembic-1.0.2.tar.gz
Git LFS file not shown
3 changes: 3 additions & 0 deletions localwheels/arrow-0.12.1-py2.py3-none-any.whl
Git LFS file not shown
3 changes: 3 additions & 0 deletions localwheels/arrow-0.12.1.tar.gz
Git LFS file not shown
3 changes: 3 additions & 0 deletions localwheels/certifi-2018.10.15-py2.py3-none-any.whl
Git LFS file not shown
3 changes: 3 additions & 0 deletions localwheels/certifi-2018.10.15.tar.gz
Git LFS file not shown
3 changes: 3 additions & 0 deletions localwheels/chardet-3.0.4-py2.py3-none-any.whl
Git LFS file not shown
3 changes: 3 additions & 0 deletions localwheels/chardet-3.0.4.tar.gz
Git LFS file not shown
3 changes: 3 additions & 0 deletions localwheels/furl-2.0.0-py2.py3-none-any.whl
Git LFS file not shown
3 changes: 3 additions & 0 deletions localwheels/furl-2.0.0.tar.gz
Git LFS file not shown
3 changes: 3 additions & 0 deletions localwheels/idna-2.7-py2.py3-none-any.whl
Git LFS file not shown
3 changes: 3 additions & 0 deletions localwheels/idna-2.7.tar.gz
Git LFS file not shown
3 changes: 3 additions & 0 deletions localwheels/orderedmultidict-1.0-py3-none-any.whl
Git LFS file not shown
3 changes: 3 additions & 0 deletions localwheels/orderedmultidict-1.0.tar.gz
Git LFS file not shown
3 changes: 3 additions & 0 deletions localwheels/pathlib2-2.3.2-py2.py3-none-any.whl
Git LFS file not shown
3 changes: 3 additions & 0 deletions localwheels/pathlib2-2.3.2.tar.gz
Git LFS file not shown
3 changes: 3 additions & 0 deletions localwheels/python-dateutil-2.7.5.tar.gz
Git LFS file not shown
3 changes: 3 additions & 0 deletions localwheels/python-editor-1.0.3.tar.gz
Git LFS file not shown
3 changes: 3 additions & 0 deletions localwheels/python_dateutil-2.7.5-py2.py3-none-any.whl
Git LFS file not shown

0 comments on commit 1284cd5

Please sign in to comment.