Trigger builds of snaps and ubuntu imagesthrough the launchpad API.
Project description
canonicalwebteam.launchpad
Classes for triggering builds of snaps and Ubuntu images through the Launchpad API.
Usage
SnapBuilder
from canonicalwebteam.launchpad import SnapBuilder
snap_builder = SnapBuilder(
username="build.snapcraft.io",
token=os.getenv("SNAP_BUILDER_TOKEN"),
secret=os.getenv("SNAP_BUILDER_SECRET"),
)
snap_name = "new-test-snap"
git_repo = "https://github.com/build-staging-snapcraft-io/test1"
snap_builder.create_snap(snap_name, git_repo)
new_snap = snap_builder.get_snap_by_store_name("new-test-snap")
ImageBuilder
from canonicalwebteam.launchpad import ImageBuilder
image_builder = ImageBuilder(
username="image.build",
token=os.getenv("IMAGE_BUILDER_TOKEN"),
secret=os.getenv("IMAGE_BUILDER_SECRET"),
)
image_builder.build_image(
board="cm3", system="core16", snaps=["code", "toto"]
)
Test fixtures
Tests check calls against fixtures representing the Launchpad API. These fixtures are generated using vcrpy, based on real calls to the API when the test was first run.
To new tests that rely on new API responses, or if we need to regenerate existing fixtures because the API has changed, the secrets need to be provided to authenticate with the API as follows:
export SNAP_BUILDER_TOKEN={token}
export SNAP_BUILDER_SECRET={secret}
export IMAGE_BUILDER_TOKEN={token}
export IMAGE_BUILDER_SECRET={secret}
rm tests/cassettes/... # Remove any fixtures you need to regenerate
./setup.py test # Run tests again to regenerate fixtures
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file canonicalwebteam.launchpad-0.7.5.tar.gz
.
File metadata
- Download URL: canonicalwebteam.launchpad-0.7.5.tar.gz
- Upload date:
- Size: 5.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.4.0 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.7.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 926f3875fb0c1dd53e5b72998cb6f86674ff3c8a0cdde930789ca4dd4c3d1561 |
|
MD5 | 36ae0aba8ac76e5d50c63194a38e2751 |
|
BLAKE2b-256 | 5574ca820676516f423e0750d2f246ddce60212f5f6debe9cde1c84bc360a788 |
File details
Details for the file canonicalwebteam.launchpad-0.7.5-py3-none-any.whl
.
File metadata
- Download URL: canonicalwebteam.launchpad-0.7.5-py3-none-any.whl
- Upload date:
- Size: 10.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.4.0 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.7.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 985d371b3e910e3ebe81f21aae24602bd98ebf12d62f64800ac19864c93a4c12 |
|
MD5 | 64c204962a39a5df205d30b7344f6386 |
|
BLAKE2b-256 | 2a4d9bb6ee13dd1d98b328f303d516123010c8ce0c14310fc2ea57f3114cf768 |