Use GetPipelineState com um CLI - AWS SDKExemplos de código

Há mais AWS SDK exemplos disponíveis no GitHub repositório AWS Doc SDK Examples.

As traduções são geradas por tradução automática. Em caso de conflito entre o conteúdo da tradução e da versão original em inglês, a versão em inglês prevalecerá.

Use GetPipelineState com um CLI

Os exemplos de código a seguir mostram como usar o GetPipelineState.

CLI
AWS CLI

Para obter informações sobre o estado de um gasoduto

Este exemplo retorna o estado mais recente de um pipeline chamado MyFirstPipeline.

Comando:

aws codepipeline get-pipeline-state --name MyFirstPipeline

Saída:

{ "created": 1446137312.204, "pipelineName": "MyFirstPipeline", "pipelineVersion": 1, "stageStates": [ { "actionStates": [ { "actionName": "Source", "entityUrl": "https://console.aws.amazon.com/s3/home?#", "latestExecution": { "lastStatusChange": 1446137358.328, "status": "Succeeded" } } ], "stageName": "Source" }, { "actionStates": [ { "actionName": "CodePipelineDemoFleet", "entityUrl": "https://console.aws.amazon.com/codedeploy/home?#/applications/CodePipelineDemoApplication/deployment-groups/CodePipelineDemoFleet", "latestExecution": { "externalExecutionId": "d-EXAMPLE", "externalExecutionUrl": "https://console.aws.amazon.com/codedeploy/home?#/deployments/d-EXAMPLE", "lastStatusChange": 1446137493.131, "status": "Succeeded", "summary": "Deployment Succeeded" } } ], "inboundTransitionState": { "enabled": true }, "stageName": "Beta" } ], "updated": 1446137312.204 }
  • Para API obter detalhes, consulte GetPipelineStatena Referência de AWS CLI Comandos.

PowerShell
Ferramentas para PowerShell

Exemplo 1: Este exemplo obtém informações gerais sobre os estágios do pipeline especificado.

Get-CPPipelineState -Name CodePipelineDemo

Saída:

Created : 8/13/2015 10:17:54 PM PipelineName : CodePipelineDemo PipelineVersion : 1 StageStates : {Source, Build, Beta, TestStage} Updated : 8/13/2015 10:17:54 PM

Exemplo 2: Este exemplo obtém informações detalhadas sobre o estado do pipeline especificado.

ForEach ($stageState in (Get-CPPipelineState -Name $arg).StageStates) { Write-Output ("For " + $stageState.StageName + ":") Write-Output (" InboundTransitionState:") Write-Output (" DisabledReason = " + $stageState.InboundTransitionState.DisabledReason) Write-Output (" Enabled = " + $stageState.InboundTransitionState.Enabled) Write-Output (" LastChangedAt = " + $stageState.InboundTransitionState.LastChangedAt) Write-Output (" LastChangedBy = " + $stageState.InboundTransitionState.LastChangedBy) Write-Output (" ActionStates:") ForEach ($actionState in $stageState.ActionStates) { Write-Output (" For " + $actionState.ActionName + ":") Write-Output (" CurrentRevision:") Write-Output (" Created = " + $actionState.CurrentRevision.Created) Write-Output (" RevisionChangeId = " + $actionState.CurrentRevision.RevisionChangeId) Write-Output (" RevisionId = " + $actionState.CurrentRevision.RevisionId) Write-Output (" EntityUrl = " + $actionState.EntityUrl) Write-Output (" LatestExecution:") Write-Output (" ErrorDetails:") Write-Output (" Code = " + $actionState.LatestExecution.ErrorDetails.Code) Write-Output (" Message = " + $actionState.LatestExecution.ErrorDetails.Message) Write-Output (" ExternalExecutionId = " + $actionState.LatestExecution.ExternalExecutionId) Write-Output (" ExternalExecutionUrl = " + $actionState.LatestExecution.ExternalExecutionUrl) Write-Output (" LastStatusChange = " + $actionState.LatestExecution.LastStatusChange) Write-Output (" PercentComplete = " + $actionState.LatestExecution.PercentComplete) Write-Output (" Status = " + $actionState.LatestExecution.Status) Write-Output (" Summary = " + $actionState.LatestExecution.Summary) Write-Output (" RevisionUrl = " + $actionState.RevisionUrl) } }

Saída:

For Source: InboundTransitionState: DisabledReason = Enabled = LastChangedAt = LastChangedBy = ActionStates: For Source: CurrentRevision: Created = RevisionChangeId = RevisionId = EntityUrl = https://github.com/my-user-name/MyRepoName/tree/master LatestExecution: ErrorDetails: Code = Message = ExternalExecutionId = ExternalExecutionUrl = LastStatusChange = 07/20/2015 23:28:45 PercentComplete = 0 Status = Succeeded Summary = RevisionUrl = For Build: InboundTransitionState: DisabledReason = Enabled = True LastChangedAt = 01/01/0001 00:00:00 LastChangedBy = ActionStates: For Build: CurrentRevision: Created = RevisionChangeId = RevisionId = EntityUrl = http://54.174.131.1EX/job/MyJenkinsDemo LatestExecution: ErrorDetails: Code = TimeoutError Message = The action failed because a job worker exceeded its time limit. If this is a custom action, make sure that the job worker is configured correctly. ExternalExecutionId = ExternalExecutionUrl = LastStatusChange = 07/21/2015 00:29:29 PercentComplete = 0 Status = Failed Summary = RevisionUrl = For Beta: InboundTransitionState: DisabledReason = Enabled = True LastChangedAt = 01/01/0001 00:00:00 LastChangedBy = ActionStates: For CodePipelineDemoFleet: CurrentRevision: Created = RevisionChangeId = RevisionId = EntityUrl = https://console.aws.amazon.com/codedeploy/home?#/applications/CodePipelineDemoApplication/deployment-groups/CodePipelineDemoFleet LatestExecution: ErrorDetails: Code = Message = ExternalExecutionId = d-D5LTCZXEX ExternalExecutionUrl = https://console.aws.amazon.com/codedeploy/home?#/deployments/d-D5LTCZXEX LastStatusChange = 07/08/2015 22:07:42 PercentComplete = 0 Status = Succeeded Summary = Deployment Succeeded RevisionUrl = For TestStage: InboundTransitionState: DisabledReason = Enabled = True LastChangedAt = 01/01/0001 00:00:00 LastChangedBy = ActionStates: For MyJenkinsTestAction25: CurrentRevision: Created = RevisionChangeId = RevisionId = EntityUrl = http://54.174.131.1EX/job/MyJenkinsDemo LatestExecution: ErrorDetails: Code = Message = ExternalExecutionId = 5 ExternalExecutionUrl = http://54.174.131.1EX/job/MyJenkinsDemo/5 LastStatusChange = 07/08/2015 22:09:03 PercentComplete = 0 Status = Succeeded Summary = Finished RevisionUrl =
  • Para API obter detalhes, consulte GetPipelineStateem Referência de AWS Tools for PowerShell cmdlet.