CodePipeline Beispiele für die Verwendung von Tools für PowerShell - AWS SDKCode-Beispiele

Weitere AWS SDK Beispiele sind im Repo AWS Doc SDK Examples GitHub verfügbar.

Die vorliegende Übersetzung wurde maschinell erstellt. Im Falle eines Konflikts oder eines Widerspruchs zwischen dieser übersetzten Fassung und der englischen Fassung (einschließlich infolge von Verzögerungen bei der Übersetzung) ist die englische Fassung maßgeblich.

CodePipeline Beispiele für die Verwendung von Tools für PowerShell

Die folgenden Codebeispiele zeigen Ihnen, wie Sie mithilfe von AWS Tools for PowerShell with Aktionen ausführen und allgemeine Szenarien implementieren CodePipeline.

Aktionen sind Codeauszüge aus größeren Programmen und müssen im Kontext ausgeführt werden. Aktionen zeigen Ihnen zwar, wie Sie einzelne Servicefunktionen aufrufen, aber Sie können Aktionen im Kontext der zugehörigen Szenarien sehen.

Jedes Beispiel enthält einen Link zum vollständigen Quellcode, in dem Sie Anweisungen zum Einrichten und Ausführen des Codes im Kontext finden.

Themen

Aktionen

Das folgende Codebeispiel zeigt die VerwendungConfirm-CPJob.

Tools für PowerShell

Beispiel 1: In diesem Beispiel wird der Status des angegebenen Jobs abgerufen.

Confirm-CPJob -JobId f570dc12-5ef3-44bc-945a-6e133EXAMPLE -Nonce 3

Ausgabe:

Value ----- InProgress

Das folgende Codebeispiel zeigt, wie Sie es verwenden. Disable-CPStageTransition

Tools für PowerShell

Beispiel 1: In diesem Beispiel wird der eingehende Übergang für die angegebene Phase in der angegebenen Pipeline deaktiviert.

Disable-CPStageTransition -PipelineName CodePipelineDemo -Reason "Disabling temporarily." -StageName Beta -TransitionType Inbound

Das folgende Codebeispiel zeigt, wie Sie es verwenden. Enable-CPStageTransition

Tools für PowerShell

Beispiel 1: In diesem Beispiel wird der eingehende Übergang für die angegebene Phase in der angegebenen Pipeline aktiviert.

Enable-CPStageTransition -PipelineName CodePipelineDemo -StageName Beta -TransitionType Inbound

Das folgende Codebeispiel zeigt, wie Sie es verwenden. Get-CPActionType

Tools für PowerShell

Beispiel 1: In diesem Beispiel werden Informationen über alle verfügbaren Aktionen für den angegebenen Besitzer abgerufen.

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) }

Ausgabe:

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}

Das folgende Codebeispiel zeigt, wie Sie es verwenden. Get-CPActionableJobList

Tools für PowerShell

Beispiel 1: In diesem Beispiel werden Informationen über alle Aufträge abgerufen, für die eine Aktion in der angegebenen Kategorie, dem Besitzer, dem Anbieter, der Version und den Abfrageparametern ausgeführt werden kann.

Get-CPActionableJobList -ActionTypeId_Category Build -ActionTypeId_Owner Custom -ActionTypeId_Provider MyCustomProviderName -ActionTypeId_Version 1 -QueryParam @{"ProjectName" = "MyProjectName"}

Ausgabe:

AccountId Data Id Nonce --------- ---- -- ----- 80398EXAMPLE Amazon.CodePipeline.Model.JobData 0de392f5-712d-4f41-ace3-f57a0EXAMPLE 3

Das folgende Codebeispiel zeigt, wie Sie es verwenden. Get-CPJobDetail

Tools für PowerShell

Beispiel 1: In diesem Beispiel werden allgemeine Informationen über den angegebenen Job abgerufen.

Get-CPJobDetail -JobId f570dc12-5ef3-44bc-945a-6e133EXAMPLE

Ausgabe:

AccountId Data Id --------- ---- -- 80398EXAMPLE Amazon.CodePipeline.Model.JobData f570dc12-5ef3-44bc-945a-6e133EXAMPLE

Beispiel 2: In diesem Beispiel werden detaillierte Informationen über den angegebenen Job abgerufen.

$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)

Ausgabe:

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

Das folgende Codebeispiel zeigt, wie Sie es verwenden. Get-CPPipeline

Tools für PowerShell

Beispiel 1: In diesem Beispiel werden allgemeine Informationen über die angegebene Pipeline abgerufen.

Get-CPPipeline -Name CodePipelineDemo -Version 1

Ausgabe:

ArtifactStore : Amazon.CodePipeline.Model.ArtifactStore Name : CodePipelineDemo RoleArn : arn:aws:iam::80398EXAMPLE:role/CodePipelineServiceRole Stages : {Source, Build, Beta, TestStage} Version : 1

Beispiel 2: In diesem Beispiel werden detaillierte Informationen über die angegebene Pipeline abgerufen.

$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) } }

Ausgabe:

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

Das folgende Codebeispiel zeigt, wie Sie es verwenden. Get-CPPipelineList

Tools für PowerShell

Beispiel 1: In diesem Beispiel wird eine Liste der verfügbaren Pipelines abgerufen.

Get-CPPipelineList

Ausgabe:

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

Das folgende Codebeispiel zeigt, wie Sie es verwenden. Get-CPPipelineState

Tools für PowerShell

Beispiel 1: In diesem Beispiel werden allgemeine Informationen zu den Phasen der angegebenen Pipeline abgerufen.

Get-CPPipelineState -Name CodePipelineDemo

Ausgabe:

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

Beispiel 2: In diesem Beispiel werden detaillierte Informationen über den Status der angegebenen Pipeline abgerufen.

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) } }

Ausgabe:

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 =

Das folgende Codebeispiel zeigt, wie Sie es verwenden. New-CPCustomActionType

Tools für PowerShell

Beispiel 1: In diesem Beispiel wird eine neue benutzerdefinierte Aktion mit den angegebenen Eigenschaften erstellt.

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

Ausgabe:

ActionConfigurationProperties : {ProjectName} Id : Amazon.CodePipeline.Model.ActionTypeId InputArtifactDetails : Amazon.CodePipeline.Model.ArtifactDetails OutputArtifactDetails : Amazon.CodePipeline.Model.ArtifactDetails Settings : Amazon.CodePipeline.Model.ActionTypeSettings

Das folgende Codebeispiel zeigt, wie Sie es verwenden. New-CPPipeline

Tools für PowerShell

Beispiel 1: In diesem Beispiel wird eine neue Pipeline mit den angegebenen Einstellungen erstellt.

$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

Ausgabe:

ArtifactStore : Amazon.CodePipeline.Model.ArtifactStore Name : CodePipelineDemo RoleArn : arn:aws:iam::80398EXAMPLE:role/CodePipelineServiceRole Stages : {Source, Beta} Version : 1

Das folgende Codebeispiel zeigt, wie Sie es verwenden. Remove-CPCustomActionType

Tools für PowerShell

Beispiel 1: In diesem Beispiel wird die angegebene benutzerdefinierte Aktion gelöscht. Der Befehl fordert Sie zur Bestätigung auf, bevor Sie fortfahren. Fügen Sie den Parameter -Force hinzu, um die benutzerdefinierte Aktion ohne Aufforderung zu löschen.

Remove-CPCustomActionType -Category Build -Provider MyBuildProviderName -Version 1

Das folgende Codebeispiel zeigt, wie Sie es verwenden. Remove-CPPipeline

Tools für PowerShell

Beispiel 1: In diesem Beispiel wird die angegebene Pipeline gelöscht. Der Befehl fordert Sie zur Bestätigung auf, bevor Sie fortfahren. Fügen Sie den Parameter -Force hinzu, um die Pipeline ohne Aufforderung zu löschen.

Remove-CPPipeline -Name CodePipelineDemo

Das folgende Codebeispiel zeigt, wie Sie es verwenden. Start-CPPipelineExecution

Tools für PowerShell

Beispiel 1: In diesem Beispiel wird mit der Ausführung der angegebenen Pipeline begonnen.

Start-CPPipelineExecution -Name CodePipelineDemo

Das folgende Codebeispiel zeigt, wie Sie es verwenden. Update-CPPipeline

Tools für PowerShell

Beispiel 1: In diesem Beispiel wird die angegebene bestehende Pipeline mit den angegebenen Einstellungen aktualisiert.

$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

Ausgabe:

ArtifactStore : Amazon.CodePipeline.Model.ArtifactStore Name : CodePipelineDemo RoleArn : arn:aws:iam::80398EXAMPLE:role/CodePipelineServiceRole Stages : {InputFiles, TestDeployment} Version : 2