diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index a5c3f506a4..0000000000 --- a/.travis.yml +++ /dev/null @@ -1,78 +0,0 @@ -language: bash -dist: bionic - -env: - global: - - LC_ALL: "C.UTF-8" - - LANG: "C.UTF-8" - - PATH: "/snap/bin:$PATH" - -jobs: - include: - - stage: snap - name: snap - workspaces: - create: - name: snaps - paths: - - "snapcraft-pr$TRAVIS_PULL_REQUEST.snap" - addons: - snaps: - - name: snapcraft - channel: stable - classic: true - - name: transfer - - name: http - apt: - packages: - - libapt-pkg-dev - - libffi-dev - - libnacl-dev - - libsodium-dev - - libssl-dev - - libyaml-dev - - python3.6-dev - script: - - snapcraft snap --destructive-mode --output "snapcraft-pr$TRAVIS_PULL_REQUEST.snap" - - sudo snap install "snapcraft-pr$TRAVIS_PULL_REQUEST.snap" --dangerous --classic - - snapcraft clean --destructive-mode - - snapcraft snap --destructive-mode --output "snapcraft-pr$TRAVIS_PULL_REQUEST.snap" - after_success: - - timeout 180 /snap/bin/transfer snapcraft-pr$TRAVIS_PULL_REQUEST.snap - after_failure: - - sudo journalctl -u snapd - - /snap/bin/http https://api.snapcraft.io/v2/snaps/info/core architecture==amd64 Snap-Device-Series:16 - - - stage: integration - name: store - workspaces: - use: snaps - if: head_repo = "canonical/snapcraft" - script: - - ./runtests.sh spread "google:ubuntu-18.04-64:tests/spread/general/store" - - - stage: docker - env: - RISK: "stable" - script: - - cd docker - - docker build --no-cache -f ${RISK}.Dockerfile --tag canonical/snapcraft:${RISK} . - - docker run canonical/snapcraft:${RISK} snapcraft --version - - env: - RISK: "edge" - script: - - cd docker - - docker build --no-cache -f ${RISK}.Dockerfile --tag canonical/snapcraft:${RISK} . - - docker run canonical/snapcraft:${RISK} snapcraft --version - - env: - RISK: "beta" - script: - - cd docker - - docker build --no-cache -f ${RISK}.Dockerfile --tag canonical/snapcraft:${RISK} . - - docker run canonical/snapcraft:${RISK} snapcraft --version - - env: - RISK: "candidate" - script: - - cd docker - - docker build --no-cache -f ${RISK}.Dockerfile --tag canonical/snapcraft:${RISK} . - - docker run canonical/snapcraft:${RISK} snapcraft --version diff --git a/HACKING.md b/HACKING.md index 68d976d7a5..ab505761f3 100644 --- a/HACKING.md +++ b/HACKING.md @@ -98,8 +98,9 @@ tox run -e lint-codespell ## Evaluating pull requests -Oftentimes all you want to do is see if a given pull request solves the issue you were having. To make this easier, the Travis CI setup for snapcraft _publishes_ the resulting snap that was built for x86-64 using `transfer.sh`. -To download the snap, find the relevant CI job run for the PR under review and locate the "snap" stage, the URL to download from will be located at the end of logs for that job. +Oftentimes all you want to do is see if a given pull request solves the issue you were having. To make this easier, a snap is published for `amd64` on a channel named `latest/edge/pr-` where `PR number` is the number of the pull request. + +For feature branches, a snap is published for `amd64` on a channel named `latest/edge/`. For example, a branch named `feature/offline-mode` would be available on the channel `latest/edge/offline-mode`. ## Reaching out diff --git a/README.md b/README.md index a8b6e875f8..e8b6707df8 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,4 @@ [![snapcraft](https://snapcraft.io/snapcraft/badge.svg)](https://snapcraft.io/snapcraft) -[![Build Status][travis-image]][travis-url] [![Documentation Status](https://readthedocs.com/projects/canonical-snapcraft/badge/?version=latest)](https://canonical-snapcraft.readthedocs-hosted.com/en/latest/?badge=latest) [![Scheduled spread tests](https://github.com/canonical/snapcraft/actions/workflows/spread-scheduled.yaml/badge.svg?branch=main)](https://github.com/canonical/snapcraft/actions/workflows/spread-scheduled.yaml) [![Coverage Status][codecov-image]][codecov-url] @@ -29,8 +28,5 @@ Learn about the latest features by following Snapcraft on We love contributors. Read the [hacking guide](HACKING.md) if you're interested in helping out. -[travis-image]: https://travis-ci.org/canonical/snapcraft.svg?branch=master -[travis-url]: https://travis-ci.org/canonical/snapcraft - [codecov-image]: https://codecov.io/github/canonical/snapcraft/coverage.svg?branch=master [codecov-url]: https://codecov.io/github/canonical/snapcraft?branch=master diff --git a/TESTING.md b/TESTING.md index 71a0be2e93..2d4671d6ce 100644 --- a/TESTING.md +++ b/TESTING.md @@ -40,14 +40,6 @@ These tests are in the `tests/integration` directory, with the `snapcraft.yamls` At any time, an integration test may fail and given the use of temporary directories it can be hard to inspect what went on. When working on a specific test case you can set the environment variable `SNAPCRAFT_TEST_KEEP_DATA_PATH` to a directory path for the sepecic test. This mechanism will only work when working with individual tests and will fail to run with a batch of them. -### Slow tests - -Some tests take too long. This affects the pull requests because we have to wait for a long time, and they will make Travis CI timeout because we have only 50 minutes per suite in there. The solution is to tag these tests as slow, and don't run them in all pull requests. These tests will only be run in autopkgtests. - -To mark a test case as slow, set the class attribute `slow_test = True`. - -To run all the tests, including the slow ones, set the environment variable `SNAPCRAFT_SLOW_TESTS=1`. - ### Snaps tests The snaps tests is a suite of high-level tests that try to simulate real-world scenarios of a user interacting with snapcraft. They cover the call to snapcraft to generate a snap file from the source files of a fully functional project, the installation of the resulting snap, and the execution of the binaries and services of this snap. @@ -120,35 +112,6 @@ We can currently run a minimal subset of snapcraft integration tests on macOS. T For manual exploratory testing, the team has one mac machine available. -## Autopkgtests for the snapcraft deb - -Autopkgtests are tests for the project packaged as a deb. The unit tests are run during autopkgtests while the snapcraft deb is being built. Then the resulting deb is installed, and the integration and snaps suites are executed using the installed snapcraft. - - -### How to run on Xenial - -The easiest way is to use a LXC container. From the root of the project, run: - - sudo apt install autopkgtest - adt-run --unbuilt-tree . --apt-upgrade --- lxd ubuntu:xenial - -It's possible to select only one of the suites using `--testname`, for example: - - adt-run --unbuilt-tree . --apt-upgrade --testname=integrationtests --- lxd ubuntu:xenial - - -### How to run on Bionic - -The easiest way is to use a LXC container. From the root of the project, run: - - sudo apt install autopkgtest - autopkgtest . -U -- lxd ubuntu:xenial - -It's possible to select only one of the suites using `--test-name`, for example: - - autopkgtest . -U --test-name=integrationtests-spread -- lxd ubuntu:xenial - - ## Spread tests for the snapcraft snap [Spread](https://github.com/canonical/spread) is a system to distribute tests and execute them in different backends, in parallel. We are currently using spread only to run the integration suite using the installed snapcraft snap from the edge channel. diff --git a/snapcraft/store/client.py b/snapcraft/store/client.py index bbb58aed43..dbde3a4daf 100644 --- a/snapcraft/store/client.py +++ b/snapcraft/store/client.py @@ -34,8 +34,6 @@ from ._legacy_account import LegacyUbuntuOne from .onprem_client import ON_PREM_ENDPOINTS, OnPremClient -_TESTING_ENV_PREFIXES = ["TRAVIS", "AUTOPKGTEST_TMP"] - _POLL_DELAY = 1 _HUMAN_STATUS = { "being_processed": "processing", @@ -51,13 +49,7 @@ def build_user_agent( os_platform: utils.OSPlatform = utils.get_os_platform(), # noqa: B008 ): """Build Snapcraft's user agent.""" - if any( - key.startswith(prefix) for prefix in _TESTING_ENV_PREFIXES for key in os.environ - ): - testing = " (testing) " - else: - testing = " " - return f"snapcraft/{version}{testing}{os_platform!s}" + return f"snapcraft/{version} {os_platform!s}" def use_candid() -> bool: diff --git a/snapcraft_legacy/storeapi/agent.py b/snapcraft_legacy/storeapi/agent.py index 04d516e75b..66c982829a 100644 --- a/snapcraft_legacy/storeapi/agent.py +++ b/snapcraft_legacy/storeapi/agent.py @@ -14,7 +14,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -import os import sys import snapcraft_legacy @@ -23,16 +22,6 @@ from snapcraft_legacy.internal.errors import OsReleaseNameError, OsReleaseVersionIdError -def _is_ci_env(): - env_prefixes = ["TRAVIS", "AUTOPKGTEST_TMP"] - matches = [] - - for prefix in env_prefixes: - matches += [var for var in os.environ.keys() if var.startswith(prefix)] - - return len(matches) > 0 - - def _get_linux_release(release: os_release.OsRelease) -> str: try: os_name = release.name() @@ -48,11 +37,10 @@ def _get_linux_release(release: os_release.OsRelease) -> str: def get_user_agent(platform: str = sys.platform) -> str: arch = project.Project().deb_arch - testing = "(testing) " if _is_ci_env() else "" if platform == "linux": os_platform = _get_linux_release(os_release.OsRelease()) else: os_platform = platform.title() - return f"snapcraft/{snapcraft_legacy.__version__} {testing}{os_platform} ({arch})" + return f"snapcraft/{snapcraft_legacy.__version__} {os_platform} ({arch})" diff --git a/spread.yaml b/spread.yaml index 039ef727b3..b7ac155b78 100644 --- a/spread.yaml +++ b/spread.yaml @@ -121,51 +121,6 @@ backends: username: root password: ubuntu - autopkgtest: - type: adhoc - allocate: | - echo "Allocating ad-hoc $SPREAD_SYSTEM" - if [ -z "${ADT_ARTIFACTS:-}" ]; then - FATAL "adhoc only works inside autopkgtest" - exit 1 - fi - echo 'ubuntu ALL=(ALL) NOPASSWD:ALL' > /etc/sudoers.d/99-spread-users - ADDRESS localhost:22 - discard: echo "Discarding ad-hoc $SPREAD_SYSTEM" - systems: - # Focal - - ubuntu-20.04-amd64: - username: ubuntu - password: ubuntu - - ubuntu-20.04-ppc64el: - username: ubuntu - password: ubuntu - - ubuntu-20.04-armhf: - username: ubuntu - password: ubuntu - - ubuntu-20.04-s390x: - username: ubuntu - password: ubuntu - - ubuntu-20.04-arm64: - username: ubuntu - password: ubuntu - # Jammy - - ubuntu-22.04-amd64: - username: ubuntu - password: ubuntu - - ubuntu-22.04-ppc64el: - username: ubuntu - password: ubuntu - - ubuntu-22.04-armhf: - username: ubuntu - password: ubuntu - - ubuntu-22.04-s390x: - username: ubuntu - password: ubuntu - - ubuntu-22.04-arm64: - username: ubuntu - password: ubuntu - exclude: [snaps-cache/] prepare: | @@ -342,14 +297,12 @@ suites: - ubuntu-20.04-64 - ubuntu-22.04-64 kill-timeout: 180m - warn-timeout: 9m # Keep less than 10 minutes so Travis can't timeout priority: 90 # Run this test relatively early since fetching images can take time tests/spread/providers/legacy/: summary: tests of snapcraft using build providers systems: - ubuntu-20.04-64 kill-timeout: 180m - warn-timeout: 9m # Keep less than 10 minutes so Travis can't timeout priority: 90 # Run this test relatively early since fetching images can take time # Plugin-specific suites diff --git a/tests/legacy/unit/store/test_agent.py b/tests/legacy/unit/store/test_agent.py index 0150c68bc9..acad3a0e13 100644 --- a/tests/legacy/unit/store/test_agent.py +++ b/tests/legacy/unit/store/test_agent.py @@ -14,9 +14,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -import os -import fixtures from testtools.matchers import Equals from snapcraft_legacy import ProjectOptions @@ -54,27 +52,3 @@ def test_user_agent_darwin(self): expected = f"snapcraft/{snapcraft_version} Darwin ({arch})" self.expectThat(agent.get_user_agent(platform="darwin"), Equals(expected)) - - def test_in_travis_ci_env(self): - self.useFixture(fixtures.EnvironmentVariable("TRAVIS_TESTING", "1")) - - self.assertTrue(agent._is_ci_env()) - - def test_in_autopkgtest_ci_env(self): - self.useFixture(fixtures.EnvironmentVariable("AUTOPKGTEST_TMP", "1")) - - self.assertTrue(agent._is_ci_env()) - - def test_not_in_ci_env(self): - # unset any known testing environment vars - testing_vars = ["TRAVIS", "AUTHPKGTEST_TMP"] - vars_to_unset = [] - for env_var in os.environ: - for test_var in testing_vars: - if env_var.startswith(test_var): - vars_to_unset.append(env_var) - - for var in vars_to_unset: - self.useFixture(fixtures.EnvironmentVariable(var, None)) - - self.assertFalse(agent._is_ci_env()) diff --git a/tests/spread/general/package-repositories/task.yaml b/tests/spread/general/package-repositories/task.yaml index 0c62af55b8..c7bfa0cb7f 100644 --- a/tests/spread/general/package-repositories/task.yaml +++ b/tests/spread/general/package-repositories/task.yaml @@ -30,12 +30,7 @@ execute: | cd "$SNAP" # Build what we have. - # We cannot use --use-lxd for autopkgtest so we resort to --destructive-mode there. - if [ "$SPREAD_SYSTEM" = "ubuntu-20.04-64" ]; then - snapcraft --use-lxd - else - snapcraft --destructive-mode - fi + snapcraft --use-lxd # And verify the snap runs as expected. snap install "${SNAP}"_1.0_*.snap --dangerous diff --git a/tests/spread/plugins/v2/colcon-ros2-daemon/task.yaml b/tests/spread/plugins/v2/colcon-ros2-daemon/task.yaml index e35c624bba..bb131dbbc8 100644 --- a/tests/spread/plugins/v2/colcon-ros2-daemon/task.yaml +++ b/tests/spread/plugins/v2/colcon-ros2-daemon/task.yaml @@ -1,5 +1,4 @@ summary: Build and run a basic daemon colcon snap -warn-timeout: 9m # Keep less than 10 minutes so Travis can't timeout priority: 100 # Run this test early so we're not waiting for it environment: diff --git a/tests/unit/store/test_client.py b/tests/unit/store/test_client.py index 8a41d82fce..fd3bf73921 100644 --- a/tests/unit/store/test_client.py +++ b/tests/unit/store/test_client.py @@ -219,30 +219,6 @@ def test_useragent_linux(): ) -@pytest.mark.parametrize("testing_env", ("TRAVIS_TESTING", "AUTOPKGTEST_TMP")) -def test_useragent_linux_with_testing(monkeypatch, testing_env): - """Construct a user-agent as a patched Linux machine""" - monkeypatch.setenv(testing_env, "1") - os_platform = OSPlatform( - system="Arch Linux", release="5.10.10-arch1-1", machine="x86_64" - ) - - assert client.build_user_agent(version="7.1.0", os_platform=os_platform) == ( - "snapcraft/7.1.0 (testing) Arch Linux/5.10.10-arch1-1 (x86_64)" - ) - - -@pytest.mark.parametrize("testing_env", ("TRAVIS_TESTING", "AUTOPKGTEST_TMP")) -def test_useragent_windows_with_testing(monkeypatch, testing_env): - """Construct a user-agent as a patched Windows machine""" - monkeypatch.setenv(testing_env, "1") - os_platform = OSPlatform(system="Windows", release="10", machine="AMD64") - - assert client.build_user_agent(version="7.1.0", os_platform=os_platform) == ( - "snapcraft/7.1.0 (testing) Windows/10 (AMD64)" - ) - - ##################### # Store Environment # ##################### diff --git a/tools/brew_install_from_source.py b/tools/brew_install_from_source.py index b4c3029fca..3c797464ed 100755 --- a/tools/brew_install_from_source.py +++ b/tools/brew_install_from_source.py @@ -46,10 +46,7 @@ def main(): def download_snapcraft_source(dest_dir): dest_file = os.path.join(dest_dir, "snapcraft-0.1.tar.gz") - branch_source = "https://github.com/{}/archive/{}.tar.gz".format( - os.environ.get("TRAVIS_PULL_REQUEST_SLUG") or "canonical/snapcraft", - os.environ.get("TRAVIS_PULL_REQUEST_BRANCH") or "main", - ) + branch_source = "https://github.com/canonical/snapcraft/archive/main.tar.gz" print("Downloading branch source from {}".format(branch_source)) urllib.request.urlretrieve(branch_source, dest_file) # noqa S310 return dest_file diff --git a/tools/collect_ppa_autopkgtests_results.py b/tools/collect_ppa_autopkgtests_results.py deleted file mode 100755 index e6a1cb8019..0000000000 --- a/tools/collect_ppa_autopkgtests_results.py +++ /dev/null @@ -1,95 +0,0 @@ -#!/usr/bin/env python3 -# -*- Mode:Python; indent-tabs-mode:nil; tab-width:4 -*- -# -# Copyright (C) 2017 Canonical Ltd -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License version 3 as -# published by the Free Software Foundation. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see . - -import argparse -import os -import subprocess -import tempfile - -ACTIVE_DISTROS = ("xenial", "artful", "bionic") - - -def main(): - parser = argparse.ArgumentParser() - parser.add_argument("day", help="The day of the results, with format yyyymmdd") - args = parser.parse_args() - install_autopkgtest_results_formatter() - with tempfile.TemporaryDirectory(dir=os.environ.get("HOME")) as temp_dir: - clone_results_repo(temp_dir) - format_results(temp_dir, ACTIVE_DISTROS, args.day) - commit_and_push(temp_dir, args.day) - - -def install_autopkgtest_results_formatter(): - subprocess.check_call( - ["sudo", "snap", "install", "autopkgtest-results-formatter", "--edge"] - ) - - -def clone_results_repo(dest_dir): - subprocess.check_call( - ["git", "clone", "https://github.com/elopio/autopkgtest-results.git", dest_dir] - ) - - -def format_results(dest_dir, distros, day): - subprocess.check_call( - [ - "/snap/bin/autopkgtest-results-formatter", - "--destination", - dest_dir, - "--distros", - *distros, - "--day", - day, - ] - ) - - -def commit_and_push(repo_dir, day): - subprocess.check_call( - ["git", "config", "--global", "user.email", "u1test+m-o@canonical.com"] - ) - subprocess.check_call(["git", "config", "--global", "user.name", "snappy-m-o"]) - - subprocess.check_call(["git", "-C", repo_dir, "add", "--all"]) - subprocess.check_call( - [ - "git", - "-C", - repo_dir, - "commit", - "--message", - "Add the results for {}".format(day), - ] - ) - - subprocess.check_call( - [ - "git", - "-C", - repo_dir, - "push", - "https://{GH_TOKEN}@github.com/elopio/autopkgtest-results.git".format( - GH_TOKEN=os.environ.get("GH_TOKEN_PPA_AUTOPKGTEST_RESULTS") - ), - ] - ) - - -if __name__ == "__main__": - main() diff --git a/tools/retry_autopkgtest.sh b/tools/retry_autopkgtest.sh deleted file mode 100755 index 0d479acd7d..0000000000 --- a/tools/retry_autopkgtest.sh +++ /dev/null @@ -1,57 +0,0 @@ -#!/bin/bash -# -# Retry the autopkgtest run in a pull request. -# Arguments: -# pr: The identifier of the pull request to test. -# [release[:architecture[:test]] ...]: A list of the names of the Ubuntu releases and -# architectures and tests to run. By default, it will launch all the tests in -# `xenial:amd64`. If only the release name is passed as an argument, `amd64` -# will be used as the architecture. The possible autopkgtests are `integrationtests` -# and `snapstests`. -# -# Environment variables: -# SNAPCRAFT_AUTOPKGTEST_SECRET: The secret to authenticate the test execution. -# -# Examples: -# Run all the tests for pull request #123 in xenial amd64: -# ./tools/retry_autopkgtest.sh 123 -# Run all the tests for pull request #123 in xenial armhf: -# ./tools/retry_autopkgtest.sh 123 xenial:armhf -# Run all the tests for pull request #123 in xenial arm64, yakkety armhf and -# zesty amd64: -# ./tools/retry_autopkgtest.sh 123 xenial:arm64 yakkety:armhf zesty -# Run the integration tests for pull request #123 in xenial amd64: -# ./tools/retry_autopkgtest.sh 123 xenial:amd64:integrationtests - -if [ -z "${SNAPCRAFT_AUTOPKGTEST_SECRET}" ]; then - echo 'Set the secret to the environment variable SNAPCRAFT_AUTOPKGTEST_SECRET.' - exit 1 -fi - -if [ "$#" -lt 1 ]; then - echo "Usage: $0 [release[:architecture[:test]] ...]" - exit 1 -fi - -pr="$1" -shift -tests=("$@") -[ ${#tests[@]} -eq 0 ] && tests=('xenial:amd64') - -temp_dir="$(mktemp -d)" -trap 'rm -rf ${temp_dir}' EXIT - -# Download the retry script. -wget https://git.launchpad.net/autopkgtest-cloud/plain/tools/retry-github-test -O "${temp_dir}/retry-github-test" -chmod +x "${temp_dir}/retry-github-test" - -# Save the secret to a file. -echo "${SNAPCRAFT_AUTOPKGTEST_SECRET}" > "${temp_dir}/sec.txt" - -for testrun in "${tests[@]}"; do - IFS=':' read -r release architecture testsuite <<< "$testrun" - [ -z "$architecture" ] && architecture='amd64' - [ -n "$testsuite" ] && testname="&testname=${testsuite}" - echo "Launching tests for the ${release} release in the ${architecture} architecture..." - "${temp_dir}/retry-github-test" "https://api.github.com/repos/canonical/snapcraft/pulls/${pr}" "https://autopkgtest.ubuntu.com/request.cgi?release=${release}&arch=${architecture}&package=snapcraft${testname}&ppa=snappy-dev%2Fsnapcraft-daily" "${temp_dir}/sec.txt" -done diff --git a/tools/run_ppa_autopkgtests.py b/tools/run_ppa_autopkgtests.py deleted file mode 100755 index 8f5450c4a2..0000000000 --- a/tools/run_ppa_autopkgtests.py +++ /dev/null @@ -1,92 +0,0 @@ -#!/usr/bin/env python -# -*- Mode:Python; indent-tabs-mode:nil; tab-width:4 -*- -# -# Copyright (C) 2017 Canonical Ltd -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License version 3 as -# published by the Free Software Foundation. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see . - -import os -import subprocess -import sys -import tempfile - -from launchpadlib.launchpad import Launchpad - -ACTIVE_DISTROS = ("xenial", "artful", "bionic") -ACTIVE_ARCHITECTURES = ("amd64", "i386", "armhf", "arm64") - - -def main(): - try: - cookie_file_path = save_cookie() - for distro, architecture, version in snapcraft_ppa_packages(): - request_autopkgtest_execution( - cookie_file_path, distro, architecture, version - ) - finally: - os.remove(cookie_file_path) - - -def save_cookie(): - cookie_file = tempfile.NamedTemporaryFile(delete=False) - cookie_file.write( - "autopkgtest.ubuntu.com\tTRUE\t/\tTRUE\t0\tsession\t{}".format( - os.environ.get("SNAPCRAFT_AUTOPKGTEST_COOKIE") - ) - ) - cookie_file.close() - return cookie_file.name - - -def snapcraft_ppa_packages(): - launchpad = Launchpad.login_anonymously("snappy-m-o", "production") - ubuntu = launchpad.distributions["ubuntu"] - snapcraft_daily_ppa = launchpad.people["snappy-dev"].getPPAByName( - name="snapcraft-daily" - ) - - for distro in ACTIVE_DISTROS: - for architecture in ACTIVE_ARCHITECTURES: - distro_arch = ubuntu.getSeries(name_or_version=distro).getDistroArchSeries( - archtag=architecture - ) - for package in snapcraft_daily_ppa.getPublishedBinaries( - status="Published", - binary_name="snapcraft", - exact_match=True, - distro_arch_series=distro_arch, - ): - yield distro, architecture, str(package.binary_package_version) - - -def request_autopkgtest_execution(cookie_path, distro, architecture, version): - output = subprocess.check_output( - [ - "wget", - "-O-", - "--load-cookies", - cookie_path, - "https://autopkgtest.ubuntu.com/request.cgi?release={distro}&" - "arch={architecture}&package=snapcraft&" - "ppa=snappy-dev/snapcraft-daily&" - "trigger=snapcraft/{version}".format( - distro=distro, architecture=architecture, version=version - ), - ] - ) - if "Test request submitted" not in output: - sys.exit("Failed to request the autopkgtest") - - -if __name__ == "__main__": - main()