简体   繁体   English

CodeDeploy - 如何在 CodeDeploy 脚本中添加用户输入

[英]CodeDeploy - How to add user input in CodeDeploy script

I'm trying to add a an user input in CodeDeploy script.我正在尝试在 CodeDeploy 脚本中添加用户输入。 Here is my code这是我的代码

#!/bin/bash
# start service application
read -p "Please Enter Path For Configuration File:" -r config_path
java -jar Testing-1.0-SNAPSHOT-jar-with-dependencies.jar ${config_path} > /dev/null 2> /dev/null < /dev/null &

I'm using the > /dev/null 2> /dev/null < /dev/null & because it's a long-running process, and I want CodeDeploy to continue after the process starts.我正在使用 > /dev/null 2> /dev/null < /dev/null & 因为它是一个长时间运行的进程,我希望 CodeDeploy 在进程启动后继续。 But right now, it doesn't ask me to enter the path for config file, nor show any error.但是现在,它并没有要求我输入配置文件的路径,也没有显示任何错误。 Any help is much appreciated.任何帮助深表感谢。

Unfortunately this is not functionality that is supported within the CodeDeploy hook scripts.不幸的是,这不是 CodeDeploy 挂钩脚本中支持的功能。

The only arguments that are passed into the script are the environment variables that CodeDeploy has published, these are below:传递到脚本中的唯一 arguments 是 CodeDeploy 发布的环境变量,如下所示:

  • LIFECYCLE_EVENT : This variable contains the name of the lifecycle event associated with the script. LIFECYCLE_EVENT :此变量包含与脚本关联的生命周期事件的名称。
  • DEPLOYMENT_ID : This variables contains the deployment ID of the current deployment. DEPLOYMENT_ID :此变量包含当前部署的部署 ID。
  • APPLICATION_NAME : This variable contains the name of the application being deployed. APPLICATION_NAME :此变量包含正在部署的应用程序的名称。 This is the name the user sets in the console or AWS CLI.这是用户在控制台或 AWS CLI 中设置的名称。
  • DEPLOYMENT_GROUP_NAME : This variable contains the name of the deployment group. DEPLOYMENT_GROUP_NAME :此变量包含部署组的名称。 A deployment group is a set of instances associated with an application that you target for a deployment.部署组是与您的部署目标应用程序相关联的一组实例。
  • DEPLOYMENT_GROUP_ID : This variable contains the ID of the deployment group in AWS CodeDeploy that corresponds to the current deployment DEPLOYMENT_GROUP_ID :此变量包含 AWS CodeDeploy 中与当前部署对应的部署组的 ID

You might be able to use one of these to control the logic you're trying to determine.您也许可以使用其中之一来控制您尝试确定的逻辑。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM