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

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.1.3.tar.gz (4.3 kB view details)

Uploaded Source

Built Distribution

File details

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

File metadata

  • Download URL: canonicalwebteam.launchpad-0.1.3.tar.gz
  • Upload date:
  • Size: 4.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/45.1.0 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.7.6

File hashes

Hashes for canonicalwebteam.launchpad-0.1.3.tar.gz
Algorithm Hash digest
SHA256 9b37b4befecc4a34daa788bdf7bf32740ff42b9b7aec87f1b527a12a695a998f
MD5 0a9fd85e9b398efa7eb9f05ea4113f6c
BLAKE2b-256 3f121b27bdb4731443e2fc0c2c9054dce5e5200c383b4e233c44de7d9802b1a4

See more details on using hashes here.

File details

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

File metadata

  • Download URL: canonicalwebteam.launchpad-0.1.3-py3-none-any.whl
  • Upload date:
  • Size: 9.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/45.1.0 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.7.6

File hashes

Hashes for canonicalwebteam.launchpad-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 10baf41d39659924acc76facfedba5a1e24f37fa5ab47a7819a46155c86753a2
MD5 449d9dc741508b302b13c503e2888aae
BLAKE2b-256 4aa9d04df995dac56099c9b829ddd0782e386fd280bde6bbebdc174aa7e077dc

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