Pass parameters from AWS lambda to AWS CodePipeline

佐手、 提交于 2020-12-13 04:16:50

问题


I have a lambda that is initiating a CodePipeline execution via the AWS SDK startPipelineExecution function. Is there any mechanism available to pass a parameter to the CodePipeline build so that it may use the value within the CodeBuild build as an environment variable?


回答1:


Currently CodePipeline does not provide any functionality for passing parameters into the Source Stage. Depending on the CodePipeline setup, I would look into one of the following:

  1. From your Lambda function, save the parameter to Amazon Systems Manager - Parameter Store and use CodeBuilds built-in approach to retrieve it during runtime. Buildspec:
    env:
      parameter-store:
        key: "value"
  1. Instead of calling the CodePipeline directly, upload a file with all your parameters to an S3 bucket. Then set S3 as Source Action Provider, so the CodePipeline is triggered when the file is updated. This way you can pass the file as artifact to your CodeBuild project and use it there.
  2. If you can redesign your flow to trigger CodeBuild directly from Lambda, it would be possible to call startBuild using the environment-variables-override flag.


来源:https://stackoverflow.com/questions/62934560/pass-parameters-from-aws-lambda-to-aws-codepipeline

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!