我正在尝试设置我的项目以部署 go 应用程序。当我尝试将 sed 与从作业传入的参数一起使用时 - 它工作正常当我尝试将 sed 与从作业传入的参数一起使用时,该参数被引用为上下文变量,它不起作用。看这个例子
version: 2.1
jobs:
deploy-application:
docker:
- image: circleci/golang:1.13
environment:
GO111MODULE: "on"
working_directory: /go/src/github.com/me/go-circle-elasticbeanstalk
parameters:
ebAppName:
description: "The name to set the elastic beanstalk application to"
default: "null"
type: string
elkHost:
description: "The host to send logs to for elastic search"
default: "null"
type: string
steps:
- run: sudo apt-get -y -qq update
- run: sudo apt-get install python-pip python-dev build-essential
- run: sudo pip install awsebcli --upgrade
- checkout
- run: sed -i 's/MY-FLIGHTS-APP-PLACEHOLDER/<< parameters.ebAppName >>/g' .elasticbeanstalk/config.yml
- run: sed -i 's/FILEBEAT-HOST-PLACEHOLDER/<< parameters.elkHost >>/g' .ebextensions/01_filebeat.config
- run: ls -latr
- run: go env
- run: export GO111MODULE=on
- run: go env
- run: go build ./...
- run: go build -o application server.go
- run: ls -latr
- run: ls -latr .elasticbeanstalk
- run: zip my-server.zip application -r .ebextensions damien.test
- run: ls -latr
- run: eb deploy
workflows:
deploy-go-server:
jobs:
- deploy-application:
name: deploy-dev
ebAppName: my-flights-dev
elkHost: $ELK_HOST
filters:
branches:
only: develop
context: my-dev
- deploy-application:
name: deploy-stage
ebAppName: my-flights
elkHost: $ELK_HOST
filters:
branches:
only: stage
context: my-stage
ebAppName 的值始终设置正确 但是,elkHost 的值始终显示为 $ELK_HOST 并且从不读取组织上下文值
我可以在这里做些什么来解决这个问题有什么帮助吗?我已经在另一个项目中使用了这种方法并且效果很好
任何帮助表示赞赏
干杯达米安