Пример #1
0
def create_build_trigger(repo,
                         service_name,
                         auth_token,
                         user,
                         pull_robot=None,
                         config=None):
    service = BuildTriggerService.get(name=service_name)
    secure_auth_token = DecryptedValue(auth_token) if auth_token else None
    trigger = RepositoryBuildTrigger.create(
        repository=repo,
        service=service,
        secure_auth_token=secure_auth_token,
        connected_user=user,
        pull_robot=pull_robot,
        config=json.dumps(config or {}),
    )
    return trigger
Пример #2
0
def create_build_trigger(repo, service_name, auth_token, user, pull_robot=None, config=None):
    service = BuildTriggerService.get(name=service_name)

    # TODO(remove-unenc): Remove legacy field.
    old_auth_token = None
    if ActiveDataMigration.has_flag(ERTMigrationFlags.WRITE_OLD_FIELDS):
        old_auth_token = auth_token

    secure_auth_token = DecryptedValue(auth_token) if auth_token else None
    trigger = RepositoryBuildTrigger.create(
        repository=repo,
        service=service,
        auth_token=old_auth_token,
        secure_auth_token=secure_auth_token,
        connected_user=user,
        pull_robot=pull_robot,
        config=json.dumps(config or {}),
    )
    return trigger