我有一个 php 应用程序,我想使用 Jenkins 将其部署到弹性 beanstalk 环境。代码在 git 上,我希望能够使用 eb cli 命令,例如 eb use eb deploy。
所以,我不确定如何使这项工作......就像如何设置凭据以便我可以使用 Jenkins shell 运行 eb cli 命令一样。
关于如何解决这个问题的任何想法都会非常有帮助。
我的脚本目前看起来有点像这样
git fetch
git checkout "$GIT_REF"
git pull origin "$GIT_REF"
eb use "$CUSTOM_EB_ENV"
eb deploy
$GIT_REF 和 $CUSTOM_EB_ENV 是指向 git 分支和 ElasticBeanstalk 环境名称的变量。
当我运行作业时,我收到以下错误
+ git fetch
+ git checkout master
Previous HEAD position was 36f0456t... f
Switched to branch 'master'
Your branch is up-to-date with 'origin/master'.
+ git pull origin master
From github.com:something/foo_bar
* branch master -> FETCH_HEAD
Already up-to-date.
+ eb use Environment_name
ERROR: Operation Denied. The security token included in the request is invalid.
+ eb deploy
ERROR: This branch does not have a default environment. You must either specify an environment by typing "deploy my-env-name" or set a default environment by typing "eb use my-env-name".