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
Local development
For local development, it's best to test this module with one of our website projects like ubuntu.com. For more information, follow this guide (internal only).
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.9.0.tar.gz
.
File metadata
- Download URL: canonicalwebteam.launchpad-0.9.0.tar.gz
- Upload date:
- Size: 9.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | cade5e2d0fa06dcd473bda1cf7384f249ac368e4aad49ad80807df383148450f |
|
MD5 | 7c1ad0b15f024d0cfc74c5f1ff738b5d |
|
BLAKE2b-256 | 4aaab435d6f301131feb06455f2c9362f2ce62a7950dbce251049f7e5bacef80 |
File details
Details for the file canonicalwebteam.launchpad-0.9.0-py3-none-any.whl
.
File metadata
- Download URL: canonicalwebteam.launchpad-0.9.0-py3-none-any.whl
- Upload date:
- Size: 10.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | ec60a26aab1e18b5d0e4e662a93176f60caff611dac2f5e725b48039a6c8d3fa |
|
MD5 | 9b0c798d23ae582b4c22e356575b3722 |
|
BLAKE2b-256 | aeb1007fcb119096a2c8fa38acc6723148c56a74929ecd0b4e96e17319b2159f |