Reputation: 1035
I am currently creating a pipeline using codepipeline, codebuild, codedeploy and codecommit. I encountered a problem when my uploading codebuild build artifacts to s3 because it does not follow the artifact name i setup in my buildspec.yml:
artifacts:
files:
- '**/build/*'
name: build-$(date +%Y-%m-%d)
Instead it randomly creates a build name. In my codebuild settings i already enabled semantic versioning but it seems like its being ignored by codepipeline because i can see in the logs that there is a difference when generating the build artifacts if i run codepipeline or i run codebuild only.
This is what's being displayed in the logs for codebuild only:
[Container] 2019/08/08 09:28:07 Assembling file list
[Container] 2019/08/08 09:28:07 Expanding **/build/*
[Container] 2019/08/08 09:28:08 Found 144 file(s)
[Container] 2019/08/08 09:28:08 Updating artifact name as build-2019-08-08
This is what's being displayed in the logs for codepipeline:
[Container] 2019/08/08 09:19:50 Assembling file list
[Container] 2019/08/08 09:19:50 Expanding **/build/*
[Container] 2019/08/08 09:19:50 Found 144 file(s)
[Container] 2019/08/08 09:19:50 Phase complete: UPLOAD_ARTIFACTS State: SUCCEEDED
You can see that the Updating artifact name as build-2019-08-08 line is not present in the logs when i run codepipeline.
Can someone help me with this?
Upvotes: 4
Views: 1223
Reputation: 2545
When you use CodeBuild as a build or test step in your CodePipeline, your pipeline controls the artifact naming. Meaning, artifact naming is managed by CodePipeline and can't be overriden.
You have a 3-stage pipeline, CodeCommit -> CodeBuild -> CodeDeploy. When configuring the pipeline, you configure the output artifact name which acts as the input for the next stage. Having these artifacts names be pipeline-defined enables changes to flow through in a versioned manner.
Upvotes: 7