Skip to main content

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

canonicalwebteam.launchpad-0.8.4.tar.gz (9.2 kB view details)

Uploaded Source

Built Distribution

File details

Details for the file canonicalwebteam.launchpad-0.8.4.tar.gz.

File metadata

File hashes

Hashes for canonicalwebteam.launchpad-0.8.4.tar.gz
Algorithm Hash digest
SHA256 b390382415e19f92d3134fb0ec03e9ca8e8d423ee9850acf72b8dbf8137f084d
MD5 52c681870d063b10202697786b15e203
BLAKE2b-256 e6d9522307e07ba4f9a4720ed9dfab56fdb934e48a0583cd86e3cb61bc689e44

See more details on using hashes here.

File details

Details for the file canonicalwebteam.launchpad-0.8.4-py3-none-any.whl.

File metadata

File hashes

Hashes for canonicalwebteam.launchpad-0.8.4-py3-none-any.whl
Algorithm Hash digest
SHA256 25e4b4018cc4e4888c9f00934c2e8e1f8fdd689301281eebb4fb234f141e3f58
MD5 69a03cbd654d30bffa3277bcbf0e8b10
BLAKE2b-256 4d74ce68d3cf60359130501de3608bb01fa60dce56e25145354c67c614177268

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page