How to use the asu.build.build function in asu

To help you get started, we’ve selected a few asu examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github aparcar / attendedsysupgrade-server / tests / test_build.py View on Github external
def test_build_real(app, httpserver: HTTPServer):
    request_data = dict(
        version_data={
            "branch": "master",
            "path": "snapshots",
            "pubkey": "RWS1BD5w+adc3j2Hqg9+b66CvLR7NlHbsj7wjNVj0XGt/othDgIAOJS+",
        },
        target="ath79/generic",
        store_path=app.config["STORE_PATH"],
        cache_path=app.config["CACHE_PATH"],
        upstream_url="https://downloads.cdn.openwrt.org",
        version="SNAPSHOT",
        profile="tplink_tl-wdr4300-v1",
        packages={"tmux", "vim"},
    )
    result = build(request_data)
    assert result["id"] == "tplink_tl-wdr4300-v1"
github aparcar / attendedsysupgrade-server / tests / test_build.py View on Github external
request_data = dict(
        version_data={
            "branch": "master",
            "path": "snapshots",
            "pubkey": "RWSrHfFmlHslUcLbXFIRp+eEikWF9z1N77IJiX5Bt/nJd1a/x+L+SU89",
        },
        target="testtarget/testsubtarget",
        store_path=app.config["STORE_PATH"],
        cache_path=app.config["CACHE_PATH"],
        upstream_url="http://localhost:8001",
        version="SNAPSHOT",
        profile="testprofile",
        packages=["test1"],
    )
    with pytest.raises(Exception) as execinfo:
        result = build(request_data)
    assert str(execinfo.value) == "packages must be type set not list"
github aparcar / attendedsysupgrade-server / tests / test_build.py View on Github external
request_data = dict(
        version_data={
            "branch": "master",
            "path": "snapshots",
            "pubkey": "RWSrHfFmlHslUcLbXFIRp+eEikWF9z1N77IJiX5Bt/nJd1a/x+L+SU89",
        },
        target="testtarget/testsubtarget",
        store_path=app.config["STORE_PATH"],
        cache_path=app.config["CACHE_PATH"],
        upstream_url="http://localhost:8001",
        version="SNAPSHOT",
        profile="testprofile",
    )
    with pytest.raises(Exception) as execinfo:
        result = build(request_data)
    assert str(execinfo.value) == "store_path must be existing directory"
github aparcar / attendedsysupgrade-server / tests / test_build.py View on Github external
def test_build_fake(app, upstream):
    request_data = dict(
        version_data={
            "branch": "master",
            "path": "snapshots",
            "pubkey": "RWSrHfFmlHslUcLbXFIRp+eEikWF9z1N77IJiX5Bt/nJd1a/x+L+SU89",
        },
        target="testtarget/testsubtarget",
        store_path=app.config["STORE_PATH"],
        cache_path=app.config["CACHE_PATH"],
        upstream_url="http://localhost:8001",
        version="SNAPSHOT",
        profile="testprofile",
        packages={"test1", "test2"},
    )
    result = build(request_data)
    assert result["id"] == "testprofile"
github aparcar / attendedsysupgrade-server / tests / test_build.py View on Github external
def test_build_fake_no_packages(app, upstream):
    request_data = dict(
        version_data={
            "branch": "master",
            "path": "snapshots",
            "pubkey": "RWSrHfFmlHslUcLbXFIRp+eEikWF9z1N77IJiX5Bt/nJd1a/x+L+SU89",
        },
        target="testtarget/testsubtarget",
        store_path=app.config["STORE_PATH"],
        cache_path=app.config["CACHE_PATH"],
        upstream_url="http://localhost:8001",
        version="SNAPSHOT",
        profile="testprofile",
    )
    result = build(request_data)
    assert result["id"] == "testprofile"
github aparcar / attendedsysupgrade-server / tests / test_build.py View on Github external
request_data = dict(
        version_data={
            "branch": "master",
            "path": "snapshots",
            "pubkey": "RWSrHfFmlHslUcLbXFIRp+eEikWF9z1N77IJiX5Bt/nJd1a/x+L+SU89",
        },
        target="testtarget/testsubtarget",
        store_path=app.config["STORE_PATH"],
        cache_path=app.config["CACHE_PATH"],
        upstream_url="http://localhost:8001",
        version="SNAPSHOT",
        profile="testprofile",
        packages={"test1", "test2"},
        diff_packages=True,
    )
    result = build(request_data)
    assert result["id"] == "testprofile"
github aparcar / attendedsysupgrade-server / asu / api.py View on Github external
else:
        result_ttl = "15m"
        failure_ttl = "15m"

    if job is None:
        response, status = validate_request(request_data)
        if response:
            return response, status

        request_data["store_path"] = current_app.config["STORE_PATH"]
        request_data["cache_path"] = current_app.config["CACHE_PATH"]
        request_data["upstream_url"] = current_app.config["UPSTREAM_URL"]
        request_data["version_data"] = get_versions()[request_data["version"]]

        job = get_queue().enqueue(
            build,
            request_data,
            job_id=request_hash,
            result_ttl=result_ttl,
            failure_ttl=failure_ttl,
            job_timeout="5m",
        )

    return return_job(job)