Skip to content

Commit 36fe6b5

Browse files
Test CI/CD pipeline without access keys
1 parent 6939371 commit 36fe6b5

File tree

2 files changed

+10
-6
lines changed

2 files changed

+10
-6
lines changed

.github/workflows/ci-cd.yml

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,9 @@ on:
88

99
jobs:
1010
build-and-test:
11-
# Run on self-hosted runner inside the VPC
12-
runs-on: [self-hosted, linux]
11+
12+
runs-on: [self-hosted, linux] # Runs inside your VPC for RDS access
13+
1314
steps:
1415
- name: Checkout code
1516
uses: actions/checkout@v3
@@ -24,7 +25,9 @@ jobs:
2425

2526
- name: Run tests
2627
env:
27-
DB_HOST: ${{ secrets.DB_HOST }} # RDS private endpoint
28+
# RDS private endpoint
29+
30+
DB_HOST: ${{ secrets.DB_HOST }}
2831
DB_USER: ${{ secrets.DB_USER }}
2932
DB_PASSWORD: ${{ secrets.DB_PASSWORD }}
3033
DB_NAME: ${{ secrets.DB_NAME }}
@@ -49,12 +52,12 @@ jobs:
4952
- name: Zip project
5053
run: zip -r function.zip .
5154

52-
- name: Configure AWS credentials
55+
- name: Configure AWS credentials via OIDC
5356
uses: aws-actions/configure-aws-credentials@v2
5457
with:
55-
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
56-
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
58+
role-to-assume: arn:aws:iam::011664843975:role/github-permissions
5759
aws-region: ${{ secrets.AWS_REGION }}
60+
role-session-name: github-actions-deploy
5861

5962
- name: Deploy Lambda with rollback
6063
id: deploy

index.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,3 +92,4 @@ exports.handler = async (event) => {
9292
body: JSON.stringify(body)
9393
};
9494
};
95+

0 commit comments

Comments
 (0)