Reputation: 916
I have AWS CodePipline with these steps:
When I run CodeBuild phase manually 2 artifacts successfully uploaded to the s3.
When I change code and push it to CodeCommit pipeline executes successfully, but artifacts don't upload to the S3 bucket. When I read the pipeline logs it asserts that 2 files uploaded successfully to the S3 bucket. but files are not in the S3 bucket.
Both Pipeline and CodeBuild use the same S3 bucket. these are Pipeline logs. The last 3 lines of log assert that 2 artifacts successfully uploaded to the S# bucket.
Container] 2020/08/24 08:25:55 Phase complete: POST_BUILD State: SUCCEEDED
[Container] 2020/08/24 08:25:55 Phase context status code: Message:
[Container] 2020/08/24 08:25:55 Expanding base directory path: ./build-artifacts
[Container] 2020/08/24 08:25:55 Assembling file list
[Container] 2020/08/24 08:25:55 Expanding ./build-artifacts
[Container] 2020/08/24 08:25:55 Expanding file paths for base directory ./build-artifacts
[Container] 2020/08/24 08:25:55 Assembling file list
[Container] 2020/08/24 08:25:55 Expanding **/*
[Container] 2020/08/24 08:25:55 Found 2 file(s)
[Container] 2020/08/24 08:25:56 Phase complete: UPLOAD_ARTIFACTS State: SUCCEEDED
[Container] 2020/08/24 08:25:56 Phase context status code: Message:
Upvotes: 2
Views: 1848
Reputation: 11
The reason you are not able to see the artifacts is because codepipeline is storing the artifacts in it's own pipeline.
Whenever a codepipeline is created in a region,AWS codepipeline creates a s3 bucket in that region which it uses to store the artifacts for all the pipelines which are created in that region.
If you want to upload the artifacts in a separate s3 bucket you can use aws s3 cli for that
Example
AWS s3 sync codebuild/*/<filename> s3://<s3 bucket name>
Upvotes: 0
Reputation: 238091
As explained in the comments, the reason why you can't see the artifacts in your bucket is that CodePipeline (CP) will store it in CP's bucket. You can inspect the CP's bucket.
The artifacts will be zipped, although the file in the bucket will have no extension and will have a random name. You can download the file, add zip
extension and unpack to verify.
One way to deploy to S3 is through a Deploy
action and Amazaon S3 action provider. But this will just deploy the zip, it will not unpack it. I don't think this is what you are aiming for.
The alternative is to use AWS CLI in your CodeBuild project to simply copy "manually" the artifacts to the desired bucket. This probably would be the easiest way.
Upvotes: 3
Reputation: 5678
CodePipeline will override the CodeBuild's artifact bucket, I guess it's moving the artifacts to its own Bucket. you can see the CodePipeline's bucket by running the below command.
codepipeline get-pipeline --name PipelineName--query pipeline.[artifactStore]
[
{
"type": "S3",
"location": "codepipeline-us-east-1-xxxxxxxx"
}
]
If you are using CloudFormation to create the pipeline you configure the bucket using ArtifactStore.
Update ArtifactStore in CodePipeline:
Currently, I don't see a way to update the ArtifactStore through Console but it can be done with update-pipeline
command.
Get the pipleline details:
aws codepipeline get-pipeline --name MyFirstPipeline >pipeline.json
Edit the pipeline to update the S3 Bucket in artifactStore
and then run the command.
aws codepipeline update-pipeline --cli-input-json file://pipeline.json
Answer Reference: https://stackoverflow.com/a/49292819/11758843
Upvotes: 0