5 Deploy Web App #39
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: 5 Deploy Web App | |
on: [workflow_dispatch] | |
env: | |
CLUSTER_NAME: AKSCluster-Demo | |
AZURE_RG: oa-poc-rg | |
NAMESPACE: appconfig | |
IMAGE_NAME: oawebappconfig | |
AZURE_CONTAINER_REGISTRY: ${{ secrets.CONTAINER_REGISTRY }} | |
KUSTOMIZE_PATH: './yaml_files/' | |
TAG: 5141 | |
APP_NAME: oaappconfig | |
PREFIX: Pod2 | |
APPCONFIG_CS: ${{ secrets.APPCONFIG_CS }} | |
jobs: | |
deploy-webapp: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@master | |
# Set the target AKS cluster. | |
- uses: Azure/aks-set-context@v1 | |
with: | |
creds: '${{ secrets.AZURE_CREDENTIALS }}' | |
cluster-name: ${{ env.CLUSTER_NAME }} | |
resource-group: ${{ env.AZURE_RG }} | |
- uses: azure/[email protected] | |
- name: Set up Kustomize | |
run: |- | |
cd yaml_files | |
curl -sfLo kustomize https://github.com/kubernetes-sigs/kustomize/releases/download/v3.1.0/kustomize_3.1.0_linux_amd64 | |
chmod u+x ./kustomize | |
./kustomize --help | |
- name: Replace tokens to set variables | |
# You may pin to the exact commit or the version. | |
# uses: cschleiden/replace-tokens@8e091844c27eb36853efbfade5ffca07260f0250 | |
uses: cschleiden/[email protected] | |
with: | |
# | |
tokenPrefix: '{' | |
# | |
tokenSuffix: '}' | |
# | |
files: '["yaml_files/deploy-webapp.yaml"]' | |
env: | |
APPCONFIG_CS: ${{ env.APPCONFIG_CS }} | |
APPCONFIG_KEY: ${{ env.PREFIX }} | |
# Deploy Web App with Kustomize | |
- name: Deploy Web App | |
run: |- | |
# replacing the image name in the k8s template | |
cd yaml_files | |
./kustomize edit set image hereyourimage.azurecr.io/oawebappconfig=${{ env.AZURE_CONTAINER_REGISTRY }}/${{ env.IMAGE_NAME }}:${{ env.TAG }} | |
./kustomize build . | kubectl apply -f - |