From dcbc1b102887fbf8b8a5247d557a67d431d2a185 Mon Sep 17 00:00:00 2001 From: Chuck Daniels <chuck@developmentseed.org> Date: Fri, 28 Mar 2025 19:03:40 -0400 Subject: [PATCH] Get Earthdata Login creds from secrets --- build.sh | 5 +++++ run.sh | 21 +++++++++++++++++---- 2 files changed, 22 insertions(+), 4 deletions(-) create mode 100644 build.sh diff --git a/build.sh b/build.sh new file mode 100644 index 0000000..e25c16e --- /dev/null +++ b/build.sh @@ -0,0 +1,5 @@ +#!/bin/bash +set -euo pipefail + +# Install maap-py so we can use MAAP Secrets in run.sh +conda run --no-capture-output --name mytobac python -m pip install maap-py diff --git a/run.sh b/run.sh index 4c5480d..c252ddd 100644 --- a/run.sh +++ b/run.sh @@ -1,9 +1,22 @@ #!/bin/bash -basedir=$( cd "$(dirname "$0")" ; pwd -P) +readarray -d " " -t credentials <<<"$( + python -c ' +from maap.maap import MAAP +maap = MAAP() +username = maap.secrets.get_secret("EARTHDATA_USERNAME") +password = maap.secrets.get_secret("EARTHDATA_PASSWORD") +print(username, password) +' +)" -OUTPUTDIR="${PWD}/output" +EARTHDATA_USERNAME=$(echo -e "${credentials[0]}" | tr -d '[:space:]') +EARTHDATA_PASSWORD=$(echo -e "${credentials[1]}" | tr -d '[:space:]') +export EARTHDATA_USERNAME +export EARTHDATA_PASSWORD -ANALYSIS_DATE=$1 +outputdir="${PWD}/output" -conda run --live-stream --name mytobac python /root/aos_test/src/Tracking_Paper_Plots-Lorenzo-aws.py ${ANALYSIS_DATE} \ No newline at end of file +analysis_date=$1 + +conda run --no-capture-output --name mytobac python /root/aos_test/src/Tracking_Paper_Plots-Lorenzo-aws.py "${analysis_date}" -- GitLab