Skip to content

Commit

Permalink
Fix secret injection
Browse files Browse the repository at this point in the history
  • Loading branch information
0xAurelius committed Nov 7, 2023
1 parent 5303d0f commit 1caf08f
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 31 deletions.
6 changes: 4 additions & 2 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,14 @@ jobs:
- name: Check out source repository
uses: actions/checkout@v2
- name: Setup Kustomize
uses: imranismail/setup-kustomize@v1
uses: imranismail/setup-kustomize@v2.1.0-rc
with:
kustomize-version: "4.5.4"
- name: Update secret properties with injected secrets
run: touch $GITHUB_WORKSPACE/k8s/secret.properties
- name: Kustomize
run: kustomize build k8s > /tmp/kustomized.yaml
- uses: azure/k8s-lint@v1
- uses: azure/k8s-lint@v2.0
with:
manifests: |
/tmp/kustomized.yaml
4 changes: 3 additions & 1 deletion .github/workflows/deploy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -75,11 +75,13 @@ jobs:

# k8s Deployment
- name: Setup Kustomize
uses: imranismail/setup-kustomize@v1
uses: imranismail/setup-kustomize@v2.1.0-rc
with:
kustomize-version: "4.5.4"
- name: Update deployment file with image
run: sed -i 's|<IMAGE>|'${DOCKER_IMAGE}'|' $GITHUB_WORKSPACE/k8s/base/deployment.yaml
- name: Update secret properties with injected secrets
run: envsubst < $GITHUB_WORKSPACE/k8s/secret.properties.template > $GITHUB_WORKSPACE/k8s/secret.properties
- name: Save DigitalOcean kubeconfig with short-lived credentials
run: doctl kubernetes cluster kubeconfig save --expiry-seconds 600 ${{ secrets.DIGITALOCEAN_CLUSTER_NAME }}
- name: Deploy to DigitalOcean Kubernetes
Expand Down
3 changes: 2 additions & 1 deletion k8s/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,5 @@ namespace: discord-bots

secretGenerator:
- name: discord-bots-secret
env: secret.properties
envs:
- secret.properties
27 changes: 0 additions & 27 deletions k8s/secret.properties

This file was deleted.

27 changes: 27 additions & 0 deletions k8s/secret.properties.template
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
AIRTABLE_API_KEY=${AIRTABLE_API_KEY}

DISCORD_BOT_TOKEN_BCT_PRICE=${DISCORD_BOT_TOKEN_BCT_PRICE}
DISCORD_BOT_TOKEN_KLIMA_BOND_ALERTS=${DISCORD_BOT_TOKEN_KLIMA_BOND_ALERTS}
DISCORD_BOT_TOKEN_C3_PRICE=${DISCORD_BOT_TOKEN_C3_PRICE}
DISCORD_BOT_TOKEN_KLIMA_PRICE=${DISCORD_BOT_TOKEN_KLIMA_PRICE}
DISCORD_BOT_TOKEN_MCO2_PRICE=${DISCORD_BOT_TOKEN_MCO2_PRICE}
DISCORD_BOT_TOKEN_MOSS_PRICE=${DISCORD_BOT_TOKEN_MOSS_PRICE}
DISCORD_BOT_TOKEN_NBO_PRICE=${DISCORD_BOT_TOKEN_NBO_PRICE}
DISCORD_BOT_TOKEN_NCT_PRICE=${DISCORD_BOT_TOKEN_NCT_PRICE}
DISCORD_BOT_TOKEN_REBASE=${DISCORD_BOT_TOKEN_REBASE}
DISCORD_BOT_TOKEN_STAKING_REWARDS=${DISCORD_BOT_TOKEN_STAKING_REWARDS}
DISCORD_BOT_TOKEN_SUPPLY_CC=${DISCORD_BOT_TOKEN_SUPPLY_CC}
DISCORD_BOT_TOKEN_INDEX=${DISCORD_BOT_TOKEN_INDEX}
DISCORD_BOT_TOKEN_TREASURY_CARBON=${DISCORD_BOT_TOKEN_TREASURY_CARBON}
DISCORD_BOT_TOKEN_TREASURY_MARKET=${DISCORD_BOT_TOKEN_TREASURY_MARKET}
DISCORD_BOT_TOKEN_UBO_PRICE=${DISCORD_BOT_TOKEN_UBO_PRICE}
DISCORD_BOT_TOKEN_RUNWAY=${DISCORD_BOT_TOKEN_RUNWAY}
DISCORD_BOT_TOKEN_RETIREMENT_FEE_INFO=${DISCORD_BOT_TOKEN_RETIREMENT_FEE_INFO}
DISCORD_BOT_TOKEN_DAO_FEE=${DISCORD_BOT_TOKEN_DAO_FEE}
DISCORD_BOT_TOKEN_DAO_BALANCE=${DISCORD_BOT_TOKEN_DAO_BALANCE}
DISCORD_BOT_WEBHOOK_REBASE=${DISCORD_BOT_WEBHOOK_REBASE}
DISCORD_WEBHOOK_BROKEN_BOND_ALERT=${DISCORD_WEBHOOK_BROKEN_BOND_ALERT}

POLYGONSCAN_API_KEY=${POLYGONSCAN_API_KEY}
WEB3_PROVIDER_ETH_URL=${WEB3_PROVIDER_ETH_URL}
WEB3_PROVIDER_POLYGON_URL=${WEB3_PROVIDER_POLYGON_URL}

0 comments on commit 1caf08f

Please sign in to comment.