Codepipeline restricting artifact properties in codebuild
I had created a codebuild to build my project based on the changes in codecommit. This is the batch-get-projects
command details for it
{
"projects": [
{
"name": "MultiRepBuild",
"arn": "arn:aws:codebuild:us-east-1:100000xxx0x:project/MultiRepBui
ld",
"source": {
"type": "CODECOMMIT",
"location": "https://git-codecommit.us-east-1.amazonaws.com/v1/r
epos/PythonRep",
"gitCloneDepth": 1,
"insecureSsl": false
},
"secondarySources": ,
"artifacts": {
"type": "S3",
"location": "testxxxthe-codebuild",
"path": "",
"namespaceType": "NONE",
"name": "Lambda",
"packaging": "ZIP",
"overrideArtifactName": false,
"encryptionDisabled": false
},
"secondaryArtifacts": ,
"cache": {
"type": "NO_CACHE"
},
"environment": {
"type": "LINUX_CONTAINER",
"image": "aws/codebuild/python:3.6.5",
"computeType": "BUILD_GENERAL1_SMALL",
"environmentVariables": ,
"privilegedMode": false
},
"serviceRole": "arn:aws:iam::xxxxxxxx:role/service-role/codebuil
d-MultiRepBuild-service-role",
"timeoutInMinutes": 60,
"encryptionKey": "arn:aws:kms:us-east-1:xxxxxx:alias/aws/s3",
"tags": ,
"created": 1542607679.567,
"lastModified": 1542611632.345,
"badge": {
"badgeEnabled": false
}
}
],
"projectsNotFound":
}
This codebuild will create a buildartifact with specified name Lambda
and keep it in specified bucket in zip format.
But when i integrate same codebuild with the Codepipeline it is overriding the bucketname as per this answer. Even i try to change the bucketname with cloudformation but how can i add the parameters that are defined in the artifacts section(i.e.name
) from the above snippet, because i will point this name
as an S3KeyName
in my cloudformation template.
I tried to change in the name in below file which i got through by running aws codepipeline get-pipeline --name MyFirstPipeline >pipeline.json
command
{
"pipeline": {
"name": "MultiBuild",
"roleArn": "arn:aws:iam::xxxxxxxxxxx:role/service-role/AWSCodePipelineServiceRole-us-east-1-MultiBuild",
"artifactStore": {
"type": "S3",
"location": "codepipeline-us-east-1-xxxxx"
},
"stages": [
{
"name": "Source",
"actions": [
{
"name": "Source",
"actionTypeId": {
"category": "Source",
"owner": "AWS",
"provider": "CodeCommit",
"version": "1"
},
"runOrder": 1,
"configuration": {
"BranchName": "master",
"PollForSourceChanges": "false",
"RepositoryName": "PythonRep"
},
"outputArtifacts": [
{
"name": "SourceArtifact"
}
],
"inputArtifacts":
}
]
},
{
"name": "Build",
"actions": [
{
"name": "Build",
"actionTypeId": {
"category": "Build",
"owner": "AWS",
"provider": "CodeBuild",
"version": "1"
},
"runOrder": 1,
"configuration": {
"ProjectName": "MultiRepBuild"
},
"outputArtifacts": [
{
"name": "Lambda" -->Here
}
],
"inputArtifacts": [
{
"name": "SourceArtifact"
}
]
}
]
}
],
"version": 1
}
}
This is creating a folder with name Lambda
rather than creating a file. The file structure is like this
---MultiBuild
|
|
-->Lambda
|
|
abcd.zip
-->SourceArti
|
|
efgh.zip
amazon-web-services aws-codepipeline aws-codebuild
add a comment |
I had created a codebuild to build my project based on the changes in codecommit. This is the batch-get-projects
command details for it
{
"projects": [
{
"name": "MultiRepBuild",
"arn": "arn:aws:codebuild:us-east-1:100000xxx0x:project/MultiRepBui
ld",
"source": {
"type": "CODECOMMIT",
"location": "https://git-codecommit.us-east-1.amazonaws.com/v1/r
epos/PythonRep",
"gitCloneDepth": 1,
"insecureSsl": false
},
"secondarySources": ,
"artifacts": {
"type": "S3",
"location": "testxxxthe-codebuild",
"path": "",
"namespaceType": "NONE",
"name": "Lambda",
"packaging": "ZIP",
"overrideArtifactName": false,
"encryptionDisabled": false
},
"secondaryArtifacts": ,
"cache": {
"type": "NO_CACHE"
},
"environment": {
"type": "LINUX_CONTAINER",
"image": "aws/codebuild/python:3.6.5",
"computeType": "BUILD_GENERAL1_SMALL",
"environmentVariables": ,
"privilegedMode": false
},
"serviceRole": "arn:aws:iam::xxxxxxxx:role/service-role/codebuil
d-MultiRepBuild-service-role",
"timeoutInMinutes": 60,
"encryptionKey": "arn:aws:kms:us-east-1:xxxxxx:alias/aws/s3",
"tags": ,
"created": 1542607679.567,
"lastModified": 1542611632.345,
"badge": {
"badgeEnabled": false
}
}
],
"projectsNotFound":
}
This codebuild will create a buildartifact with specified name Lambda
and keep it in specified bucket in zip format.
But when i integrate same codebuild with the Codepipeline it is overriding the bucketname as per this answer. Even i try to change the bucketname with cloudformation but how can i add the parameters that are defined in the artifacts section(i.e.name
) from the above snippet, because i will point this name
as an S3KeyName
in my cloudformation template.
I tried to change in the name in below file which i got through by running aws codepipeline get-pipeline --name MyFirstPipeline >pipeline.json
command
{
"pipeline": {
"name": "MultiBuild",
"roleArn": "arn:aws:iam::xxxxxxxxxxx:role/service-role/AWSCodePipelineServiceRole-us-east-1-MultiBuild",
"artifactStore": {
"type": "S3",
"location": "codepipeline-us-east-1-xxxxx"
},
"stages": [
{
"name": "Source",
"actions": [
{
"name": "Source",
"actionTypeId": {
"category": "Source",
"owner": "AWS",
"provider": "CodeCommit",
"version": "1"
},
"runOrder": 1,
"configuration": {
"BranchName": "master",
"PollForSourceChanges": "false",
"RepositoryName": "PythonRep"
},
"outputArtifacts": [
{
"name": "SourceArtifact"
}
],
"inputArtifacts":
}
]
},
{
"name": "Build",
"actions": [
{
"name": "Build",
"actionTypeId": {
"category": "Build",
"owner": "AWS",
"provider": "CodeBuild",
"version": "1"
},
"runOrder": 1,
"configuration": {
"ProjectName": "MultiRepBuild"
},
"outputArtifacts": [
{
"name": "Lambda" -->Here
}
],
"inputArtifacts": [
{
"name": "SourceArtifact"
}
]
}
]
}
],
"version": 1
}
}
This is creating a folder with name Lambda
rather than creating a file. The file structure is like this
---MultiBuild
|
|
-->Lambda
|
|
abcd.zip
-->SourceArti
|
|
efgh.zip
amazon-web-services aws-codepipeline aws-codebuild
add a comment |
I had created a codebuild to build my project based on the changes in codecommit. This is the batch-get-projects
command details for it
{
"projects": [
{
"name": "MultiRepBuild",
"arn": "arn:aws:codebuild:us-east-1:100000xxx0x:project/MultiRepBui
ld",
"source": {
"type": "CODECOMMIT",
"location": "https://git-codecommit.us-east-1.amazonaws.com/v1/r
epos/PythonRep",
"gitCloneDepth": 1,
"insecureSsl": false
},
"secondarySources": ,
"artifacts": {
"type": "S3",
"location": "testxxxthe-codebuild",
"path": "",
"namespaceType": "NONE",
"name": "Lambda",
"packaging": "ZIP",
"overrideArtifactName": false,
"encryptionDisabled": false
},
"secondaryArtifacts": ,
"cache": {
"type": "NO_CACHE"
},
"environment": {
"type": "LINUX_CONTAINER",
"image": "aws/codebuild/python:3.6.5",
"computeType": "BUILD_GENERAL1_SMALL",
"environmentVariables": ,
"privilegedMode": false
},
"serviceRole": "arn:aws:iam::xxxxxxxx:role/service-role/codebuil
d-MultiRepBuild-service-role",
"timeoutInMinutes": 60,
"encryptionKey": "arn:aws:kms:us-east-1:xxxxxx:alias/aws/s3",
"tags": ,
"created": 1542607679.567,
"lastModified": 1542611632.345,
"badge": {
"badgeEnabled": false
}
}
],
"projectsNotFound":
}
This codebuild will create a buildartifact with specified name Lambda
and keep it in specified bucket in zip format.
But when i integrate same codebuild with the Codepipeline it is overriding the bucketname as per this answer. Even i try to change the bucketname with cloudformation but how can i add the parameters that are defined in the artifacts section(i.e.name
) from the above snippet, because i will point this name
as an S3KeyName
in my cloudformation template.
I tried to change in the name in below file which i got through by running aws codepipeline get-pipeline --name MyFirstPipeline >pipeline.json
command
{
"pipeline": {
"name": "MultiBuild",
"roleArn": "arn:aws:iam::xxxxxxxxxxx:role/service-role/AWSCodePipelineServiceRole-us-east-1-MultiBuild",
"artifactStore": {
"type": "S3",
"location": "codepipeline-us-east-1-xxxxx"
},
"stages": [
{
"name": "Source",
"actions": [
{
"name": "Source",
"actionTypeId": {
"category": "Source",
"owner": "AWS",
"provider": "CodeCommit",
"version": "1"
},
"runOrder": 1,
"configuration": {
"BranchName": "master",
"PollForSourceChanges": "false",
"RepositoryName": "PythonRep"
},
"outputArtifacts": [
{
"name": "SourceArtifact"
}
],
"inputArtifacts":
}
]
},
{
"name": "Build",
"actions": [
{
"name": "Build",
"actionTypeId": {
"category": "Build",
"owner": "AWS",
"provider": "CodeBuild",
"version": "1"
},
"runOrder": 1,
"configuration": {
"ProjectName": "MultiRepBuild"
},
"outputArtifacts": [
{
"name": "Lambda" -->Here
}
],
"inputArtifacts": [
{
"name": "SourceArtifact"
}
]
}
]
}
],
"version": 1
}
}
This is creating a folder with name Lambda
rather than creating a file. The file structure is like this
---MultiBuild
|
|
-->Lambda
|
|
abcd.zip
-->SourceArti
|
|
efgh.zip
amazon-web-services aws-codepipeline aws-codebuild
I had created a codebuild to build my project based on the changes in codecommit. This is the batch-get-projects
command details for it
{
"projects": [
{
"name": "MultiRepBuild",
"arn": "arn:aws:codebuild:us-east-1:100000xxx0x:project/MultiRepBui
ld",
"source": {
"type": "CODECOMMIT",
"location": "https://git-codecommit.us-east-1.amazonaws.com/v1/r
epos/PythonRep",
"gitCloneDepth": 1,
"insecureSsl": false
},
"secondarySources": ,
"artifacts": {
"type": "S3",
"location": "testxxxthe-codebuild",
"path": "",
"namespaceType": "NONE",
"name": "Lambda",
"packaging": "ZIP",
"overrideArtifactName": false,
"encryptionDisabled": false
},
"secondaryArtifacts": ,
"cache": {
"type": "NO_CACHE"
},
"environment": {
"type": "LINUX_CONTAINER",
"image": "aws/codebuild/python:3.6.5",
"computeType": "BUILD_GENERAL1_SMALL",
"environmentVariables": ,
"privilegedMode": false
},
"serviceRole": "arn:aws:iam::xxxxxxxx:role/service-role/codebuil
d-MultiRepBuild-service-role",
"timeoutInMinutes": 60,
"encryptionKey": "arn:aws:kms:us-east-1:xxxxxx:alias/aws/s3",
"tags": ,
"created": 1542607679.567,
"lastModified": 1542611632.345,
"badge": {
"badgeEnabled": false
}
}
],
"projectsNotFound":
}
This codebuild will create a buildartifact with specified name Lambda
and keep it in specified bucket in zip format.
But when i integrate same codebuild with the Codepipeline it is overriding the bucketname as per this answer. Even i try to change the bucketname with cloudformation but how can i add the parameters that are defined in the artifacts section(i.e.name
) from the above snippet, because i will point this name
as an S3KeyName
in my cloudformation template.
I tried to change in the name in below file which i got through by running aws codepipeline get-pipeline --name MyFirstPipeline >pipeline.json
command
{
"pipeline": {
"name": "MultiBuild",
"roleArn": "arn:aws:iam::xxxxxxxxxxx:role/service-role/AWSCodePipelineServiceRole-us-east-1-MultiBuild",
"artifactStore": {
"type": "S3",
"location": "codepipeline-us-east-1-xxxxx"
},
"stages": [
{
"name": "Source",
"actions": [
{
"name": "Source",
"actionTypeId": {
"category": "Source",
"owner": "AWS",
"provider": "CodeCommit",
"version": "1"
},
"runOrder": 1,
"configuration": {
"BranchName": "master",
"PollForSourceChanges": "false",
"RepositoryName": "PythonRep"
},
"outputArtifacts": [
{
"name": "SourceArtifact"
}
],
"inputArtifacts":
}
]
},
{
"name": "Build",
"actions": [
{
"name": "Build",
"actionTypeId": {
"category": "Build",
"owner": "AWS",
"provider": "CodeBuild",
"version": "1"
},
"runOrder": 1,
"configuration": {
"ProjectName": "MultiRepBuild"
},
"outputArtifacts": [
{
"name": "Lambda" -->Here
}
],
"inputArtifacts": [
{
"name": "SourceArtifact"
}
]
}
]
}
],
"version": 1
}
}
This is creating a folder with name Lambda
rather than creating a file. The file structure is like this
---MultiBuild
|
|
-->Lambda
|
|
abcd.zip
-->SourceArti
|
|
efgh.zip
amazon-web-services aws-codepipeline aws-codebuild
amazon-web-services aws-codepipeline aws-codebuild
asked Nov 19 '18 at 8:30
PrivatePrivate
451516
451516
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
Sorry! This is an unfortunate consequence of the way CodePipeline manages artifacts. The "name" in the CodePipeline outputArtifacts field is just a logical name. CodePipeline was designed so that future stages can reference artifacts created in past stages with that name. These artifacts are stored in the bucket you specify in your pipeline, but I don't think it's really expected for you to use these objects in your deployment configuration.
If you're building a ZIP file which you want to deploy to a Lambda function, you can create a second stage in your pipeline which deploys to the Lambda function you have: https://docs.aws.amazon.com/lambda/latest/dg/build-pipeline.html
If you just need your ZIP file to be in a predictable place (eg., s3://testxxxthe-codebuild/Lambda.zip
) for some other process you've created, we have heard your use case from several customers and are thinking of ways to make this experience better. In the mean time, you might find the following forum post useful: https://forums.aws.amazon.com/thread.jspa?threadID=228984
Thanks @Matthew. Actually i resolved this problem by zipping all my lambda contents in my lambda folder using build command(i.e.zip foldername
)and i usedaws s3 cp ..
command to keep the zipped folder inS3
bucket.
– Private
Dec 17 '18 at 4:51
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53370873%2fcodepipeline-restricting-artifact-properties-in-codebuild%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
Sorry! This is an unfortunate consequence of the way CodePipeline manages artifacts. The "name" in the CodePipeline outputArtifacts field is just a logical name. CodePipeline was designed so that future stages can reference artifacts created in past stages with that name. These artifacts are stored in the bucket you specify in your pipeline, but I don't think it's really expected for you to use these objects in your deployment configuration.
If you're building a ZIP file which you want to deploy to a Lambda function, you can create a second stage in your pipeline which deploys to the Lambda function you have: https://docs.aws.amazon.com/lambda/latest/dg/build-pipeline.html
If you just need your ZIP file to be in a predictable place (eg., s3://testxxxthe-codebuild/Lambda.zip
) for some other process you've created, we have heard your use case from several customers and are thinking of ways to make this experience better. In the mean time, you might find the following forum post useful: https://forums.aws.amazon.com/thread.jspa?threadID=228984
Thanks @Matthew. Actually i resolved this problem by zipping all my lambda contents in my lambda folder using build command(i.e.zip foldername
)and i usedaws s3 cp ..
command to keep the zipped folder inS3
bucket.
– Private
Dec 17 '18 at 4:51
add a comment |
Sorry! This is an unfortunate consequence of the way CodePipeline manages artifacts. The "name" in the CodePipeline outputArtifacts field is just a logical name. CodePipeline was designed so that future stages can reference artifacts created in past stages with that name. These artifacts are stored in the bucket you specify in your pipeline, but I don't think it's really expected for you to use these objects in your deployment configuration.
If you're building a ZIP file which you want to deploy to a Lambda function, you can create a second stage in your pipeline which deploys to the Lambda function you have: https://docs.aws.amazon.com/lambda/latest/dg/build-pipeline.html
If you just need your ZIP file to be in a predictable place (eg., s3://testxxxthe-codebuild/Lambda.zip
) for some other process you've created, we have heard your use case from several customers and are thinking of ways to make this experience better. In the mean time, you might find the following forum post useful: https://forums.aws.amazon.com/thread.jspa?threadID=228984
Thanks @Matthew. Actually i resolved this problem by zipping all my lambda contents in my lambda folder using build command(i.e.zip foldername
)and i usedaws s3 cp ..
command to keep the zipped folder inS3
bucket.
– Private
Dec 17 '18 at 4:51
add a comment |
Sorry! This is an unfortunate consequence of the way CodePipeline manages artifacts. The "name" in the CodePipeline outputArtifacts field is just a logical name. CodePipeline was designed so that future stages can reference artifacts created in past stages with that name. These artifacts are stored in the bucket you specify in your pipeline, but I don't think it's really expected for you to use these objects in your deployment configuration.
If you're building a ZIP file which you want to deploy to a Lambda function, you can create a second stage in your pipeline which deploys to the Lambda function you have: https://docs.aws.amazon.com/lambda/latest/dg/build-pipeline.html
If you just need your ZIP file to be in a predictable place (eg., s3://testxxxthe-codebuild/Lambda.zip
) for some other process you've created, we have heard your use case from several customers and are thinking of ways to make this experience better. In the mean time, you might find the following forum post useful: https://forums.aws.amazon.com/thread.jspa?threadID=228984
Sorry! This is an unfortunate consequence of the way CodePipeline manages artifacts. The "name" in the CodePipeline outputArtifacts field is just a logical name. CodePipeline was designed so that future stages can reference artifacts created in past stages with that name. These artifacts are stored in the bucket you specify in your pipeline, but I don't think it's really expected for you to use these objects in your deployment configuration.
If you're building a ZIP file which you want to deploy to a Lambda function, you can create a second stage in your pipeline which deploys to the Lambda function you have: https://docs.aws.amazon.com/lambda/latest/dg/build-pipeline.html
If you just need your ZIP file to be in a predictable place (eg., s3://testxxxthe-codebuild/Lambda.zip
) for some other process you've created, we have heard your use case from several customers and are thinking of ways to make this experience better. In the mean time, you might find the following forum post useful: https://forums.aws.amazon.com/thread.jspa?threadID=228984
answered Nov 29 '18 at 19:54
Matthew SainsburyMatthew Sainsbury
84421237
84421237
Thanks @Matthew. Actually i resolved this problem by zipping all my lambda contents in my lambda folder using build command(i.e.zip foldername
)and i usedaws s3 cp ..
command to keep the zipped folder inS3
bucket.
– Private
Dec 17 '18 at 4:51
add a comment |
Thanks @Matthew. Actually i resolved this problem by zipping all my lambda contents in my lambda folder using build command(i.e.zip foldername
)and i usedaws s3 cp ..
command to keep the zipped folder inS3
bucket.
– Private
Dec 17 '18 at 4:51
Thanks @Matthew. Actually i resolved this problem by zipping all my lambda contents in my lambda folder using build command(i.e.
zip foldername
)and i used aws s3 cp ..
command to keep the zipped folder in S3
bucket.– Private
Dec 17 '18 at 4:51
Thanks @Matthew. Actually i resolved this problem by zipping all my lambda contents in my lambda folder using build command(i.e.
zip foldername
)and i used aws s3 cp ..
command to keep the zipped folder in S3
bucket.– Private
Dec 17 '18 at 4:51
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53370873%2fcodepipeline-restricting-artifact-properties-in-codebuild%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown