Skip to content

Deploy CTF services on Azure Kubernetes Service #8

Deploy CTF services on Azure Kubernetes Service

Deploy CTF services on Azure Kubernetes Service #8

Workflow file for this run

name: Deploy CTF services on Azure Kubernetes Service
on:
workflow_dispatch:
inputs:
ENVIRONMENT:
default: ctf
description: The name of the GitHub environment to use (https://docs.github.com/en/actions/deployment/targeting-different-environments/using-environments-for-deployment#about-environments)
type: environment
workflow_call:
inputs:
ENVIRONMENT:
default: ctf
description: The name of the GitHub environment to use (https://docs.github.com/en/actions/deployment/targeting-different-environments/using-environments-for-deployment#about-environments)
type: string
secrets:
AZURE_CLIENT_ID:
required: true
AZURE_TENANT_ID:
required: true
AZURE_SUBSCRIPTION_ID:
required: true
permissions:
id-token: write # Required for requesting the JWT
contents: read
jobs:
deploy:
name: Deploy CTF services
runs-on: ubuntu-latest
environment: ${{ inputs.ENVIRONMENT }}
steps:
- name: Run az login
uses: azure/login@v1
with:
client-id: ${{ vars.AZURE_CLIENT_ID }}
tenant-id: ${{ vars.AZURE_TENANT_ID }}
subscription-id: ${{ vars.AZURE_SUBSCRIPTION_ID }}
- name: Checkout
uses: actions/checkout@v4
- name: Install kubectl
uses: azure/setup-kubectl@v3
with:
version: 'v1.29.1'
- name: Install helm
uses: azure/setup-helm@v3
with:
version: 'v3.14.0'
- name: Install go
uses: actions/setup-go@v5
- name: Install envsubst
run: |
go install github.com/a8m/envsubst/cmd/[email protected]
- name: Create the Kubernetes cluster in AKS
run: |
./manage-azure-deployment.sh new
- name: Deploy the CTF services
run: |
./manage-multijuicer.sh up
- name: Run post-deployment configuration tasks
run: |
./manage-azure-deployment.sh config
import-challenges:
name: Import challenges to CTFd
runs-on: ubuntu-latest
environment: ${{ inputs.ENVIRONMENT }}
needs: [deploy]
steps:
- name: Install kubectl
uses: azure/setup-kubectl@v3
with:
version: 'v1.29.1'
- name: Install node
uses: actions/setup-node@v4
with:
node-version: 20
- name: Install juice-shop-ctf-cli
run: npm install -g juice-shop-ctf-cli
- name: Generate challenges
run: |
./generate-challenges.sh
- name: Upload CTFd challenges file as an artifact
uses: actions/upload-artifact@v4
with:
name: ctfd-challenges.csv
path: ctfd-challenges-*.csv
retention-days: 7