-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
build and push helm charts in actions
- Loading branch information
Showing
4 changed files
with
83 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -30,44 +30,38 @@ jobs: | |
echo "sha_short=$(git rev-parse --short ${{ github.sha }})" >> $GITHUB_OUTPUT | ||
build-push: | ||
name: Build and Push Images | ||
name: Build and Push Images and Charts | ||
needs: [compute-sha] | ||
uses: ./.github/workflows/cd.yaml | ||
with: | ||
tag: ${{ needs.compute-sha.outputs.sha_short }} | ||
image_tag: ${{ needs.compute-sha.outputs.sha_short }} | ||
chart_ver: 0.1.0-dev.${{ needs.compute-sha.outputs.sha_short }} | ||
secrets: inherit | ||
|
||
deploy: | ||
name: Deploy with SSH | ||
name: SSH and Deploy | ||
needs: [compute-sha, build-push] | ||
runs-on: ubuntu-latest | ||
environment: development | ||
|
||
steps: | ||
- name: SSH and Helm Install | ||
uses: appleboy/[email protected] | ||
with: | ||
host: ${{ secrets.SSH_HOST }} | ||
username: root | ||
key: ${{ secrets.SSH_KEY }} | ||
script: | | ||
set -e # Exit immediately if a command fails | ||
cd ./infra | ||
uses: ./.github/workflows/deploy.yaml | ||
with: | ||
environment: development | ||
script: | | ||
set -e # Exit immediately if a command fails | ||
cd ./infra | ||
# Uninstall the old helm chart if it exists | ||
helm uninstall bt-dev-app-${{ needs.compute-sha.outputs.sha_short }} || true | ||
# Uninstall the old helm chart if it exists | ||
helm uninstall bt-dev-app-${{ needs.compute-sha.outputs.sha_short }} || true | ||
# Install new chart | ||
helm install bt-dev-app-${{ needs.compute-sha.outputs.sha_short }} ./app --namespace=bt \ | ||
--set env=dev \ | ||
--set ttl=${{ inputs.ttl }} \ | ||
--set-string frontend.image.tag=${{ needs.compute-sha.outputs.sha_short }} \ | ||
--set-string backend.image.tag=${{ needs.compute-sha.outputs.sha_short }} \ | ||
--set host=${{ needs.compute-sha.outputs.sha_short }}.stanfurdtime.com \ | ||
--set mongoUri=mongodb://bt-dev-mongo-mongodb.bt.svc.cluster.local:27017/bt \ | ||
--set redisUri=redis://bt-dev-redis-master.bt.svc.cluster.local:6379 \ | ||
--set nodeEnv=development | ||
# Install new chart | ||
helm install bt-dev-app-${{ needs.compute-sha.outputs.sha_short }} ./app --namespace=bt \ | ||
--set env=dev \ | ||
--set ttl=${{ inputs.ttl }} \ | ||
--set-string frontend.image.tag=${{ needs.compute-sha.outputs.sha_short }} \ | ||
--set-string backend.image.tag=${{ needs.compute-sha.outputs.sha_short }} \ | ||
--set host=${{ needs.compute-sha.outputs.sha_short }}.dev.stanfurdtime.com \ | ||
--set mongoUri=mongodb://bt-dev-mongo-mongodb.bt.svc.cluster.local:27017/bt \ | ||
--set redisUri=redis://bt-dev-redis-master.bt.svc.cluster.local:6379 \ | ||
--set nodeEnv=development | ||
# Check container status | ||
kubectl rollout status --timeout=180s deployment bt-dev-app-${{ needs.compute-sha.outputs.sha_short }}-backend | ||
kubectl rollout status --timeout=180s deployment bt-dev-app-${{ needs.compute-sha.outputs.sha_short }}-frontend | ||
# Check container status | ||
kubectl rollout status --timeout=180s deployment bt-dev-app-${{ needs.compute-sha.outputs.sha_short }}-backend | ||
kubectl rollout status --timeout=180s deployment bt-dev-app-${{ needs.compute-sha.outputs.sha_short }}-frontend |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
name: SSH and Deploy | ||
|
||
on: | ||
workflow_call: | ||
inputs: | ||
environment: | ||
description: "Github action environment to deploy within" | ||
required: true | ||
type: string | ||
script: | ||
description: "Script to run on remote server" | ||
required: true | ||
type: string | ||
|
||
jobs: | ||
deploy: | ||
name: SSH and Deploy | ||
runs-on: ubuntu-latest | ||
environment: ${{ inputs.environment }} | ||
|
||
steps: | ||
- name: SSH and Helm Install | ||
uses: appleboy/[email protected] | ||
with: | ||
host: ${{ secrets.SSH_HOST }} | ||
username: ${{ secrets.SSH_USERNAME }} | ||
key: ${{ secrets.SSH_KEY }} | ||
script: ${{ inputs.script }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,3 +11,4 @@ spec: | |
dnsNames: | ||
- stanfurdtime.com | ||
- "*.stanfurdtime.com" | ||
- "*.dev.stanfurdtime.com" |