def approve_stage(go_server_url, username, secret, pipeline_name, pipeline_counter, stage_name): """ Approves the specified stage of the specified pipeline run, as the given user. """ client = Yagocd( server=go_server_url, auth=(username, secret), ) client.stages.run(pipeline_name, pipeline_counter, stage_name)
def go_fixture(self): return Yagocd()
def test_default(self): assert Yagocd().server_url == 'http://localhost:8153'
def test_set_headers(self): go = Yagocd(options=dict(headers=dict(Accept='foo/bar'))) assert go._session._options['headers']['Accept'] == 'foo/bar'
def test_set_verify(self): go = Yagocd(options=dict(verify=False)) assert go._session._options['verify'] == False
def test_set_server_from_options(self): go = Yagocd(options=dict(server='http://example.com')) assert go.server_url == 'http://example.com'
def test_set_server(self): go = Yagocd(server='http://example.com') assert go.server_url == 'http://example.com'
def test_default(self): try: Yagocd() except Exception as e: assert False, "Unexpected exception raised: {0}".format(e)
GOCD_USERNAME = os.getenv("GOCD_USERNAME") GOCD_PASSWORD = os.getenv("GOCD_PASSWORD") GOCD_SSL_VERIFY = os.getenv("GOCD_SSL_VERIFY", True) in ["true", "True", "yes", "1"] CCTRAY_URL = GOCD_URL + 'go/cctray.xml' if GOCD_USERNAME is not None and GOCD_PASSWORD is not None: credentials = (GOCD_USERNAME, GOCD_PASSWORD) else: credentials = None start_http_server(EXPOSE_PORT) go = Yagocd(server=GOCD_URL, auth=credentials, options={'verify': GOCD_SSL_VERIFY}) watched = set([]) watched_jobs = set([]) job_count_by_state = Gauge('gocd_job_count_by_state', 'Number of jobs with status', ["gocd_url", "state"]) latest_stage_result = Gauge( 'gocd_stage_latest_result', 'pass or fail of the latest stage run', ["gocd_url", "pipeline_group", "pipeline", "stage", "stage_key"]) latest_stage_date = Gauge( 'gocd_stage_latest_date', 'pass or fail of the latest stage run', ["gocd_url", "pipeline_group", "pipeline", "stage", "stage_key", "result"])