-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add pipeline for building Debian packages in CircleCI #44
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
--- | ||
common-steps: | ||
- &installdeps | ||
run: | ||
name: Install Debian packaging dependencies | ||
command: make install-deps | ||
|
||
- &fetchwheels | ||
run: | ||
name: Download wheels and sources | ||
command: make fetch-wheels | ||
|
||
- &makesourcetarball | ||
run: | ||
name: Get latest tag for the project and make a source tarball | ||
command: | | ||
cd ~/packaging/securedrop-* | ||
export LATEST_TAG="$(git describe --tags $(git rev-list --tags --max-count=1))" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nice solution on the tag lookup, I'd have gone with |
||
# Enable access to this env var in subsequent run steps | ||
echo $LATEST_TAG > ~/packaging/sd_version | ||
echo 'export LATEST_TAG=$(cat ~/packaging/sd_version)' >> $BASH_ENV | ||
# Create tarball | ||
git checkout $LATEST_TAG | ||
python3 setup.py sdist | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Crafty use of a fileglob to The major advantage I see to such a wrapper is that it'd be easy to run locally in case we need to debug CI. Also, until we have full CD on these packages, providing guardrails wherever possible on the local dev story seems like it'll save time and minimize mistakes. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Even if you agree it's worth wrapping further, let's definitely keep the separate "jobs" for each package: doing so greatly clarifies the CI results list on PRs, so it'll be obvious if a PR breaks on a specific package. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. just flagging that there is a makefile target that encapsulates the deb packaging logic in this repo and takes the package name: the step you're commenting on here is preparing the release tarball and is something that is ran in the repo to be packaged... while i could add a makefile target for this (or subsume this into the existing makefile target, and have it take the directory where |
||
|
||
version: 2.1 | ||
jobs: | ||
build-securedrop-client: | ||
docker: | ||
- image: circleci/python:3.5-stretch | ||
steps: | ||
- checkout | ||
- *installdeps | ||
- *fetchwheels | ||
|
||
- run: | ||
name: Clone the repository to be packaged | ||
command: | | ||
mkdir ~/packaging && cd ~/packaging | ||
git clone https://github.com/freedomofpress/securedrop-client.git | ||
|
||
- *makesourcetarball | ||
|
||
- run: | ||
name: Build securedrop-client debian package | ||
command: | | ||
export PKG_PATH=~/packaging/securedrop-client/dist/securedrop-client-$LATEST_TAG.tar.gz | ||
export PKG_VERSION=$LATEST_TAG | ||
make securedrop-client | ||
ls ~/debbuild/packaging/*.deb | ||
|
||
build-securedrop-proxy: | ||
docker: | ||
- image: circleci/python:3.5-stretch | ||
steps: | ||
- checkout | ||
- *installdeps | ||
- *fetchwheels | ||
|
||
- run: | ||
name: Clone the repository to be packaged | ||
command: | | ||
mkdir ~/packaging && cd ~/packaging | ||
git clone https://github.com/freedomofpress/securedrop-proxy.git | ||
|
||
- *makesourcetarball | ||
|
||
- run: | ||
name: Build securedrop-proxy debian package | ||
command: | | ||
export PKG_PATH=~/packaging/securedrop-proxy/dist/securedrop-proxy-$LATEST_TAG.tar.gz | ||
export PKG_VERSION=$LATEST_TAG | ||
make securedrop-proxy | ||
ls ~/debbuild/packaging/*.deb | ||
|
||
workflows: | ||
build-debian-packages: | ||
jobs: | ||
- build-securedrop-client | ||
- build-securedrop-proxy | ||
|
||
nightly: | ||
triggers: | ||
- schedule: | ||
cron: "0 5 * * *" | ||
filters: | ||
branches: | ||
only: | ||
- master | ||
jobs: | ||
- build-securedrop-client | ||
- build-securedrop-proxy |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hurray reusable steps!