コード例 #1
0
ファイル: test_build.py プロジェクト: chrisley75/quay
def test_archivable_build_logs(initialized_db):
    # Make sure there are no archivable logs.
    result = model.build.get_archivable_build()
    assert result is None

    # Add a build that cannot (yet) be archived.
    repo = model.repository.get_repository("devtable", "simple")
    token = model.token.create_access_token(repo, "write")
    created = RepositoryBuild.create(
        repository=repo,
        access_token=token,
        phase=model.build.BUILD_PHASE.WAITING,
        logs_archived=False,
        job_config="{}",
        display_name="",
    )

    # Make sure there are no archivable logs.
    result = model.build.get_archivable_build()
    assert result is None

    # Change the build to being complete.
    created.phase = model.build.BUILD_PHASE.COMPLETE
    created.save()

    # Make sure we now find an archivable build.
    result = model.build.get_archivable_build()
    assert result.id == created.id
コード例 #2
0
ファイル: build.py プロジェクト: xzwupeng/quay
def create_repository_build(repo,
                            access_token,
                            job_config_obj,
                            dockerfile_id,
                            display_name,
                            trigger=None,
                            pull_robot_name=None):
    pull_robot = None
    if pull_robot_name:
        pull_robot = user_model.lookup_robot(pull_robot_name)

    return RepositoryBuild.create(repository=repo,
                                  access_token=access_token,
                                  job_config=json.dumps(job_config_obj),
                                  display_name=display_name,
                                  trigger=trigger,
                                  resource_key=dockerfile_id,
                                  pull_robot=pull_robot)