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')

preguntada hace 2 años304 visualizaciones
1 Respuesta
1
Respuesta aceptada

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
EXPERTO
Greg_B
respondido hace 2 años
profile picture
EXPERTO
revisado hace un mes

No has iniciado sesión. Iniciar sesión para publicar una respuesta.

Una buena respuesta responde claramente a la pregunta, proporciona comentarios constructivos y fomenta el crecimiento profesional en la persona que hace la pregunta.

Pautas para responder preguntas