question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

commit_message causes an incorrect environment variable

See original GitHub issue

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.

self.source_variables = {
            "AUTHOR_DATE": codebuild.BuildEnvironmentVariable(value=self.source_action.variables.author_date),
            "BRANCH_NAME": codebuild.BuildEnvironmentVariable(value=self.source_action.variables.branch_name),
            "COMMIT_ID": codebuild.BuildEnvironmentVariable(value=self.source_action.variables.commit_id),
            # "COMMIT_MESSAGE": codebuild.BuildEnvironmentVariable(value=self.source_action.variables.commit_message),
            "COMMITTER_DATE": codebuild.BuildEnvironmentVariable(value=self.source_action.variables.committer_date),
            "COMMIT_URL": codebuild.BuildEnvironmentVariable(value=self.source_action.variables.commit_url),
            "REPOSITORY_NAME": codebuild.BuildEnvironmentVariable(value=self.source_action.variables.repository_name),
        }

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:

self.build_init_action = actions.CodeBuildAction(
            action_name="initialize",
            project=build_project,
            input=self.source,
            outputs=[],
            environment_variables=self.source_variables
        )

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

  • CLI Version : 1.45
  • Framework Version: 1.45
  • Node.js Version: v14.3.0
  • OS : manjaro linux and mac osx
  • Language (Version): python 3.8.3

This is 🐛 Bug Report

It is equally as likely that I am just missing something wildly dumb.

I can provide cf templates at request.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:1
  • Comments:17 (7 by maintainers)

github_iconTop GitHub Comments

2reactions
skinny85commented, Jun 16, 2020

OK. So this is a CodePipeline issue then. I’ll get in contact with the team.

2reactions
MisterBiancocommented, Jun 16, 2020

It succeeded.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Add env var to commit message - git - Stack Overflow
This will cause the message to just be " $YOUR_VAR " and not the content. Instead, use "". ex: git commit -m '$YOUR_VAR'...
Read more >
Environment variables in commit messages - Buddy.Works
ENV VARs in commits are created with the EXECUTION scope, which means they have higher priority (i.e. overwrite)8 variables with action, ...
Read more >
git-merge Documentation - Git
This option determines how the merge message will be cleaned up before committing. ... (to cause the next git commit command to create...
Read more >
Please Enter a Commit Message To Explain Why This Merge ...
The error is a way of Git to ask you for a commit message. ... You can also use a different editor by...
Read more >
Introduction to environment variables - CircleCI
the value of the environment variable is equal to one of true , True , false , or False. Secrets masking will only...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found