Skip to content

Commit

Permalink
ci: add cicd process for aws-cdk/cdk8s
Browse files Browse the repository at this point in the history
  • Loading branch information
blacha committed Nov 7, 2023
1 parent eebecd9 commit 681ad7c
Showing 1 changed file with 38 additions and 7 deletions.
45 changes: 38 additions & 7 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ jobs:
contents: read

steps:
- uses: actions/checkout@v1
- uses: actions/checkout@v4

- name: Use Node.js 18.x
uses: actions/setup-node@v2.2.0
uses: actions/setup-node@v4
with:
node-version: '18.x'

Expand All @@ -25,13 +25,13 @@ jobs:
- name: format
run: npm run format -- --fix=false # ensure eslint is not configured to --fix

# - name: Setup kubectl
# uses: azure/setup-kubectl@v3
# with:
# version: 'latest'
- name: Setup kubectl
uses: azure/setup-kubectl@v3
with:
version: 'latest'

- name: AWS Configure
uses: aws-actions/configure-aws-credentials@v1.6.1
uses: aws-actions/configure-aws-credentials@v4
with:
aws-region: ap-southeast-2
mask-aws-account-id: true
Expand All @@ -45,6 +45,37 @@ jobs:
run: |
kubectl get nodes
# TODO It would be nice to split the AWS-CDK/CDK8s deployments into steps
# Setup the EKS cluster with AWS-CDK
- name: (CDK) Diff
if: github.ref != 'refs/heads/master'
run: |
npx cdk diff Workflows \
-c ci-role-arn=${{ secrets.AWS_CI_ROLE }} \
-c aws-account-id=${{ secrets.AWS_ACCOUNT_ID }}
- name: (CDK) Deploy
if: github.ref != 'refs/heads/master'
run: |
npx cdk deploy Workflows \
-c ci-role-arn=${{ secrets.AWS_CI_ROLE }} \
-c aws-account-id=${{ secrets.AWS_ACCOUNT_ID }}
# Configure the Kubernetes cluster with CDK8s
- name: (CDK8s) Synth
run: |
npx cdk8s synth
- name: (CDK8s) Diff
if: github.ref != 'refs/heads/master'
run: |
kubectl apply -f dist/ --dry-run=server
- name: (CDK8s) Deploy
if: github.ref == 'refs/heads/master'
run: |
kubectl apply -f dist/
# - name: Install Argo
# run: |
# curl -sLO https://github.com/argoproj/argo-workflows/releases/download/v3.4.0-rc2/argo-linux-amd64.gz
Expand Down

0 comments on commit 681ad7c

Please sign in to comment.