def BuildDocker(buildSelection):
    VersionTools.ExportVersionFromChangelogToEnvironment('CHANGELOG.md', 'VERSION')
    composeFiles = [
        'docker-compose.yml'
    ]

    if buildSelection == "run":
        DockerComposeTools.DockerComposeUp(composeFiles)

    if buildSelection == "run":
        DockerComposeTools.DockerComposeUp(composeFiles)

    elif buildSelection == "test":
        testContainerNames = ['my-service']
        DockerComposeTools.ExecuteComposeTests(composeFiles, testContainerNames)

    elif buildSelection == "publish":
        BuildDocker("build")
        DockerComposeTools.DockerComposePush(composeFiles)
        DockerComposeTools.PublishDockerImagesWithNewTag(composeFiles, 'latest')

    elif buildSelection == "help":
        TerminalTools.PrintAvailableCommands(AvailableCommands)

    else:
        print("Please provide a valid build argument: ")
        BuildDocker("help")
Esempio n. 2
0
def BuildDocker(buildSelection):
    VersionTools.ExportVersionFromChangelogToEnvironment(
        'CHANGELOG.md', 'VERSION')
    srcFolder = ['src', '..']
    miniSwarmManagementFile = 'swarm-management.yml'
    migratorComposeFiles = ['docker-compose.migrator.yml']
    nugetDockerComposeFiles = ['docker-compose.publish.nuget.yml']
    generalComposeFiles = [
        'docker-compose.message.handler.yml',
        'docker-compose.outboxcleaner.yml',
        'docker-compose.message.spammer.yml'
    ]

    if buildSelection == 'run':
        os.chdir(srcFolder[0])
        DockerComposeTools.DockerComposeUp(migratorComposeFiles)
        DockerComposeTools.DockerComposeUp(generalComposeFiles)
        os.chdir(srcFolder[1])

    elif buildSelection == 'build':
        os.chdir(srcFolder[0])
        DockerComposeTools.DockerComposeBuild(generalComposeFiles +
                                              migratorComposeFiles)
        os.chdir(srcFolder[1])

    elif buildSelection == 'test':
        os.chdir(srcFolder[0])
        DockerComposeTools.ExecuteComposeTests(['docker-compose.tests.yml'],
                                               ['saferebus-tests'])
        os.chdir(srcFolder[1])

    elif buildSelection == 'publish':
        os.chdir(srcFolder[0])
        DockerComposeTools.DockerComposeBuild(nugetDockerComposeFiles)
        DockerComposeTools.DockerComposeUp(nugetDockerComposeFiles, False)
        os.chdir(srcFolder[1])

    elif buildSelection == 'start-dev':
        os.chdir(srcFolder[0] + '/ServiceDependencies')
        SwarmManager.HandleManagement(
            ['-start', '-f', miniSwarmManagementFile])
        os.chdir(srcFolder[1] + '/..')

    elif buildSelection == 'stop-dev':
        os.chdir(srcFolder[0] + '/ServiceDependencies')
        SwarmManager.HandleManagement(['-stop', '-f', miniSwarmManagementFile])
        os.chdir(srcFolder[1] + '/..')

    elif buildSelection == 'help':
        TerminalTools.PrintAvailableCommands(AvailableCommands)

    else:
        print('Please provide a valid build argument: ')
        BuildDocker('help')
Esempio n. 3
0
def BuildDocker(buildSelection):
    srcFolder = ['src', '..']
    miniSwarmManagementFile = 'swarm-management.yml'
    migratorComposeFiles = [
        'docker-compose.migrator.yml'
    ]
    generalComposeFiles = [
        'docker-compose.yml'
    ]

    if buildSelection == 'run':
        os.chdir(srcFolder[0])
        DockerComposeTools.DockerComposeUp(migratorComposeFiles)
        DockerComposeTools.DockerComposeUp(generalComposeFiles)
        os.chdir(srcFolder[1])
    
    elif buildSelection == 'build':
        os.chdir(srcFolder[0])
        DockerComposeTools.DockerComposeBuild(generalComposeFiles + migratorComposeFiles)
        os.chdir(srcFolder[1])

    elif buildSelection == 'test':
        os.chdir(srcFolder[0])
        DockerComposeTools.ExecuteComposeTests(
            ['docker-compose.tests.yml'], ['kafkaoncontainers-tests'])
        os.chdir(srcFolder[1])

    elif buildSelection == 'start-dev':
        os.chdir(srcFolder[0] + '/ServiceDependencies')
        SwarmManager.HandleManagement(['-start', '-f', miniSwarmManagementFile])
        os.chdir(srcFolder[1] + '/..')

    elif buildSelection == 'stop-dev':
        os.chdir(srcFolder[0] + '/ServiceDependencies')
        SwarmManager.HandleManagement(['-stop', '-f', miniSwarmManagementFile])
        os.chdir(srcFolder[1] + '/..')

    elif buildSelection == 'help':
        TerminalTools.PrintAvailableCommands(AvailableCommands)

    else:
        print('Please provide a valid build argument: ')
        BuildDocker('help')