How to set environment variable for ggv2 components

0

Hi there,

I have tried

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

but still the component cant get the variable: SECRET_ARN=os.getenv('SECRET_ARN')

質問済み 2年前304ビュー
1回答
1
承認された回答

Hi. Instead of SECRET_ARN={configuration:/secretArn} I think the Setenv syntax should be SECRET_ARN: "{configuration:/secretArn}".

Alternatively, you could pass the secret as an argument:

python3 -u {artifacts:decompressedPath}/secret_loader/main.py {configuration:/secretArn}
profile pictureAWS
エキスパート
Greg_B
回答済み 2年前
profile picture
エキスパート
レビュー済み 1ヶ月前

ログインしていません。 ログイン 回答を投稿する。

優れた回答とは、質問に明確に答え、建設的なフィードバックを提供し、質問者の専門分野におけるスキルの向上を促すものです。

質問に答えるためのガイドライン

関連するコンテンツ