amazon web services - Access AWS CodeBuild Variables in AWS CodePipeline -


i trying use aws codebuild id tag docker image. docker image built in build phase of codebuild. want coudebuild id docker tag in aws code pipeline phase. how access these codebuild environment variables in aws codepipeline?

codebuild phase:

codebuildproject: type: aws::codebuild::project properties:   artifacts:     location: !ref artifactbucket     type: "s3"   source:     location: !sub ${artifactbucket}/source.zip     type: "s3"     buildspec: |       version: 0.1       phases:         pre_build:           commands:             - $(aws ecr get-login --region $aws_default_region)             - sudo apt-get update             - echo pulling maven image...             - docker pull maven:3.3-jdk-8             - echo done pre build phase         build:           commands:             - echo build started on `date`             - printf "%s" $repository_uri             - docker run -i --rm -w /opt/maven -v $pwd:/opt/maven -v $home/.m2:/root/.m2 maven:3.3-jdk-8 mvn clean install             - docker build --file dockerfile --tag $repository_uri:$codebuild_build_id .         post_build:           commands:             - echo post build             - docker push $repository_uri:$codebuild_build_id         discard-paths: yes   environment:     computetype: "build_general1_large"      image: "aws/codebuild/docker:1.12.1"     type: "linux_container"     environmentvariables:       - name: aws_default_region         value: !ref aws::region       - name: repository_uri         value: !sub ${aws::accountid}.dkr.ecr.${aws::region}.amazonaws.com/${repository}       - name: pipelinename         value: !ref pipelinename   name: !ref aws::stackname   servicerole: !ref codebuildservicerole 

here docker image combination of repository url , codebuild id. want use codebuild id in deploy phase of aws codepipeline, how it?

 pipeline: type: aws::codepipeline::pipeline properties:   name: !ref pipelinename   rolearn: !getatt codepipelineservicerole.arn   artifactstore:     type: s3     location: !ref artifactbucket   stages:     - name: source       actions:         - name: githubreposource           actiontypeid:             category: source             owner: thirdparty             provider: github             version: 1           configuration:             owner: !ref githubuser             repo: !ref githubrepo             branch: !ref githubbranch             oauthtoken: !ref githubtoken           outputartifacts:             - name: githubreposource           runorder: 1     - name: build       actions:         - name: build           actiontypeid:             category: build             owner: aws             version: 1             provider: codebuild           configuration:             projectname: !ref codebuildproject           inputartifacts:             - name: githubreposource           outputartifacts:             - name: buildoutput           runorder: 1     - name: deploy       actions:         - name: deploy           actiontypeid:             category: deploy             owner: aws             version: 1             provider: cloudformation           configuration:             changesetname: deploy             actionmode: create_update             stackname: !sub "${aws::stackname}-service"             capabilities: capability_named_iam             templatepath: https://s3.amazonaws.com/cicdoveraws-visa/service.yaml             rolearn: !getatt cloudformationexecutionrole.arn             parameteroverrides: !sub |               {                 "tag" : "${}",                 "desiredcount": "2",                 "cluster": "${ecscluster}",                 "targetgroup": "${ecstg}",                 "imagename": "${aws::accountid}.dkr.ecr.${aws::region}.amazonaws.com/${repository}:<tag name>,                 "containername": "${containername}",                 "cpu": "${cpu}",                 "memory": "${memory}",                 "containerport": "${containerport}"                }           inputartifacts:             - name: buildoutput           runorder: 1 


Comments

Popular posts from this blog

node.js - Node js - Trying to send POST request, but it is not loading javascript content -

javascript - Replicate keyboard event with html button -

javascript - Web audio api 5.1 surround example not working in firefox -