Ejemplo n.º 1
0
2.  Display artifact statistics.
3.  Upload an artifact.
"""
import os
import json
import subprocess

import click
import requests

from requests.auth import HTTPBasicAuth
from servicelab.stack import pass_context
from servicelab.utils import logger_utils
from servicelab import settings

slab_logger = logger_utils.setup_logger(settings.verbosity, 'stack.artifact')


@click.group('artifact', short_help='Work with artifacts from artifactory with this command'
             ' subset.', add_help_option=True)
@click.pass_context
def cli(_):
    """
    stack artifact command
    """
    pass


@cli.command('stats', short_help='Display individual artifact statistics in Artifactory.')
@click.argument('url', required=True)
@click.option('-u',
Ejemplo n.º 2
0
import sys
import json
import copy
import click
import requests
import xml.etree.ElementTree as ET

from bs4 import BeautifulSoup
from requests.auth import HTTPBasicAuth

from servicelab.utils import gocd_utils
from servicelab.stack import pass_context
from servicelab.utils import logger_utils
from servicelab import settings

slab_logger = logger_utils.setup_logger(settings.verbosity, 'stack.pipe')


@click.group('pipe',
             short_help='Command subset to help you work with Go pipelines.',
             add_help_option=True)
@click.pass_context
def cli(_):
    """
    Helps you gopipe for resources in the SDLC pipeline.
    """
    pass


@cli.command('log',
             short_help='Display the log output from a specific pipeline.')
Ejemplo n.º 3
0
"""
Stack subcommand implementation to work on a particular service

"""
import os
import sys
import click

from servicelab.stack import pass_context
from servicelab.utils import service_utils
from servicelab.utils import logger_utils
from servicelab import settings

slab_logger = logger_utils.setup_logger(settings.verbosity, 'stack.workon')


@click.group('workon',
             invoke_without_command=True,
             short_help="Clone a service locally that you would like to work on.")
@click.argument('service_name', default="current")
@click.option('-b', '--branch', default="master",
              help='Choose a branch to run against for your service.')
@click.option('-db', '--data-branch', default="master",
              help='Choose a ccs-data branch to run against your service.')
@click.option('-u', '--username',
              help='Enter the username')
@pass_context
def cli(ctx, branch, data_branch, username, service_name):
    """
    Clones a service repo that the user wants to work on.
    """
Ejemplo n.º 4
0
"""
Stack functions to validate the YAML File syntax.
"""
import click

from servicelab.stack import pass_context
from servicelab.utils import yaml_utils
from servicelab.utils import logger_utils
from servicelab import settings

slab_logger = logger_utils.setup_logger(settings.verbosity, 'stack.validate')


@click.group('validate',
             short_help='Help validate resources being used in the pipeline.',
             add_help_option=True)
@pass_context
def cli(_):
    """
    Function to group stack validate commands.
    """
    pass


@cli.command('yaml', short_help='Verify the yaml syntax for the file is good.')
@click.argument('file_name')
@pass_context
def validate_yaml(_, file_name):
    """
    This cmd function takes the yaml file and validates its syntax.
    """
Ejemplo n.º 5
0
    2. all
       To list all sections of the man page and allow the user to navigate to one of them
    3. list
       To list all sections of the man page and allow the user to navigate to one of them
    4. whatis
       This cmd lets the user choose a section to navigate to based on how many times it
       contains the query keyword.
"""
import click

from servicelab.stack import pass_context
from servicelab.utils import explain_utils
from servicelab.utils import logger_utils
from servicelab import settings

slab_logger = logger_utils.setup_logger(settings.verbosity, 'stack.explain')


@click.group('explain',
             short_help='Provide high level explanations of servicelab.',
             add_help_option=True)
@pass_context
def cli(_):
    """
    Stack decorator for explain command.
    """
    pass


@cli.command('init',
             short_help='Compiles all wiki documentation in slab_man_data.yaml'
Ejemplo n.º 6
0
    2. Approves and merges a gerrit change set.
    3. Approves, but does not merge a gerrit change set.
    4. Prefer the code is not submitted.
    5. Do not submit the code
    6. Display the review
    7. Display the code diff
"""
import click

from servicelab.stack import pass_context
from servicelab.utils import helper_utils
from servicelab.utils import gerrit_functions
from servicelab.utils import logger_utils
from servicelab import settings

slab_logger = logger_utils.setup_logger(settings.verbosity, 'stack.review')


@click.group('review', short_help='Helps you work with reviews in Gerrit.')
@pass_context
def cli(_):
    """
    Helps you work with Gerrit.
    """
    pass


@cli.command('inc',
             short_help='Find incoming reviews in Gerrit - requested for you '
             'to review.')
@click.option('-p',
Ejemplo n.º 7
0
"""
The module contains the redeploy subcommand implemenation.
"""
import sys

import click

from servicelab.utils import service_utils
from servicelab.utils import vagrant_utils
from servicelab.stack import pass_context
from servicelab.utils import logger_utils
from servicelab import settings

slab_logger = logger_utils.setup_logger(settings.verbosity,
                                        'stack.cmd.redeploy')


@click.option('-v',
              '--existing-vm',
              default=False,
              help='Choose a VM from ccs-data to redeploy all services to.')
@click.option(
    '-e',
    '--env',
    help=
    'Choose an environment from ccs-data.  For use with --existing-vm option')
@click.command('redeploy', short_help="Redeploy your service to your VMs.")
@click.argument('deploy_svc')
@pass_context
def cli(ctx, deploy_svc, existing_vm, env):
    """
Ejemplo n.º 8
0
"""
import os
import sys
from subprocess import CalledProcessError

import click

from servicelab.utils import logger_utils
from servicelab.stack import pass_context
from servicelab.utils import vagrant_utils
from servicelab.utils import helper_utils
from servicelab.utils import openstack_utils
from servicelab.utils import vm_utils
from servicelab import settings

slab_logger = logger_utils.setup_logger(settings.verbosity, 'stack.destroy')

VAGRANTFILE_DELETE_MESSAGE = "Deleting the VM"
INVENTORY_DELETE_MESSAGE = "Deleting the VM from vagrant.yaml inventory"
REBUILDING_CCSDATA_MESSAGE = "Rebuilding ccs-data"
INFRA_PORT_DETECT_MESSAGE = "Port found for infra node"
UPDATING_HOSTS_YAML_MESSAGE = "Updating of hosts.yaml on infra node complete"
VM_DOESNT_EXIST_MESSAGE = "Error occurred destroying VM. "\
                          "Most probably the VM doesnt exist."


@click.group('destroy',
             short_help='Remove local and remote pipeline resources.',
             add_help_option=True)
@pass_context
def cli(_):
Ejemplo n.º 9
0
import click

import servicelab.utils.ccsdata_haproxy_utils as haproxy

from servicelab.stack import pass_context
from servicelab.utils import create_repo
from servicelab.utils import service_utils
from servicelab.utils import ccsbuildtools_utils
from servicelab.utils import ccsdata_utils
from servicelab.utils import tc_vm_yaml_create
from servicelab.utils import yaml_utils
from servicelab.utils import helper_utils
from servicelab.utils import logger_utils
from servicelab import settings

slab_logger = logger_utils.setup_logger(settings.verbosity, 'stack.cmd.create')


@click.group('create',
             short_help='Creates pipeline resources to work with.',
             add_help_option=True)
@click.pass_context
def cli(_):
    """Stack Create command line client"""
    pass


@cli.command('repo', short_help='Create a git repository in Gerrit.')
@click.argument('repo_name', required=True)
@click.option('--repo-type',
              default='ansible',