Add deploy to AKS (#212) #14
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
name: Deploy Cart | |
on: | |
workflow_dispatch: | |
inputs: { } | |
push: | |
branches: | |
- Azure | |
paths: | |
- 'apps/acme-cart/**' | |
env: | |
SPRING_APPS_SERVICE: ${{ secrets.SPRING_APPS_SERVICE }} | |
RESOURCE_GROUP: ${{ secrets.RESOURCE_GROUP }} | |
KEY_VAULT: ${{ secrets.KEY_VAULT }} | |
CUSTOM_BUILDER: no-bindings-builder | |
CART_SERVICE_APP: cart-service | |
permissions: | |
id-token: write | |
contents: read | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
python-version: ["3.11"] | |
defaults: | |
run: | |
working-directory: apps/acme-cart | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install flake8 pytest | |
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi | |
# TODO: no tests | |
# - name: Test with pytest | |
# run: | | |
# pytest | |
- name: Set up Azure | |
uses: azure/login@v1 | |
with: | |
client-id: ${{ secrets.AZURE_CLIENT_ID }} | |
tenant-id: ${{ secrets.AZURE_TENANT_ID }} | |
subscription-id: ${{ secrets.SUBSCRIPTION }} | |
- name: Set up Azure Spring Extension | |
run: az extension add --name spring | |
- name: Deploy Cart | |
run: | | |
keyvault_uri=$(az keyvault show \ | |
--resource-group ${RESOURCE_GROUP} \ | |
--name ${KEY_VAULT} \ | |
--query properties.vaultUri -o tsv) | |
gateway_url=$(az spring gateway show \ | |
--resource-group ${RESOURCE_GROUP} \ | |
--service ${SPRING_APPS_SERVICE} \ | |
--query properties.url -o tsv) | |
az spring app deploy \ | |
--name ${CART_SERVICE_APP} \ | |
--resource-group ${RESOURCE_GROUP} \ | |
--service ${SPRING_APPS_SERVICE} \ | |
--builder ${CUSTOM_BUILDER} \ | |
--env "AUTH_URL=https://${gateway_url}" "CART_PORT=8080" "KEYVAULT_URI=${keyvault_uri}" \ | |
--source-path ./ |