Hay más AWS SDK ejemplos disponibles en el GitHub repositorio de AWS Doc SDK Examples
Las traducciones son generadas a través de traducción automática. En caso de conflicto entre la traducción y la version original de inglés, prevalecerá la version en inglés.
CodePipeline ejemplos de uso de herramientas para PowerShell
Los siguientes ejemplos de código muestran cómo realizar acciones e implementar escenarios comunes mediante el uso del AWS Tools for PowerShell with CodePipeline.
Las acciones son extractos de código de programas más grandes y deben ejecutarse en contexto. Mientras las acciones muestran cómo llamar a las funciones de servicio individuales, es posible ver las acciones en contexto en los escenarios relacionados.
Cada ejemplo incluye un enlace al código fuente completo, donde puede encontrar instrucciones sobre cómo configurar y ejecutar el código en su contexto.
Temas
Acciones
En el siguiente ejemplo de código se muestra cómo usar Confirm-CPJob
.
- Herramientas para PowerShell
-
Ejemplo 1: En este ejemplo se obtiene el estado del trabajo especificado.
Confirm-CPJob -JobId f570dc12-5ef3-44bc-945a-6e133EXAMPLE -Nonce 3
Salida:
Value ----- InProgress
-
Para API obtener más información, consulte AcknowledgeJob AWS Tools for PowerShellCmdlet Reference.
-
En el siguiente ejemplo de código se muestra cómo usar Disable-CPStageTransition
.
- Herramientas para PowerShell
-
Ejemplo 1: Este ejemplo desactiva la transición de entrada para la etapa especificada de la canalización especificada.
Disable-CPStageTransition -PipelineName CodePipelineDemo -Reason "Disabling temporarily." -StageName Beta -TransitionType Inbound
-
Para API obtener más información, consulte AWS Tools for PowerShell Cmdlet DisableStageTransitionReference.
-
En el siguiente ejemplo de código se muestra cómo usar Enable-CPStageTransition
.
- Herramientas para PowerShell
-
Ejemplo 1: Este ejemplo habilita la transición entrante para la etapa especificada de la canalización especificada.
Enable-CPStageTransition -PipelineName CodePipelineDemo -StageName Beta -TransitionType Inbound
-
Para API obtener más información, consulte EnableStageTransition AWS Tools for PowerShellCmdlet Reference.
-
En el siguiente ejemplo de código se muestra cómo usar Get-CPActionType
.
- Herramientas para PowerShell
-
Ejemplo 1: en este ejemplo se obtiene información sobre todas las acciones disponibles para el propietario especificado.
ForEach ($actionType in (Get-CPActionType -ActionOwnerFilter AWS)) { Write-Output ("For Category = " + $actionType.Id.Category + ", Owner = " + $actionType.Id.Owner + ", Provider = " + $actionType.Id.Provider + ", Version = " + $actionType.Id.Version + ":") Write-Output (" ActionConfigurationProperties:") ForEach ($acp in $actionType.ActionConfigurationProperties) { Write-Output (" For " + $acp.Name + ":") Write-Output (" Description = " + $acp.Description) Write-Output (" Key = " + $acp.Key) Write-Output (" Queryable = " + $acp.Queryable) Write-Output (" Required = " + $acp.Required) Write-Output (" Secret = " + $acp.Secret) } Write-Output (" InputArtifactDetails:") Write-Output (" MaximumCount = " + $actionType.InputArtifactDetails.MaximumCount) Write-Output (" MinimumCount = " + $actionType.InputArtifactDetails.MinimumCount) Write-Output (" OutputArtifactDetails:") Write-Output (" MaximumCount = " + $actionType.OutputArtifactDetails.MaximumCount) Write-Output (" MinimumCount = " + $actionType.OutputArtifactDetails.MinimumCount) Write-Output (" Settings:") Write-Output (" EntityUrlTemplate = " + $actionType.Settings.EntityUrlTemplate) Write-Output (" ExecutionUrlTemplate = " + $actionType.Settings.ExecutionUrlTemplate) }
Salida:
For Category = Deploy, Owner = AWS, Provider = ElasticBeanstalk, Version = 1: ActionConfigurationProperties: For ApplicationName: Description = The AWS Elastic Beanstalk Application name Key = True Queryable = False Required = True Secret = False For EnvironmentName: Description = The AWS Elastic Beanstalk Environment name Key = True Queryable = False Required = True Secret = False InputArtifactDetails: MaximumCount = 1 MinimumCount = 1 OutputArtifactDetails: MaximumCount = 0 MinimumCount = 0 Settings: EntityUrlTemplate = https://console.aws.amazon.com/elasticbeanstalk/r/application/{Config:ApplicationName} ExecutionUrlTemplate = https://console.aws.amazon.com/elasticbeanstalk/r/application/{Config:ApplicationName} For Category = Deploy, Owner = AWS, Provider = CodeDeploy, Version = 1: ActionConfigurationProperties: For ApplicationName: Description = The AWS CodeDeploy Application name Key = True Queryable = False Required = True Secret = False For DeploymentGroupName: Description = The AWS CodeDeploy Deployment Group name Key = True Queryable = False Required = True Secret = False InputArtifactDetails: MaximumCount = 1 MinimumCount = 1 OutputArtifactDetails: MaximumCount = 0 MinimumCount = 0 Settings: EntityUrlTemplate = https://console.aws.amazon.com/codedeploy/home?#/applications/{Config:ApplicationName}/deployment-groups/{Config:DeploymentGroupName} ExecutionUrlTemplate = https://console.aws.amazon.com/codedeploy/home?#/deployments/{ExternalExecutionId}
-
Para API obtener más información, consulte ListActionTypes AWS Tools for PowerShellCmdlet Reference.
-
En el siguiente ejemplo de código se muestra cómo usar Get-CPActionableJobList
.
- Herramientas para PowerShell
-
Ejemplo 1: Este ejemplo obtiene información sobre todos los trabajos procesables para la categoría de acción, el propietario, el proveedor, la versión y los parámetros de consulta especificados.
Get-CPActionableJobList -ActionTypeId_Category Build -ActionTypeId_Owner Custom -ActionTypeId_Provider MyCustomProviderName -ActionTypeId_Version 1 -QueryParam @{"ProjectName" = "MyProjectName"}
Salida:
AccountId Data Id Nonce --------- ---- -- ----- 80398EXAMPLE Amazon.CodePipeline.Model.JobData 0de392f5-712d-4f41-ace3-f57a0EXAMPLE 3
-
Para API obtener más información, consulte PollForJobs AWS Tools for PowerShellCmdlet Reference.
-
En el siguiente ejemplo de código se muestra cómo usar Get-CPJobDetail
.
- Herramientas para PowerShell
-
Ejemplo 1: En este ejemplo se obtiene información general sobre el trabajo especificado.
Get-CPJobDetail -JobId f570dc12-5ef3-44bc-945a-6e133EXAMPLE
Salida:
AccountId Data Id --------- ---- -- 80398EXAMPLE Amazon.CodePipeline.Model.JobData f570dc12-5ef3-44bc-945a-6e133EXAMPLE
Ejemplo 2: En este ejemplo se obtiene información detallada sobre el trabajo especificado.
$jobDetails = Get-CPJobDetail -JobId f570dc12-5ef3-44bc-945a-6e133EXAMPLE Write-Output ("For Job " + $jobDetails.Id + ":") Write-Output (" AccountId = " + $jobDetails.AccountId) $jobData = $jobDetails.Data Write-Output (" Configuration:") ForEach ($key in $jobData.ActionConfiguration.Keys) { $value = $jobData.ActionConfiguration.$key Write-Output (" " + $key + " = " + $value) } Write-Output (" ActionTypeId:") Write-Output (" Category = " + $jobData.ActionTypeId.Category) Write-Output (" Owner = " + $jobData.ActionTypeId.Owner) Write-Output (" Provider = " + $jobData.ActionTypeId.Provider) Write-Output (" Version = " + $jobData.ActionTypeId.Version) Write-Output (" ArtifactCredentials:") Write-Output (" AccessKeyId = " + $jobData.ArtifactCredentials.AccessKeyId) Write-Output (" SecretAccessKey = " + $jobData.ArtifactCredentials.SecretAccessKey) Write-Output (" SessionToken = " + $jobData.ArtifactCredentials.SessionToken) Write-Output (" InputArtifacts:") ForEach ($ia in $jobData.InputArtifacts) { Write-Output (" " + $ia.Name) } Write-Output (" OutputArtifacts:") ForEach ($oa in $jobData.OutputArtifacts) { Write-Output (" " + $oa.Name) } Write-Output (" PipelineContext:") $context = $jobData.PipelineContext Write-Output (" Name = " + $context.Action.Name) Write-Output (" PipelineName = " + $context.PipelineName) Write-Output (" Stage = " + $context.Stage.Name)
Salida:
For Job f570dc12-5ef3-44bc-945a-6e133EXAMPLE: AccountId = 80398EXAMPLE Configuration: ActionTypeId: Category = Build Owner = Custom Provider = MyCustomProviderName Version = 1 ArtifactCredentials: AccessKeyId = ASIAIEI3...IXI6YREX SecretAccessKey = cqAFDhEi...RdQyfa2u SessionToken = AQoDYXdz...5u+lsAU= InputArtifacts: MyApp OutputArtifacts: MyAppBuild PipelineContext: Name = Build PipelineName = CodePipelineDemo Stage = Build
-
Para API obtener más información, consulte GetJobDetails AWS Tools for PowerShellCmdlet Reference.
-
En el siguiente ejemplo de código se muestra cómo usar Get-CPPipeline
.
- Herramientas para PowerShell
-
Ejemplo 1: En este ejemplo se obtiene información general sobre la canalización especificada.
Get-CPPipeline -Name CodePipelineDemo -Version 1
Salida:
ArtifactStore : Amazon.CodePipeline.Model.ArtifactStore Name : CodePipelineDemo RoleArn : arn:aws:iam::80398EXAMPLE:role/CodePipelineServiceRole Stages : {Source, Build, Beta, TestStage} Version : 1
Ejemplo 2: En este ejemplo se obtiene información detallada sobre la canalización especificada.
$pipeline = Get-CPPipeline -Name CodePipelineDemo Write-Output ("Name = " + $pipeline.Name) Write-Output ("RoleArn = " + $pipeline.RoleArn) Write-Output ("Version = " + $pipeline.Version) Write-Output ("ArtifactStore:") Write-Output (" Location = " + $pipeline.ArtifactStore.Location) Write-Output (" Type = " + $pipeline.ArtifactStore.Type.Value) Write-Output ("Stages:") ForEach ($stage in $pipeline.Stages) { Write-Output (" Name = " + $stage.Name) Write-Output (" Actions:") ForEach ($action in $stage.Actions) { Write-Output (" Name = " + $action.Name) Write-Output (" Category = " + $action.ActionTypeId.Category) Write-Output (" Owner = " + $action.ActionTypeId.Owner) Write-Output (" Provider = " + $action.ActionTypeId.Provider) Write-Output (" Version = " + $action.ActionTypeId.Version) Write-Output (" Configuration:") ForEach ($key in $action.Configuration.Keys) { $value = $action.Configuration.$key Write-Output (" " + $key + " = " + $value) } Write-Output (" InputArtifacts:") ForEach ($ia in $action.InputArtifacts) { Write-Output (" " + $ia.Name) } ForEach ($oa in $action.OutputArtifacts) { Write-Output (" " + $oa.Name) } Write-Output (" RunOrder = " + $action.RunOrder) } }
Salida:
Name = CodePipelineDemo RoleArn = arn:aws:iam::80398EXAMPLE:role/CodePipelineServiceRole Version = 3 ArtifactStore: Location = MyBucketName Type = S3 Stages: Name = Source Actions: Name = Source Category = Source Owner = ThirdParty Provider = GitHub Version = 1 Configuration: Branch = master OAuthToken = **** Owner = my-user-name Repo = MyRepoName InputArtifacts: MyApp RunOrder = 1 Name = Build Actions: Name = Build Category = Build Owner = Custom Provider = MyCustomProviderName Version = 1 Configuration: ProjectName = MyProjectName InputArtifacts: MyApp MyAppBuild RunOrder = 1 Name = Beta Actions: Name = CodePipelineDemoFleet Category = Deploy Owner = AWS Provider = CodeDeploy Version = 1 Configuration: ApplicationName = CodePipelineDemoApplication DeploymentGroupName = CodePipelineDemoFleet InputArtifacts: MyAppBuild RunOrder = 1 Name = TestStage Actions: Name = MyJenkinsTestAction Category = Test Owner = Custom Provider = MyCustomTestProvider Version = 1 Configuration: ProjectName = MyJenkinsProjectName InputArtifacts: MyAppBuild RunOrder = 1
-
Para API obtener más información, consulte GetPipeline AWS Tools for PowerShellCmdlet Reference.
-
En el siguiente ejemplo de código se muestra cómo usar Get-CPPipelineList
.
- Herramientas para PowerShell
-
Ejemplo 1: En este ejemplo se obtiene una lista de las canalizaciones disponibles.
Get-CPPipelineList
Salida:
Created Name Updated Version ------- ---- ------- ------- 8/13/2015 10:17:54 PM CodePipelineDemo 8/13/2015 10:17:54 PM 3 7/8/2015 2:41:53 AM MyFirstPipeline 7/22/2015 9:06:37 PM 7
-
Para API obtener más información, consulte ListPipelines AWS Tools for PowerShellCmdlet Reference.
-
En el siguiente ejemplo de código se muestra cómo usar Get-CPPipelineState
.
- Herramientas para PowerShell
-
Ejemplo 1: En este ejemplo se obtiene información general sobre las etapas de la canalización especificada.
Get-CPPipelineState -Name CodePipelineDemo
Salida:
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
Ejemplo 2: En este ejemplo se obtiene información detallada sobre el estado de la canalización especificada.
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) } }
Salida:
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 obtener más información, consulte GetPipelineState AWS Tools for PowerShellCmdlet Reference.
-
En el siguiente ejemplo de código se muestra cómo usar New-CPCustomActionType
.
- Herramientas para PowerShell
-
Ejemplo 1: En este ejemplo se crea una nueva acción personalizada con las propiedades especificadas.
New-CPCustomActionType -Category Build -ConfigurationProperty @{"Description" = "The name of the build project must be provided when this action is added to the pipeline."; "Key" = $True; "Name" = "ProjectName"; "Queryable" = $False; "Required" = $True; "Secret" = $False; "Type" = "String"} -Settings_EntityUrlTemplate "https://my-build-instance/job/{Config:ProjectName}/" -Settings_ExecutionUrlTemplate "https://my-build-instance/job/mybuildjob/lastSuccessfulBuild{ExternalExecutionId}/" -InputArtifactDetails_MaximumCount 1 -OutputArtifactDetails_MaximumCount 1 -InputArtifactDetails_MinimumCount 0 -OutputArtifactDetails_MinimumCount 0 -Provider "MyBuildProviderName" -Version 1
Salida:
ActionConfigurationProperties : {ProjectName} Id : Amazon.CodePipeline.Model.ActionTypeId InputArtifactDetails : Amazon.CodePipeline.Model.ArtifactDetails OutputArtifactDetails : Amazon.CodePipeline.Model.ArtifactDetails Settings : Amazon.CodePipeline.Model.ActionTypeSettings
-
Para API obtener más información, consulte CreateCustomActionType AWS Tools for PowerShellCmdlet Reference.
-
En el siguiente ejemplo de código se muestra cómo usar New-CPPipeline
.
- Herramientas para PowerShell
-
Ejemplo 1: Este ejemplo crea una nueva canalización con la configuración especificada.
$pipeline = New-Object Amazon.CodePipeline.Model.PipelineDeclaration $sourceStageAction = New-Object Amazon.CodePipeline.Model.ActionDeclaration $deployStageAction = New-Object Amazon.CodePipeline.Model.ActionDeclaration $sourceStageActionOutputArtifact = New-Object Amazon.CodePipeline.Model.OutputArtifact $sourceStageActionOutputArtifact.Name = "MyApp" $sourceStageAction.ActionTypeId = @{"Category" = "Source"; "Owner" = "AWS"; "Provider" = "S3"; "Version" = 1} $sourceStageAction.Configuration.Add("S3Bucket", "amzn-s3-demo-bucket") $sourceStageAction.Configuration.Add("S3ObjectKey", "my-object-key-name.zip") $sourceStageAction.OutputArtifacts.Add($sourceStageActionOutputArtifact) $sourceStageAction.Name = "Source" $deployStageActionInputArtifact = New-Object Amazon.CodePipeline.Model.InputArtifact $deployStageActionInputArtifact.Name = "MyApp" $deployStageAction.ActionTypeId = @{"Category" = "Deploy"; "Owner" = "AWS"; "Provider" = "CodeDeploy"; "Version" = 1} $deployStageAction.Configuration.Add("ApplicationName", "CodePipelineDemoApplication") $deployStageAction.Configuration.Add("DeploymentGroupName", "CodePipelineDemoFleet") $deployStageAction.InputArtifacts.Add($deployStageActionInputArtifact) $deployStageAction.Name = "CodePipelineDemoFleet" $sourceStage = New-Object Amazon.CodePipeline.Model.StageDeclaration $deployStage = New-Object Amazon.CodePipeline.Model.StageDeclaration $sourceStage.Name = "Source" $deployStage.Name = "Beta" $sourceStage.Actions.Add($sourceStageAction) $deployStage.Actions.Add($deployStageAction) $pipeline.ArtifactStore = @{"Location" = "amzn-s3-demo-bucket"; "Type" = "S3"} $pipeline.Name = "CodePipelineDemo" $pipeline.RoleArn = "arn:aws:iam::80398EXAMPLE:role/CodePipelineServiceRole" $pipeline.Stages.Add($sourceStage) $pipeline.Stages.Add($deployStage) $pipeline.Version = 1 New-CPPipeline -Pipeline $pipeline
Salida:
ArtifactStore : Amazon.CodePipeline.Model.ArtifactStore Name : CodePipelineDemo RoleArn : arn:aws:iam::80398EXAMPLE:role/CodePipelineServiceRole Stages : {Source, Beta} Version : 1
-
Para API obtener más información, consulte CreatePipeline AWS Tools for PowerShellCmdlet Reference.
-
En el siguiente ejemplo de código se muestra cómo usar Remove-CPCustomActionType
.
- Herramientas para PowerShell
-
Ejemplo 1: en este ejemplo se elimina la acción personalizada especificada. El comando solicitará una confirmación antes de continuar. Añada el parámetro -Force para eliminar la acción personalizada sin que aparezca un mensaje.
Remove-CPCustomActionType -Category Build -Provider MyBuildProviderName -Version 1
-
Para API obtener más información, consulte DeleteCustomActionType AWS Tools for PowerShellCmdlet Reference.
-
En el siguiente ejemplo de código se muestra cómo usar Remove-CPPipeline
.
- Herramientas para PowerShell
-
Ejemplo 1: en este ejemplo se elimina la canalización especificada. El comando solicitará una confirmación antes de continuar. Agregue el parámetro -Force para eliminar la canalización sin una solicitud.
Remove-CPPipeline -Name CodePipelineDemo
-
Para API obtener más información, consulte DeletePipeline AWS Tools for PowerShellCmdlet Reference.
-
En el siguiente ejemplo de código se muestra cómo usar Start-CPPipelineExecution
.
- Herramientas para PowerShell
-
Ejemplo 1: En este ejemplo se inicia la ejecución de la canalización especificada.
Start-CPPipelineExecution -Name CodePipelineDemo
-
Para API obtener más información, consulte StartPipelineExecution AWS Tools for PowerShellCmdlet Reference.
-
En el siguiente ejemplo de código se muestra cómo usar Update-CPPipeline
.
- Herramientas para PowerShell
-
Ejemplo 1: en este ejemplo se actualiza la canalización existente especificada con la configuración especificada.
$pipeline = New-Object Amazon.CodePipeline.Model.PipelineDeclaration $sourceStageAction = New-Object Amazon.CodePipeline.Model.ActionDeclaration $deployStageAction = New-Object Amazon.CodePipeline.Model.ActionDeclaration $sourceStageActionOutputArtifact = New-Object Amazon.CodePipeline.Model.OutputArtifact $sourceStageActionOutputArtifact.Name = "MyApp" $sourceStageAction.ActionTypeId = @{"Category" = "Source"; "Owner" = "AWS"; "Provider" = "S3"; "Version" = 1} $sourceStageAction.Configuration.Add("S3Bucket", "amzn-s3-demo-bucket") $sourceStageAction.Configuration.Add("S3ObjectKey", "my-object-key-name.zip") $sourceStageAction.OutputArtifacts.Add($sourceStageActionOutputArtifact) $sourceStageAction.Name = "Source" $deployStageActionInputArtifact = New-Object Amazon.CodePipeline.Model.InputArtifact $deployStageActionInputArtifact.Name = "MyApp" $deployStageAction.ActionTypeId = @{"Category" = "Deploy"; "Owner" = "AWS"; "Provider" = "CodeDeploy"; "Version" = 1} $deployStageAction.Configuration.Add("ApplicationName", "CodePipelineDemoApplication") $deployStageAction.Configuration.Add("DeploymentGroupName", "CodePipelineDemoFleet") $deployStageAction.InputArtifacts.Add($deployStageActionInputArtifact) $deployStageAction.Name = "CodePipelineDemoFleet" $sourceStage = New-Object Amazon.CodePipeline.Model.StageDeclaration $deployStage = New-Object Amazon.CodePipeline.Model.StageDeclaration $sourceStage.Name = "MyInputFiles" $deployStage.Name = "MyTestDeployment" $sourceStage.Actions.Add($sourceStageAction) $deployStage.Actions.Add($deployStageAction) $pipeline.ArtifactStore = @{"Location" = "amzn-s3-demo-bucket"; "Type" = "S3"} $pipeline.Name = "CodePipelineDemo" $pipeline.RoleArn = "arn:aws:iam::80398EXAMPLE:role/CodePipelineServiceRole" $pipeline.Stages.Add($sourceStage) $pipeline.Stages.Add($deployStage) $pipeline.Version = 1 Update-CPPipeline -Pipeline $pipeline
Salida:
ArtifactStore : Amazon.CodePipeline.Model.ArtifactStore Name : CodePipelineDemo RoleArn : arn:aws:iam::80398EXAMPLE:role/CodePipelineServiceRole Stages : {InputFiles, TestDeployment} Version : 2
-
Para API obtener más información, consulte UpdatePipeline AWS Tools for PowerShellCmdlet Reference.
-