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

posta 2 anni fa304 visualizzazioni
1 Risposta
1
Risposta accettata

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
ESPERTO
Greg_B
con risposta 2 anni fa
profile picture
ESPERTO
verificato un mese fa

Accesso non effettuato. Accedi per postare una risposta.

Una buona risposta soddisfa chiaramente la domanda, fornisce un feedback costruttivo e incoraggia la crescita professionale del richiedente.

Linee guida per rispondere alle domande