我一直在尝试弄清楚如何配置Concourse的docker版本(https://github.com/concourse/concourse-docker)以使用AWS Secrets Manager,并且我在docker-compose文件中添加了以下环境变量,但是从日志看来它从未达到向AWS索取信用。我是否缺少某些东西,或者在docker-compose文件中的环境中添加这些环境变量时会自动发生这种情况?这是我一直在看的文档https://concourse-ci.org/aws-asm-credential-manager.html
version: '3'
services:
concourse-db:
image: postgres
environment:
POSTGRES_DB: concourse
POSTGRES_PASSWORD: concourse_pass
POSTGRES_USER: concourse_user
PGDATA: /database
concourse:
image: concourse/concourse
command: quickstart
privileged: true
depends_on: [concourse-db]
ports: ["9090:8080"]
environment:
CONCOURSE_POSTGRES_HOST: concourse-db
CONCOURSE_POSTGRES_USER: concourse_user
CONCOURSE_POSTGRES_PASSWORD: concourse_pass
CONCOURSE_POSTGRES_DATABASE: concourse
CONCOURSE_EXTERNAL_URL: http://XXX.XXX.XXX.XXX:9090
CONCOURSE_ADD_LOCAL_USER: test: test
CONCOURSE_MAIN_TEAM_LOCAL_USER: test
CONCOURSE_WORKER_BAGGAGECLAIM_DRIVER: overlay
CONCOURSE_AWS_SECRETSMANAGER_REGION: us-east-1
CONCOURSE_AWS_SECRETSMANAGER_ACCESS_KEY: <XXXX>
CONCOURSE_AWS_SECRETSMANAGER_SECRET_KEY: <XXXX>
CONCOURSE_AWS_SECRETSMANAGER_TEAM_SECRET_TEMPLATE: /concourse/{{.Secret}}
CONCOURSE_AWS_SECRETSMANAGER_PIPELINE_SECRET_TEMPLATE: /concourse/{{.Secret}}
pipeline.yml
示例:jobs:
- name: build-ui
plan:
- get: web-ui
trigger: true
- get: resource-ui
- task: build-task
file: web-ui/ci/build/task.yml
- put: resource-ui
params:
repository: updated-ui
force: true
- task: e2e-task
file: web-ui/ci/e2e/task.yml
params:
UI_USERNAME: ((ui-username))
UI_PASSWORD: ((ui-password))
resources:
- name: cf
type: cf-cli-resource
source:
api: https://api.run.pivotal.io
username: ((cf-username))
password: ((cf-password))
org: Blah
- name: web-ui
type: git
source:
uri: [email protected]:blah/blah.git
branch: master
private_key: ((git-private-key))
最佳答案
在AWS Secrets Manager中存储用于 session 管道的参数时,它必须遵循以下语法,
/concourse/TEAM_NAME/PIPELINE_NAME/PARAMETER_NAME`
如果您有在多个管道中的整个团队中使用的通用参数,请使用此语法避免在Secrets Manager中创建冗余参数。
/concourse/TEAM_NAME/PARAMETER_NAME
支持的最高级别是大厅团队级别。
全局参数是不可能的。因此,将不支持您的撰写环境中的这些变量。
CONCOURSE_AWS_SECRETSMANAGER_TEAM_SECRET_TEMPLATE: /concourse/{{.Secret}}
CONCOURSE_AWS_SECRETSMANAGER_PIPELINE_SECRET_TEMPLATE: /concourse/{{.Secret}}
除非您想更改前缀
/concourse
,否则这些参数应保留为其默认值。而且,在管道中检索这些参数时,无需在模板中进行任何更改。只需传递
PARAMETER_NAME
,concourse将根据团队和管道名称来处理 secret 管理器中的查找。...
params:
UI_USERNAME: ((ui-username))
UI_PASSWORD: ((ui-password))
...
关于amazon-web-services - 配置Concourse CI以使用AWS Secrets Manager,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/61208468/