- Newest
- Most votes
- Most comments
I couldn't write it all in the comments, so I'll make a new post, but I have CodePipeline set up as follows.
Is your build stage's "outputArtifacts" an empty list?
aws codepipeline get-pipeline --name ecr
{
"pipeline": {
"name": "ecr",
"roleArn": "arn:aws:iam::111111111111:role/service-role/AWSCodePipelineServiceRole-ap-northeast-1-ecr",
"artifactStore": {
"type": "S3",
"location": "codepipeline-ap-northeast-1-xxxxxxxxxxxx"
},
"stages": [
{
"name": "Source",
"actions": [
{
"name": "Source",
"actionTypeId": {
"category": "Source",
"owner": "AWS",
"provider": "CodeCommit",
"version": "1"
},
"runOrder": 1,
"configuration": {
"BranchName": "main",
"OutputArtifactFormat": "CODE_ZIP",
"PollForSourceChanges": "false",
"RepositoryName": "ecr"
},
"outputArtifacts": [
{
"name": "SourceArtifact"
}
],
"inputArtifacts": [],
"region": "ap-northeast-1",
"namespace": "SourceVariables"
}
]
},
{
"name": "Build",
"actions": [
{
"name": "Build",
"actionTypeId": {
"category": "Build",
"owner": "AWS",
"provider": "CodeBuild",
"version": "1"
},
"runOrder": 1,
"configuration": {
"ProjectName": "ecr"
},
"outputArtifacts": [],
"inputArtifacts": [
{
"name": "SourceArtifact"
}
],
"region": "ap-northeast-1",
"namespace": "BuildVariables"
}
]
}
],
"version": 2,
"executionMode": "QUEUED",
"pipelineType": "V2"
},
"metadata": {
"pipelineArn": "arn:aws:codepipeline:ap-northeast-1:1111111111:ecr",
"created": "2024-10-04T13:01:09.134000+00:00",
"updated": "2024-10-04T13:01:40.586000+00:00"
}
}
The CodeBuild settings are as follows.
aws codebuild batch-get-projects --names ecr
{
"projects": [
{
"name": "ecr",
"arn": "arn:aws:codebuild:ap-northeast-1:11111111111:project/ecr",
"source": {
"type": "CODECOMMIT",
"location": "https://git- codecommit.ap-northeast-1.amazonaws.com/v1/repos/ecr",
"gitCloneDepth": 1,
"gitSubmodulesConfig": {
"fetchSubmodules": false
},
"buildspec": "buildspec.yml",
"insecureSsl": false
},
"secondarySources": [],
"sourceVersion": "refs/heads/main",
"secondarySourceVersions": [],
"artifacts": {
"type": "NO_ARTIFACTS"
},
"secondaryArtifacts": [],
"cache": {
"type": "NO_CACHE"
},
"environment": {
"type": "LINUX_CONTAINER",
"image": "aws/codebuild/amazonlinux2-x86_64-standard:5.0",
"computeType": "BUILD_GENERAL1_SMALL",
"environmentVariables": [],
"privilegedMode": false,
"imagePullCredentialsType": "CODEBUILD"
},
"serviceRole": "arn:aws:iam::111111111111:role/service-role/codebuild-ecr-service-role",
"timeoutInMinutes": 60,
"queuedTimeoutInMinutes": 480,
"encryptionKey": "arn:aws:kms:ap-northeast-1:111111111111:alias/aws/s3",
"tags": [],
"created": "2024-10-04T12:47:21.640000+00:00",
"lastModified": "2024-10-04T12:47:21.640000+00:00",
"badge": {
"badgeEnabled": false
},
"logsConfig": {
"cloudWatchLogs": {
"status": "ENABLED"
},
"s3Logs": {
"status": "DISABLED",
"encryptionDisabled": false
}
},
"projectVisibility": "PRIVATE"
}
],
"projectsNotFound": []
}
Hello.
As described in the document below, "artifacts" in buildspec.yml should not be necessary when building Docker containers.
Will artifacts be uploaded to S3 even if I delete "artifacts" in buildspec.yml?
https://docs.aws.amazon.com/codebuild/latest/userguide/build-spec-ref.html#build-spec.artifacts
Optional sequence. Represents information about where CodeBuild can find the build output and how CodeBuild prepares it for uploading to the S3 output bucket. This sequence is not required if, for example, you are building and pushing a Docker image to Amazon ECR, or you are running unit tests on your source code, but not building it.
Also, why not try leaving the output artifact blank in CodePipeline's build phase settings?
By the way, when deploying to ECS in the deployment phase, I think that the deployment would fail if there was no "imagedefinitions.json" in the output artifact.
https://docs.aws.amazon.com/codepipeline/latest/userguide/ecs-cd-pipeline.html
Also, why not try leaving the output artifact blank
I have it blank. It does not matter. Because the artifact type is set to CODEPIPELINE and cannot be unset, which then forces the creation of artifacts.
Are you really leaving CodePipeline's build stage output artifacts blank? Isn't what you're seeing a source stage artifact? I'm trying it on my AWS account, and if I empty the output artifacts of a build stage in CodePipeline, no build stage artifacts are created in S3.
Relevant content
- asked 2 years ago
- AWS OFFICIALUpdated 7 months ago
Yes, but the point is that if you do not set the artifact, it will take
**/*
as an artifact, which is ALL files. Whether or not they are in S3, I don't know. But it still goes thru the act of gathering the artifacts, and it takes time. I don't want it to do any artifact activity whatsoever, as it is useless work.