Skip to content

Commit

Permalink
Separate environments per app
Browse files Browse the repository at this point in the history
  • Loading branch information
fredimachado committed Sep 23, 2023
1 parent 938b60d commit 53b6a8c
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 7 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/admin-api.yml
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,8 @@ jobs:
needs: build
uses: ./.github/workflows/deploy_template.yml
with:
environment: dev
environment: admin-dev
namespace: dev
project_folder: src/Admin/NCafe.Admin.Api
secrets:
CONNECTIONSTRINGS__EVENTSTORE: ${{ secrets.CONNECTIONSTRINGS__EVENTSTORE }}
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/barista-api.yml
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,8 @@ jobs:
needs: build
uses: ./.github/workflows/deploy_template.yml
with:
environment: dev
environment: barista-dev
namespace: dev
project_folder: src/Barista/NCafe.Barista.Api
secrets:
CONNECTIONSTRINGS__EVENTSTORE: ${{ secrets.CONNECTIONSTRINGS__EVENTSTORE }}
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/cashier-api.yml
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,8 @@ jobs:
needs: build
uses: ./.github/workflows/deploy_template.yml
with:
environment: dev
environment: cashier-dev
namespace: dev
project_folder: src/Cashier/NCafe.Cashier.Api
secrets:
CONNECTIONSTRINGS__EVENTSTORE: ${{ secrets.CONNECTIONSTRINGS__EVENTSTORE }}
Expand Down
10 changes: 6 additions & 4 deletions .github/workflows/deploy_template.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ on:
environment:
required: true
type: string
namespace:
required: true
type: string
project_folder:
required: true
type: string
Expand All @@ -27,7 +30,6 @@ jobs:
environment: ${{ inputs.environment }}

env:
ENVIRONMENT: ${{ inputs.environment }}
CONNECTIONSTRINGS__EVENTSTORE: ${{ secrets.CONNECTIONSTRINGS__EVENTSTORE }}
CONNECTIONSTRINGS__RABBITMQ: ${{ secrets.CONNECTIONSTRINGS__RABBITMQ }}
NGINX_USER: ${{ secrets.NGINX_USER }}
Expand All @@ -51,11 +53,11 @@ jobs:
working-directory: ${{ inputs.project_folder }}
run: |
helmfile init --force
sed -i "s/[$]namespace[$]/${{ env.ENVIRONMENT }}/g" deploy/helmfile.yaml
sed -i "s/[$]namespace[$]/${{ inputs.namespace }}/g" deploy/helmfile.yaml
echo -e "\e[92mConfiguring kubernetes access in pipeline...\e[0m"
mkdir -p $(pwd)/.kube
echo ${{ secrets.KUBE_CONFIG }} | base64 -d > $(pwd)/.kube/config
export KUBECONFIG=$(pwd)/.kube/config
echo -e "\e[92mDeploying to ${{ env.ENVIRONMENT }} environment...\e[0m"
echo -e "\e[92mDeploying to ${{ inputs.environment }} environment...\e[0m"
cd deploy
helmfile --color -e ${{ env.ENVIRONMENT }} apply --set image.imagePullPolicy=Always
helmfile --color -e ${{ inputs.namespace }} apply --set image.imagePullPolicy=Always

0 comments on commit 53b6a8c

Please sign in to comment.