Skip to content

Commit

Permalink
[fix][ci] configure aws creds manually to avoid node20 issues on inco…
Browse files Browse the repository at this point in the history
…mpatible os
  • Loading branch information
siddvenk committed Sep 13, 2024
1 parent 83589bb commit e32be9f
Showing 1 changed file with 48 additions and 12 deletions.
60 changes: 48 additions & 12 deletions .github/workflows/native_jni_s3_pytorch.yml
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ jobs:
- name: Install compiler environment
run: |
yum -y update
yum -y install patch git cmake3 python3-devel java-17-amazon-corretto-devel
yum -y install patch git cmake3 python3-devel java-17-amazon-corretto-devel jq
yum -y install gcc10 gcc10-c++
ln -sf /usr/bin/gcc10-gcc /usr/bin/gcc
ln -sf /usr/bin/gcc10-cc /usr/bin/cc
Expand All @@ -102,11 +102,29 @@ jobs:
./gradlew :engines:pytorch:pytorch-native:compileJNI -Pprecxx11 -Ppt_version=$PYTORCH_VERSION
export PYTORCH_PRECXX11=true
./gradlew -Pjni -Ppt_version=$PYTORCH_VERSION :integration:test "-Dai.djl.default_engine=PyTorch"
- name: Configure Deployment AWS Credentials
uses: aws-actions/configure-aws-credentials@v2
with:
role-to-assume: arn:aws:iam::425969335547:role/djl-ci-publish-role
aws-region: us-east-2
- name: Configure AWS Credentials
run: |
oidc_token=$(curl -H "Authorization: bearer $ACTIONS_ID_TOKEN_REQUEST_TOKEN" \
"$ACTIONS_ID_TOKEN_REQUEST_URL&audience=sts.amazonaws.com" | jq -r ".value")
echo "::add-mask::$oidc_token"
read -r AWS_ACCESS_KEY_ID AWS_SECRET_ACCESS_KEY AWS_SESSION_TOKEN <<<"$(aws sts assume-role-with-web-identity \
--region "us-east-2" \
--role-arn "arn:aws:iam::425969335547:role/djl-ci-publish-role" \
--role-session-name "native-jni-s3-pytorch-jni-precxx11" \
--web-identity-token "$oidc_token" \
--query "[Credentials.AccessKeyId, Credentials.SecretAccessKey, Credentials.SessionToken]" \
--output text)"
echo "::add-mask::$AWS_ACCESS_KEY_ID"
echo "::add-mask::$AWS_SECRET_ACCESS_KEY"
echo "::add-mask::$AWS_SESSION_TOKEN"
echo "AWS_ACCESS_KEY_ID=$AWS_ACCESS_KEY_ID" >> "$GITHUB_ENV"
echo "AWS_SECRET_ACCESS_KEY=$AWS_SECRET_ACCESS_KEY" >> "$GITHUB_ENV"
echo "AWS_SESSION_TOKEN=$AWS_SESSION_TOKEN" >> "$GITHUB_ENV"
echo "$(aws sts get-caller-identity)"
- name: Copy files to S3 with the AWS CLI
run: |
PYTORCH_VERSION=${{ github.event.inputs.pt_version }}
Expand Down Expand Up @@ -234,7 +252,7 @@ jobs:
- name: Install compiler environment
run: |
yum -y update
yum -y install patch git cmake3 python3-devel java-17-amazon-corretto-devel
yum -y install patch git cmake3 python3-devel java-17-amazon-corretto-devel jq
yum -y install gcc10 gcc10-c++
ln -sf /usr/bin/gcc10-gcc /usr/bin/gcc
ln -sf /usr/bin/gcc10-cc /usr/bin/cc
Expand All @@ -252,11 +270,29 @@ jobs:
echo $PYTORCH_VERSION
./gradlew :engines:pytorch:pytorch-native:compileJNI -Pprecxx11 -Ppt_version=$PYTORCH_VERSION
./gradlew -Pjni -Ppt_version=$PYTORCH_VERSION :integration:test "-Dai.djl.default_engine=PyTorch"
- name: Configure Deployment AWS Credentials
uses: aws-actions/configure-aws-credentials@v2
with:
role-to-assume: arn:aws:iam::425969335547:role/djl-ci-publish-role
aws-region: us-east-2
- name: Configure AWS Credentials
run: |
oidc_token=$(curl -H "Authorization: bearer $ACTIONS_ID_TOKEN_REQUEST_TOKEN" \
"$ACTIONS_ID_TOKEN_REQUEST_URL&audience=sts.amazonaws.com" | jq -r ".value")
echo "::add-mask::$oidc_token"
read -r AWS_ACCESS_KEY_ID AWS_SECRET_ACCESS_KEY AWS_SESSION_TOKEN <<<"$(aws sts assume-role-with-web-identity \
--region "us-east-2" \
--role-arn "arn:aws:iam::425969335547:role/djl-ci-publish-role" \
--role-session-name "native-jni-s3-pytorch-jni-aarch64" \
--web-identity-token "$oidc_token" \
--query "[Credentials.AccessKeyId, Credentials.SecretAccessKey, Credentials.SessionToken]" \
--output text)"
echo "::add-mask::$AWS_ACCESS_KEY_ID"
echo "::add-mask::$AWS_SECRET_ACCESS_KEY"
echo "::add-mask::$AWS_SESSION_TOKEN"
echo "AWS_ACCESS_KEY_ID=$AWS_ACCESS_KEY_ID" >> "$GITHUB_ENV"
echo "AWS_SECRET_ACCESS_KEY=$AWS_SECRET_ACCESS_KEY" >> "$GITHUB_ENV"
echo "AWS_SESSION_TOKEN=$AWS_SESSION_TOKEN" >> "$GITHUB_ENV"
echo "$(aws sts get-caller-identity)"
- name: Copy files to S3 with the AWS CLI
run: |
PYTORCH_VERSION=${{ github.event.inputs.pt_version }}
Expand Down

0 comments on commit e32be9f

Please sign in to comment.