Ejemplo n.º 1
0
def scm_pipeline_run_with_no_open_release(another_project, another_scm_repository,
                                          scm_step_run_success_list_with_start_end_tags):
    application = models.Application(project=another_project,
                                     scm_repository=another_scm_repository,
                                     name='Application 2', slug='APP2')
    with username_on_model(models.Application, 'initial'):
        application.save()

    pipeline_yaml = '''stages:
             - release

           do-release:
             stage: release
           '''
    scm_pipeline_run = models.SCMPipelineRun(application=application,
                                             pipeline_yaml=pipeline_yaml,
                                             steps_total=5,
                                             status="success",
                                             commit_hash='4015B57A143AEC5156FD1444A017A32137A3FD0F')
    with username_on_model(models.SCMPipelineRun, 'initial'):
        scm_pipeline_run.save()

    with username_on_model(models.SCMStepRun, 'initial'):
        for step in scm_step_run_success_list_with_start_end_tags:
            step.scm_pipeline_run = scm_pipeline_run
            step.save()

    return scm_pipeline_run
Ejemplo n.º 2
0
def not_my_scm_pipeline_run(not_my_application):
    scm_pipeline_run = models.SCMPipelineRun(
        application=not_my_application,
        pipeline_yaml="---",
        steps_total=5,
        commit_hash="8875B57A143AEC5156FD1444A017A32137A3F321",
    )
    with username_on_model(models.SCMPipelineRun, "initial"):
        scm_pipeline_run.save()

    return scm_pipeline_run
Ejemplo n.º 3
0
def deactivated_scm_pipeline_run(application):
    scm_pipeline_run = models.SCMPipelineRun(
        application=application,
        pipeline_yaml="---",
        steps_total=5,
        commit_hash="8975B57A143AEC5156FD1444A017A32137A3FBA3",
    )
    scm_pipeline_run.deleted = True
    with username_on_model(models.SCMPipelineRun, "initial"):
        scm_pipeline_run.save()

    return scm_pipeline_run
Ejemplo n.º 4
0
def another_scm_pipeline_run(another_application):
    pipeline_yaml = '''stages:
  - release

do-release:
  stage: release
'''
    scm_pipeline_run = models.SCMPipelineRun(application=another_application,
                                             pipeline_yaml=pipeline_yaml,
                                             steps_total=5,
                                             commit_hash='1234567A143AEC5156FD1444A017A3213654321')
    with username_on_model(models.SCMPipelineRun, 'initial'):
        scm_pipeline_run.save()

    return scm_pipeline_run
Ejemplo n.º 5
0
def next_scm_pipeline_run(application, scm_pipeline_run):
    pipeline_yaml = '''stages:
  - release

do-release:
  stage: release
'''
    scm_pipeline_run = models.SCMPipelineRun(application=application,
                                             pipeline_yaml=pipeline_yaml,
                                             steps_total=5,
                                             commit_hash='DD14567A143AEC5156FD1444A017A3213654EF1',
                                             first_parent_hash=scm_pipeline_run.commit_hash)
    with username_on_model(models.SCMPipelineRun, 'initial'):
        scm_pipeline_run.save()

    return scm_pipeline_run
Ejemplo n.º 6
0
def another_another_scm_pipeline_run(another_application):
    pipeline_yaml = '''stages:
  - release

do-release:
  stage: release
'''
    scm_pipeline_run = models.SCMPipelineRun(application=another_application,
                                             pipeline_yaml=pipeline_yaml,
                                             steps_total=5,
                                             commit_hash='9234567A143AEC5156FD1444A017A3213654329',
                                             # first_parent_hash does not link to existing hash
                                             first_parent_hash='40000000000000000000000000000000000000F')
    with username_on_model(models.SCMPipelineRun, 'initial'):
        scm_pipeline_run.save()

    return scm_pipeline_run
Ejemplo n.º 7
0
def my_scm_pipeline_run(application):
    pipeline_yaml = """stages:
  - release

do-release:
  stage: release
"""
    scm_pipeline_run = models.SCMPipelineRun(
        application=application,
        pipeline_yaml=pipeline_yaml,
        steps_total=5,
        commit_hash="4015B57A143AEC5156FD1444A017A32137A3FD0F",
    )
    with username_on_model(models.SCMPipelineRun, "initial"):
        scm_pipeline_run.save()

    return scm_pipeline_run
Ejemplo n.º 8
0
def next_scm_pipeline_run(application, my_scm_pipeline_run):
    pipeline_yaml = """stages:
  - release

do-release:
  stage: release
"""
    scm_pipeline_run = models.SCMPipelineRun(
        application=application,
        pipeline_yaml=pipeline_yaml,
        steps_total=5,
        commit_hash="DD14567A143AEC5156FD1444A017A3213654EF1",
        first_parent_hash=my_scm_pipeline_run.commit_hash,
    )
    with username_on_model(models.SCMPipelineRun, "initial"):
        scm_pipeline_run.save()

    return scm_pipeline_run
Ejemplo n.º 9
0
def different_scm_pipeline_run(my_other_application):
    pipeline_yaml = """stages:
  - release

do-release:
  stage: release
"""
    scm_pipeline_run = models.SCMPipelineRun(
        application=my_other_application,
        pipeline_yaml=pipeline_yaml,
        steps_total=5,
        commit_hash="9234567A143AEC5156FD1444A017A3213654321",
        # first_parent_hash does not link to existing hash
        first_parent_hash="40000000000000000000000000000000000000F",
    )
    with username_on_model(models.SCMPipelineRun, "initial"):
        scm_pipeline_run.save()

    return scm_pipeline_run