-
Notifications
You must be signed in to change notification settings - Fork 4k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
commit_message causes an incorrect environment variable #8458
Comments
Hey @MisterBianco , thanks for opening the issue. When trying your example, I get the following template when I run
That seems correct to me... I don't see why You said:
Can you elaborate on that? Do you mean that Thanks, |
My cdk.out shows "EnvironmentVariables": "[{\"name\":\"AUTHOR_DATE\",\"type\":\"PLAINTEXT\",\"value\":\"#{SourceVariables.AuthorDate}\"},{\"name\":\"BRANCH_NAME\",\"type\":\"PLAINTEXT\",\"value\":\"#{SourceVariables.BranchName}\"},{\"name\":\"COMMIT_ID\",\"type\":\"PLAINTEXT\",\"value\":\"#{SourceVariables.CommitId}\"},{\"name\":\"COMMIT_MESSAGE\",\"type\":\"PLAINTEXT\",\"value\":\"#{SourceVariables.CommitMessage}\"},{\"name\":\"COMMITTER_DATE\",\"type\":\"PLAINTEXT\",\"value\":\"#{SourceVariables.CommitterDate}\"},{\"name\":\"COMMIT_URL\",\"type\":\"PLAINTEXT\",\"value\":\"#{SourceVariables.CommitUrl}\"},{\"name\":\"REPOSITORY_NAME\",\"type\":\"PLAINTEXT\",\"value\":\"#{SourceVariables.RepositoryName}\"}]" The deploy functions perfectly, greens across the terminal. The only issue is when I go to CodePipeline and try to click on the details of the build action and it wont enter the build details. The following image is what I get. |
Can you show me the commit message that goes out of the source action and into the build action, that causes this? |
I would love to, what do I need to do to retrieve that information. I am very new to codepipelines... And the cdk |
Just look at the source action that feeds the build action - there should be the commit message there (and a direct link to the commit). |
The commit message is:
|
I wonder whether there's some character(s) in the message that make CodePipeline choke on it. Can you try a simple experiment for me? Can you try committing and pushing an empty commit with a very simple
and see if you get the same error in the CodeBuild Action? (Make sure the deployed version of the CodePipeline is the one that has this error, so with the line Thanks, |
It succeeded. |
OK. So this is a CodePipeline issue then. I'll get in contact with the team. |
Hey @MisterBianco , I've talked to the CodePipeline team, and unfortunately I don't have good news 😕 . This is a known issue - apparently the escaping for CodePipeline Variables is incorrect for some action configurations, and CodeBuild environment variables are one of those. So basically, right now, the best advice I can give is to just not use the If you pay for AWS support, you can open an issue about this, but I can't guarantee when it will be fixed from the CodePipeline side. Sorry I don't have better news for you. I'm resolving this one, please let us know if you need anything else from our side for this problem. Thanks, |
Hey @skinny85 ! Are you aware of any fix that went in for this (before I try now)? |
Hey @MisterBianco - I am not aware of any fix. I can ask if you want me to...? |
A fix for this would be great. It would really help with a current project I am working on. 👍🏼 |
This is still a problem today. |
I get this error when the commit message has a line break in it. I reworded the commit to remove the line break and then the code pipeline succeeded. |
UPDATE: This is obviously not something that is the CDKs default, but any change we can get some updates into whether this is somewhere in the CodeBuild team's backlog, and will be addressed? It could be as simple as only using the first line in the event of a multi-line commit message, or truncating it in some way? |
This issue still exists today when using CloudFormation and the most recent commit contains a slash (present in branch name) An extract of the configuration: NOT WORKING Configuration:
ProjectName: !Ref DeployApplicationToQAProject
EnvironmentVariables: >-
[
{
"name": "BRANCH_NAME",
"value": "#{SourceVariables.BranchName}",
"type": "PLAINTEXT"
},
{
"name": "COMMIT_ID",
"value": "#{SourceVariables.CommitId}",
"type": "PLAINTEXT"
},
{
"name": "COMMIT_MESSAGE",
"value": "#{SourceVariables.CommitMessage}",
"type": "PLAINTEXT"
}
]
RunOrder: 2 WORKING Configuration:
ProjectName: !Ref DeployApplicationToQAProject
EnvironmentVariables: >-
[
{
"name": "BRANCH_NAME",
"value": "#{SourceVariables.BranchName}",
"type": "PLAINTEXT"
},
{
"name": "COMMIT_ID",
"value": "#{SourceVariables.CommitId}",
"type": "PLAINTEXT"
}
]
RunOrder: 2 |
Has there been any progress on this issue? Even I have a need to utilize the CommitMessage from my Codestarconnection. However, the pipeline fails when I try to pass the CommitMessage in subsequent CodeBuild step. |
Workaround mentioned in this article:
|
While using the cdk to create a codepipeline that has a github source action I would like to pass the environment variables down to subsequent steps.
However, if the line for commit_message is not commented out then I am met with an error that says the format is wrong: should be [{name, type, value}]
EnvironmentVariables specified in action config does not match expected format, the expected format is JSON array adhering to the following format: [{"name": "string", "type": "string", "value": "string"}]
the issue is not present with any other value.
Reproduction Steps
Create a simple codepipeline with a GithubSourceAction and a codebuild action like:
The deploy command will succeed but the details for the second stage will not work with the commit_message.
Error Log
No Errors except when in the console.
EnvironmentVariables specified in action config does not match expected format, the expected format is JSON array adhering to the following format: [{"name": "string", "type": "string", "value": "string"}]
Environment
This is 🐛 Bug Report
It is equally as likely that I am just missing something wildly dumb.
I can provide cf templates at request.
The text was updated successfully, but these errors were encountered: