如何为ggv2组件设置环境变量?

0

【以下的问题经过翻译处理】 我已经尝试运行下面这个配置文件,但是组件无法获取变量:SECRET_ARN = os.getenv('SECRET_ARN')

RecipeFormatVersion: '2020-01-25'
ComponentName: "{COMPONENT_NAME}"
ComponentVersion: "{COMPONENT_VERSION}"
ComponentDescription: ''
ComponentPublisher: "{COMPONENT_AUTHOR}"

ComponentConfiguration:
  DefaultConfiguration:
    secretArn: 'no_secret'

Manifests:
- Platform:
    os: linux
  Artifacts:
    - URI: s3://BUCKET_NAME/COMPONENT_NAME/COMPONENT_VERSION/secret_loader.zip
      Unarchive: ZIP
  Lifecycle:
    Setenv: SECRET_ARN={configuration:/secretArn}
    Install: python3 -m pip install --user -r {artifacts:decompressedPath}/secret_loader/requirements.txt
    Run: |
      export SECRET_ARN={configuration:/secretArn}
      python3 -u {artifacts:decompressedPath}/secret_loader/main.py

profile picture
EXPERT
asked 7 months ago2 views
1 Answer
0

【以下的回答经过翻译处理】 我认为应该使用 SECRET_ARN: "{configuration:/secretArn}"Setenv 语法,而不是 SECRET_ARN={configuration:/secretArn}

或者,您可以将密码作为参数传递:

python3 -u {artifacts:decompressedPath}/secret_loader/main.py {configuration:/secretArn}
profile picture
EXPERT
answered 7 months ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions