Skip to content

Commit 8928890

Browse files
committed
fix k8s auth errors in CI
1 parent c1cbfc8 commit 8928890

File tree

2 files changed

+48
-6
lines changed

2 files changed

+48
-6
lines changed

.github/workflows/nightly_release_testing.yaml

+1
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ jobs:
3030
DEN_TESTER_SSH_PRIVATE_KEY: ${{ secrets.DEN_TESTER_SSH_PRIVATE_KEY }}
3131
DEN_TESTER_SSH_PUBLIC_KEY: ${{ secrets.DEN_TESTER_SSH_PUBLIC_KEY }}
3232
API_SERVER_URL: ${{ env.API_SERVER_URL }}
33+
EKS_ARN: ${{ secrets.EKS_ARN }}
3334

3435
- name: Run not cluster tests
3536
env:

.github/workflows/setup_release_testing/action.yaml

+47-6
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,10 @@ inputs:
3535
API_SERVER_URL:
3636
description: 'API Server URL'
3737
required: true
38+
EKS_ARN:
39+
description: 'EKS ARN'
40+
required: true
41+
3842

3943
runs:
4044
using: composite
@@ -47,22 +51,59 @@ runs:
4751
- name: Check out repository code
4852
uses: actions/checkout@v3
4953

54+
- name: Install AWS CLI v2
55+
run: |
56+
curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip"
57+
unzip awscliv2.zip
58+
sudo ./aws/install --update
59+
aws --version
60+
shell: bash
61+
62+
63+
- name: Configure & Authenticate to AWS
64+
run: |
65+
if [[ -z "${{ inputs.DEV_AWS_ACCESS_KEY }}" || -z "${{ inputs.DEV_AWS_SECRET_KEY }}" ]]; then
66+
echo "Error: AWS credentials not provided!"
67+
exit 1
68+
fi
69+
70+
mkdir -p ~/.aws
71+
72+
# Store credentials in ~/.aws/credentials (preferred method)
73+
cat <<EOF > ~/.aws/credentials
74+
[default]
75+
aws_access_key_id=${{ inputs.DEV_AWS_ACCESS_KEY }}
76+
aws_secret_access_key=${{ inputs.DEV_AWS_SECRET_KEY }}
77+
region=us-east-1
78+
EOF
79+
80+
# Set up AWS CLI to use the correct profile
81+
aws configure set default.region us-east-1
82+
83+
# Verify credentials
84+
aws sts get-caller-identity
85+
shell: bash
86+
87+
5088
- name: Setup Kubeconfig
5189
run: |
5290
mkdir -p $HOME/.kube
5391
echo "${{ inputs.KUBECONFIG }}" > $HOME/.kube/config
5492
export KUBECONFIG=$HOME/.kube/config
93+
94+
aws sts get-caller-identity
95+
96+
# Ensure kubeconfig is updated with correct IAM role
97+
aws eks update-kubeconfig --name runhouse-k8s --region us-east-1
98+
aws eks list-clusters
99+
55100
kubectl config view
101+
kubectl config get-contexts
102+
56103
sudo apt-get update
57104
sudo apt-get install -y socat netcat-openbsd
58105
shell: bash
59106

60-
- name: Configure & Authenticate to AWS
61-
run: |
62-
aws configure set aws_access_key_id ${{ inputs.DEV_AWS_ACCESS_KEY }}
63-
aws configure set aws_secret_access_key ${{ inputs.DEV_AWS_SECRET_KEY }}
64-
aws configure set default.region us-east-1
65-
shell: bash
66107

67108
- name: Authenticate to Google Cloud
68109
uses: google-github-actions/auth@v1

0 commit comments

Comments
 (0)