def run_disable_and_destroy_google_pipeline(self, pipeline_id): path = 'pipelines/{app}/{id}'.format( app=self.TEST_APP, id=self.google_destroy_pipeline_id) group_name = '{app}-{stack}-v000'.format( app=self.TEST_APP, stack=self.bindings['TEST_STACK']) builder = gcp.GcpContractBuilder(self.gcp_observer) (builder.new_clause_builder( 'Managed Instance Group Destroyed').inspect_resource( 'instanceGroupManagers', group_name).EXPECT( ov_factory.error_list_contains( gcp.HttpErrorPredicate(http_code=404))).OR( ov_factory.value_list_path_contains( 'targetSize', jp.NUM_EQ(0)))) return st.OperationContract( self.new_post_operation( title='run_destroy_pipeline', data='', path=path, max_wait_secs=1080), # Allow 18 mins to disable and destroy. contract=jc.Contract())
def run_disable_and_destroy_google_pipeline(self, pipeline_id): path = "pipelines/{app}/{id}".format( app=self.TEST_APP, id=self.google_destroy_pipeline_id) group_name = "{app}-{stack}-v000".format( app=self.TEST_APP, stack=self.bindings["TEST_STACK"]) builder = gcp.GcpContractBuilder(self.gcp_observer) (builder.new_clause_builder( "Managed Instance Group Destroyed").inspect_resource( "instanceGroupManagers", group_name).EXPECT( ov_factory.error_list_contains( gcp.HttpErrorPredicate(http_code=404))).OR( ov_factory.value_list_path_contains( "targetSize", jp.NUM_EQ(0)))) return st.OperationContract( self.new_post_operation( title="run_destroy_pipeline", data="", path=path, max_wait_secs=1080), # Allow 18 mins to disable and destroy. contract=jc.Contract(), cleanup=self.delete_baked_image, )
def delete_load_balancer(self): bindings = self.bindings payload = self.agent.make_json_payload_from_kwargs( job=[ { "type": "deleteLoadBalancer", "cloudProvider": "appengine", "loadBalancerName": self.__lb_name, "account": bindings["SPINNAKER_APPENGINE_ACCOUNT"], "credentials": bindings["SPINNAKER_APPENGINE_ACCOUNT"], "user": "******", } ], description="Delete Load Balancer: {0} in {1}".format( self.__lb_name, bindings["SPINNAKER_APPENGINE_ACCOUNT"] ), application=self.TEST_APP, ) builder = gcp.GcpContractBuilder(self.appengine_observer) ( builder.new_clause_builder("Service Deleted", retryable_for_secs=60) .inspect_resource( "apps.services", self.__lb_name, appsId=self.__gcp_project ) .EXPECT( ov_factory.error_list_contains(gcp.HttpErrorPredicate(http_code=404)) ) ) return st.OperationContract( self.new_post_operation( title="delete_load_balancer", data=payload, path="tasks" ), contract=builder.build(), )