Skip to content

Conversation

@nailo2c
Copy link
Contributor

@nailo2c nailo2c commented Jul 24, 2025

Closes: #53626

Why

There is a typo in the variable.

{{"expirationTimestamp": "%s","token": "%s"}}}}' "$expiration_timestamp" "$token")

How

Change it to timestamp.

What

cat <<EOF > get_token.py
output=\$(cat output.txt)

status=\$?

if [ "\$status" -ne 0 ]; then
    printf '%s' "\$output" >&2
    exit "\$status"
fi

# Use pure bash below to parse so that it's posix compliant
last_line=\${output##*$'\n'}  # strip everything up to the last newline

timestamp=\${last_line#expirationTimestamp: }  # drop the label
timestamp=\${timestamp%%,*}  # keep up to the first comma

token=\${last_line##*, token: }  # text after ", token: "

json_string=\$(printf '{"kind": "ExecCredential","apiVersion":                 "client.authentication.k8s.io/v1alpha1","spec": {},"status":                 {"expirationTimestamp": "%s","token": "%s"}}' "\$expiration_timestamp" "\$token")
echo \$json_string
EOF

Then we can see the expirationTimestamp is back.

root@c30540d9dba1:/opt/airflow# bash get_token.py 
{"kind": "ExecCredential","apiVersion": "client.authentication.k8s.io/v1alpha1","spec": {},"status": {"expirationTimestamp": "2025-07-22T08:47:47Z","token": "foo"}}

@boring-cyborg boring-cyborg bot added area:providers provider:amazon AWS/Amazon - related issues labels Jul 24, 2025
@eladkal eladkal requested a review from vincbeck July 25, 2025 15:16
@vincbeck vincbeck merged commit 8881579 into apache:main Jul 25, 2025
77 checks passed
@peloyeje
Copy link
Contributor

Thank you!

@nailo2c
Copy link
Contributor Author

nailo2c commented Jul 25, 2025

My pleasure 😁

@nailo2c nailo2c deleted the bug-53626_fix_empty_expirationTimestamp branch July 25, 2025 18:12
ferruzzi pushed a commit to aws-mwaa/upstream-to-airflow that referenced this pull request Aug 7, 2025
fweilun pushed a commit to fweilun/airflow that referenced this pull request Aug 11, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:providers provider:amazon AWS/Amazon - related issues

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Empty expirationTimestamp after parsing output of eks_get_token.py

3 participants