Merge branch 'main' into main
This commit is contained in:
@@ -34,7 +34,7 @@ jobs:
|
|||||||
matrix:
|
matrix:
|
||||||
language: [ $detected-codeql-languages ]
|
language: [ $detected-codeql-languages ]
|
||||||
# CodeQL supports [ $supported-codeql-languages ]
|
# CodeQL supports [ $supported-codeql-languages ]
|
||||||
# Learn more about CodeQL language support at https://git.io/codeql-language-support
|
# Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout repository
|
- name: Checkout repository
|
||||||
@@ -56,7 +56,7 @@ jobs:
|
|||||||
uses: github/codeql-action/autobuild@v2
|
uses: github/codeql-action/autobuild@v2
|
||||||
|
|
||||||
# ℹ️ Command-line programs to run using the OS shell.
|
# ℹ️ Command-line programs to run using the OS shell.
|
||||||
# 📚 https://git.io/JvXDl
|
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun
|
||||||
|
|
||||||
# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
|
# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
|
||||||
# and modify them (or add more) to build your code if your project
|
# and modify them (or add more) to build your code if your project
|
||||||
|
|||||||
@@ -9,17 +9,17 @@
|
|||||||
# To configure this workflow:
|
# To configure this workflow:
|
||||||
#
|
#
|
||||||
# 1. Set the following secrets in your repository (instructions for getting these
|
# 1. Set the following secrets in your repository (instructions for getting these
|
||||||
# https://github.com/Azure/login#configure-a-service-principal-with-a-federated-credential-to-use-oidc-based-authentication):
|
# https://docs.microsoft.com/en-us/azure/developer/github/connect-from-azure?tabs=azure-cli%2Clinux)):
|
||||||
# - AZURE_CLIENT_ID
|
# - AZURE_CLIENT_ID
|
||||||
# - AZURE_TENANT_ID
|
# - AZURE_TENANT_ID
|
||||||
# - AZURE_SUBSCRIPTION_ID
|
# - AZURE_SUBSCRIPTION_ID
|
||||||
#
|
#
|
||||||
# 2. Set the following environment variables (or replace the values below):
|
# 2. Set the following environment variables (or replace the values below):
|
||||||
# - AZURE_CONTAINER_REGISTRY (name of your container registry / ACR)
|
# - AZURE_CONTAINER_REGISTRY (name of your container registry / ACR)
|
||||||
|
# - CONTAINER_NAME (name of the container image you would like to push up to your ACR)
|
||||||
# - RESOURCE_GROUP (where your cluster is deployed)
|
# - RESOURCE_GROUP (where your cluster is deployed)
|
||||||
# - CLUSTER_NAME (name of your AKS cluster)
|
# - CLUSTER_NAME (name of your AKS cluster)
|
||||||
# - CONTAINER_NAME (name of the container image you would like to push up to your ACR)
|
# - IMAGE_PULL_SECRET_NAME (name of the ImagePullSecret that will be created to pull your ACR image)
|
||||||
# - SECRET_NAME (name of the secret associated with pulling your ACR image)
|
|
||||||
#
|
#
|
||||||
# 3. Choose the appropriate render engine for the bake step https://github.com/Azure/k8s-bake. The config below assumes Helm.
|
# 3. Choose the appropriate render engine for the bake step https://github.com/Azure/k8s-bake. The config below assumes Helm.
|
||||||
# Set your helmChart, overrideFiles, overrides, and helm-version to suit your configuration.
|
# Set your helmChart, overrideFiles, overrides, and helm-version to suit your configuration.
|
||||||
@@ -48,12 +48,10 @@ env:
|
|||||||
CHART_OVERRIDE_PATH: "your-chart-override-path"
|
CHART_OVERRIDE_PATH: "your-chart-override-path"
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
buildImage:
|
||||||
permissions:
|
permissions:
|
||||||
actions: read
|
|
||||||
contents: read
|
contents: read
|
||||||
id-token: write
|
id-token: write
|
||||||
|
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
# Checks out the repository this file is in
|
# Checks out the repository this file is in
|
||||||
@@ -72,6 +70,20 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
az acr build --image ${{ env.AZURE_CONTAINER_REGISTRY }}.azurecr.io/${{ env.CONTAINER_NAME }}:${{ github.sha }} --registry ${{ env.AZURE_CONTAINER_REGISTRY }} -g ${{ env.RESOURCE_GROUP }} .
|
az acr build --image ${{ env.AZURE_CONTAINER_REGISTRY }}.azurecr.io/${{ env.CONTAINER_NAME }}:${{ github.sha }} --registry ${{ env.AZURE_CONTAINER_REGISTRY }} -g ${{ env.RESOURCE_GROUP }} .
|
||||||
|
|
||||||
|
createSecret:
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
id-token: write
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
# Logs in with your Azure credentials
|
||||||
|
- name: Azure login
|
||||||
|
uses: azure/[email protected]
|
||||||
|
with:
|
||||||
|
client-id: ${{ secrets.AZURE_CLIENT_ID }}
|
||||||
|
tenant-id: ${{ secrets.AZURE_TENANT_ID }}
|
||||||
|
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
|
||||||
|
|
||||||
# Retrieves your Azure Kubernetes Service cluster's kubeconfig file
|
# Retrieves your Azure Kubernetes Service cluster's kubeconfig file
|
||||||
- name: Get K8s context
|
- name: Get K8s context
|
||||||
uses: azure/[email protected]
|
uses: azure/[email protected]
|
||||||
@@ -85,7 +97,9 @@ jobs:
|
|||||||
az acr update -n ${{ env.AZURE_CONTAINER_REGISTRY }} -g ${{ env.RESOURCE_GROUP }} --admin-enabled true
|
az acr update -n ${{ env.AZURE_CONTAINER_REGISTRY }} -g ${{ env.RESOURCE_GROUP }} --admin-enabled true
|
||||||
ACR_USERNAME=$(az acr credential show -g ${{ env.RESOURCE_GROUP }} -n ${{ env.AZURE_CONTAINER_REGISTRY }} --query username -o tsv)
|
ACR_USERNAME=$(az acr credential show -g ${{ env.RESOURCE_GROUP }} -n ${{ env.AZURE_CONTAINER_REGISTRY }} --query username -o tsv)
|
||||||
ACR_PASSWORD=$(az acr credential show -g ${{ env.RESOURCE_GROUP }} -n ${{ env.AZURE_CONTAINER_REGISTRY }} --query passwords[0].value -o tsv)
|
ACR_PASSWORD=$(az acr credential show -g ${{ env.RESOURCE_GROUP }} -n ${{ env.AZURE_CONTAINER_REGISTRY }} --query passwords[0].value -o tsv)
|
||||||
|
echo "::add-mask::${ACR_USERNAME}"
|
||||||
echo "::set-output name=username::${ACR_USERNAME}"
|
echo "::set-output name=username::${ACR_USERNAME}"
|
||||||
|
echo "::add-mask::${ACR_PASSWORD}"
|
||||||
echo "::set-output name=password::${ACR_PASSWORD}"
|
echo "::set-output name=password::${ACR_PASSWORD}"
|
||||||
id: get-acr-creds
|
id: get-acr-creds
|
||||||
|
|
||||||
@@ -98,6 +112,29 @@ jobs:
|
|||||||
container-registry-password: ${{ steps.get-acr-creds.outputs.password }}
|
container-registry-password: ${{ steps.get-acr-creds.outputs.password }}
|
||||||
secret-name: ${{ env.IMAGE_PULL_SECRET_NAME }}
|
secret-name: ${{ env.IMAGE_PULL_SECRET_NAME }}
|
||||||
|
|
||||||
|
deploy:
|
||||||
|
permissions:
|
||||||
|
actions: read
|
||||||
|
contents: read
|
||||||
|
id-token: write
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
needs: [buildImage, createSecret]
|
||||||
|
steps:
|
||||||
|
# Logs in with your Azure credentials
|
||||||
|
- name: Azure login
|
||||||
|
uses: azure/[email protected]
|
||||||
|
with:
|
||||||
|
client-id: ${{ secrets.AZURE_CLIENT_ID }}
|
||||||
|
tenant-id: ${{ secrets.AZURE_TENANT_ID }}
|
||||||
|
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
|
||||||
|
|
||||||
|
# Retrieves your Azure Kubernetes Service cluster's kubeconfig file
|
||||||
|
- name: Get K8s context
|
||||||
|
uses: azure/[email protected]
|
||||||
|
with:
|
||||||
|
resource-group: ${{ env.RESOURCE_GROUP }}
|
||||||
|
cluster-name: ${{ env.CLUSTER_NAME }}
|
||||||
|
|
||||||
# Runs Helm to create manifest files
|
# Runs Helm to create manifest files
|
||||||
- name: Bake deployment
|
- name: Bake deployment
|
||||||
uses: azure/[email protected]
|
uses: azure/[email protected]
|
||||||
@@ -112,7 +149,7 @@ jobs:
|
|||||||
|
|
||||||
# Deploys application based on manifest files from previous step
|
# Deploys application based on manifest files from previous step
|
||||||
- name: Deploy application
|
- name: Deploy application
|
||||||
uses: Azure/k8s-deploy@v3.0
|
uses: Azure/k8s-deploy@v3.1
|
||||||
with:
|
with:
|
||||||
action: deploy
|
action: deploy
|
||||||
manifests: ${{ steps.bake.outputs.manifestsBundle }}
|
manifests: ${{ steps.bake.outputs.manifestsBundle }}
|
||||||
|
|||||||
@@ -9,17 +9,17 @@
|
|||||||
# To configure this workflow:
|
# To configure this workflow:
|
||||||
#
|
#
|
||||||
# 1. Set the following secrets in your repository (instructions for getting these
|
# 1. Set the following secrets in your repository (instructions for getting these
|
||||||
# https://github.com/Azure/login#configure-a-service-principal-with-a-federated-credential-to-use-oidc-based-authentication):
|
# https://docs.microsoft.com/en-us/azure/developer/github/connect-from-azure?tabs=azure-cli%2Clinux):
|
||||||
# - AZURE_CLIENT_ID
|
# - AZURE_CLIENT_ID
|
||||||
# - AZURE_TENANT_ID
|
# - AZURE_TENANT_ID
|
||||||
# - AZURE_SUBSCRIPTION_ID
|
# - AZURE_SUBSCRIPTION_ID
|
||||||
#
|
#
|
||||||
# 2. Set the following environment variables (or replace the values below):
|
# 2. Set the following environment variables (or replace the values below):
|
||||||
# - AZURE_CONTAINER_REGISTRY (name of your container registry / ACR)
|
# - AZURE_CONTAINER_REGISTRY (name of your container registry / ACR)
|
||||||
|
# - CONTAINER_NAME (name of the container image you would like to push up to your ACR)
|
||||||
# - RESOURCE_GROUP (where your cluster is deployed)
|
# - RESOURCE_GROUP (where your cluster is deployed)
|
||||||
# - CLUSTER_NAME (name of your AKS cluster)
|
# - CLUSTER_NAME (name of your AKS cluster)
|
||||||
# - CONTAINER_NAME (name of the container image you would like to push up to your ACR)
|
# - IMAGE_PULL_SECRET_NAME (name of the ImagePullSecret that will be created to pull your ACR image)
|
||||||
# - SECRET_NAME (name of the secret associated with pulling your ACR image)
|
|
||||||
#
|
#
|
||||||
# 3. Choose the appropriate render engine for the bake step https://github.com/Azure/k8s-bake. The config below assumes Kompose.
|
# 3. Choose the appropriate render engine for the bake step https://github.com/Azure/k8s-bake. The config below assumes Kompose.
|
||||||
# Set your dockerComposeFile and kompose-version to suit your configuration.
|
# Set your dockerComposeFile and kompose-version to suit your configuration.
|
||||||
@@ -40,12 +40,10 @@ env:
|
|||||||
DOCKER_COMPOSE_FILE_PATH: "your-docker-compose-file-path"
|
DOCKER_COMPOSE_FILE_PATH: "your-docker-compose-file-path"
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
buildImage:
|
||||||
permissions:
|
permissions:
|
||||||
actions: read
|
|
||||||
contents: read
|
contents: read
|
||||||
id-token: write
|
id-token: write
|
||||||
|
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
# Checks out the repository this file is in
|
# Checks out the repository this file is in
|
||||||
@@ -64,6 +62,20 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
az acr build --image ${{ env.AZURE_CONTAINER_REGISTRY }}.azurecr.io/${{ env.CONTAINER_NAME }}:${{ github.sha }} --registry ${{ env.AZURE_CONTAINER_REGISTRY }} -g ${{ env.RESOURCE_GROUP }} .
|
az acr build --image ${{ env.AZURE_CONTAINER_REGISTRY }}.azurecr.io/${{ env.CONTAINER_NAME }}:${{ github.sha }} --registry ${{ env.AZURE_CONTAINER_REGISTRY }} -g ${{ env.RESOURCE_GROUP }} .
|
||||||
|
|
||||||
|
createSecret:
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
id-token: write
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
# Logs in with your Azure credentials
|
||||||
|
- name: Azure login
|
||||||
|
uses: azure/[email protected]
|
||||||
|
with:
|
||||||
|
client-id: ${{ secrets.AZURE_CLIENT_ID }}
|
||||||
|
tenant-id: ${{ secrets.AZURE_TENANT_ID }}
|
||||||
|
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
|
||||||
|
|
||||||
# Retrieves your Azure Kubernetes Service cluster's kubeconfig file
|
# Retrieves your Azure Kubernetes Service cluster's kubeconfig file
|
||||||
- name: Get K8s context
|
- name: Get K8s context
|
||||||
uses: azure/[email protected]
|
uses: azure/[email protected]
|
||||||
@@ -77,7 +89,9 @@ jobs:
|
|||||||
az acr update -n ${{ env.AZURE_CONTAINER_REGISTRY }} -g ${{ env.RESOURCE_GROUP }} --admin-enabled true
|
az acr update -n ${{ env.AZURE_CONTAINER_REGISTRY }} -g ${{ env.RESOURCE_GROUP }} --admin-enabled true
|
||||||
ACR_USERNAME=$(az acr credential show -g ${{ env.RESOURCE_GROUP }} -n ${{ env.AZURE_CONTAINER_REGISTRY }} --query username -o tsv)
|
ACR_USERNAME=$(az acr credential show -g ${{ env.RESOURCE_GROUP }} -n ${{ env.AZURE_CONTAINER_REGISTRY }} --query username -o tsv)
|
||||||
ACR_PASSWORD=$(az acr credential show -g ${{ env.RESOURCE_GROUP }} -n ${{ env.AZURE_CONTAINER_REGISTRY }} --query passwords[0].value -o tsv)
|
ACR_PASSWORD=$(az acr credential show -g ${{ env.RESOURCE_GROUP }} -n ${{ env.AZURE_CONTAINER_REGISTRY }} --query passwords[0].value -o tsv)
|
||||||
|
echo "::add-mask::${ACR_USERNAME}"
|
||||||
echo "::set-output name=username::${ACR_USERNAME}"
|
echo "::set-output name=username::${ACR_USERNAME}"
|
||||||
|
echo "::add-mask::${ACR_PASSWORD}"
|
||||||
echo "::set-output name=password::${ACR_PASSWORD}"
|
echo "::set-output name=password::${ACR_PASSWORD}"
|
||||||
id: get-acr-creds
|
id: get-acr-creds
|
||||||
|
|
||||||
@@ -90,6 +104,32 @@ jobs:
|
|||||||
container-registry-password: ${{ steps.get-acr-creds.outputs.password }}
|
container-registry-password: ${{ steps.get-acr-creds.outputs.password }}
|
||||||
secret-name: ${{ env.IMAGE_PULL_SECRET_NAME }}
|
secret-name: ${{ env.IMAGE_PULL_SECRET_NAME }}
|
||||||
|
|
||||||
|
deploy:
|
||||||
|
permissions:
|
||||||
|
actions: read
|
||||||
|
contents: read
|
||||||
|
id-token: write
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
needs: [buildImage, createSecret]
|
||||||
|
steps:
|
||||||
|
# Checks out the repository this file is in
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
|
||||||
|
# Logs in with your Azure credentials
|
||||||
|
- name: Azure login
|
||||||
|
uses: azure/[email protected]
|
||||||
|
with:
|
||||||
|
client-id: ${{ secrets.AZURE_CLIENT_ID }}
|
||||||
|
tenant-id: ${{ secrets.AZURE_TENANT_ID }}
|
||||||
|
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
|
||||||
|
|
||||||
|
# Retrieves your Azure Kubernetes Service cluster's kubeconfig file
|
||||||
|
- name: Get K8s context
|
||||||
|
uses: azure/[email protected]
|
||||||
|
with:
|
||||||
|
resource-group: ${{ env.RESOURCE_GROUP }}
|
||||||
|
cluster-name: ${{ env.CLUSTER_NAME }}
|
||||||
|
|
||||||
# Runs Kompose to create manifest files
|
# Runs Kompose to create manifest files
|
||||||
- name: Bake deployment
|
- name: Bake deployment
|
||||||
uses: azure/[email protected]
|
uses: azure/[email protected]
|
||||||
@@ -101,7 +141,7 @@ jobs:
|
|||||||
|
|
||||||
# Deploys application based on manifest files from previous step
|
# Deploys application based on manifest files from previous step
|
||||||
- name: Deploy application
|
- name: Deploy application
|
||||||
uses: Azure/k8s-deploy@v3.0
|
uses: Azure/k8s-deploy@v3.1
|
||||||
with:
|
with:
|
||||||
action: deploy
|
action: deploy
|
||||||
manifests: ${{ steps.bake.outputs.manifestsBundle }}
|
manifests: ${{ steps.bake.outputs.manifestsBundle }}
|
||||||
|
|||||||
@@ -9,17 +9,17 @@
|
|||||||
# To configure this workflow:
|
# To configure this workflow:
|
||||||
#
|
#
|
||||||
# 1. Set the following secrets in your repository (instructions for getting these
|
# 1. Set the following secrets in your repository (instructions for getting these
|
||||||
# https://github.com/Azure/login#configure-a-service-principal-with-a-federated-credential-to-use-oidc-based-authentication):
|
# https://docs.microsoft.com/en-us/azure/developer/github/connect-from-azure?tabs=azure-cli%2Clinux):
|
||||||
# - AZURE_CLIENT_ID
|
# - AZURE_CLIENT_ID
|
||||||
# - AZURE_TENANT_ID
|
# - AZURE_TENANT_ID
|
||||||
# - AZURE_SUBSCRIPTION_ID
|
# - AZURE_SUBSCRIPTION_ID
|
||||||
#
|
#
|
||||||
# 2. Set the following environment variables (or replace the values below):
|
# 2. Set the following environment variables (or replace the values below):
|
||||||
# - AZURE_CONTAINER_REGISTRY (name of your container registry / ACR)
|
# - AZURE_CONTAINER_REGISTRY (name of your container registry / ACR)
|
||||||
|
# - CONTAINER_NAME (name of the container image you would like to push up to your ACR)
|
||||||
# - RESOURCE_GROUP (where your cluster is deployed)
|
# - RESOURCE_GROUP (where your cluster is deployed)
|
||||||
# - CLUSTER_NAME (name of your AKS cluster)
|
# - CLUSTER_NAME (name of your AKS cluster)
|
||||||
# - CONTAINER_NAME (name of the container image you would like to push up to your ACR)
|
# - IMAGE_PULL_SECRET_NAME (name of the ImagePullSecret that will be created to pull your ACR image)
|
||||||
# - SECRET_NAME (name of the secret associated with pulling your ACR image)
|
|
||||||
#
|
#
|
||||||
# 3. Choose the appropriate render engine for the bake step https://github.com/Azure/k8s-bake. The config below assumes Kustomize.
|
# 3. Choose the appropriate render engine for the bake step https://github.com/Azure/k8s-bake. The config below assumes Kustomize.
|
||||||
# Set your kustomizationPath and kubectl-version to suit your configuration.
|
# Set your kustomizationPath and kubectl-version to suit your configuration.
|
||||||
@@ -46,12 +46,10 @@ env:
|
|||||||
KUSTOMIZE_PATH: "your-kustomize-path"
|
KUSTOMIZE_PATH: "your-kustomize-path"
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
buildImage:
|
||||||
permissions:
|
permissions:
|
||||||
actions: read
|
|
||||||
contents: read
|
contents: read
|
||||||
id-token: write
|
id-token: write
|
||||||
|
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
# Checks out the repository this file is in
|
# Checks out the repository this file is in
|
||||||
@@ -70,6 +68,23 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
az acr build --image ${{ env.AZURE_CONTAINER_REGISTRY }}.azurecr.io/${{ env.CONTAINER_NAME }}:${{ github.sha }} --registry ${{ env.AZURE_CONTAINER_REGISTRY }} -g ${{ env.RESOURCE_GROUP }} .
|
az acr build --image ${{ env.AZURE_CONTAINER_REGISTRY }}.azurecr.io/${{ env.CONTAINER_NAME }}:${{ github.sha }} --registry ${{ env.AZURE_CONTAINER_REGISTRY }} -g ${{ env.RESOURCE_GROUP }} .
|
||||||
|
|
||||||
|
createSecret:
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
id-token: write
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
# Checks out the repository this file is in
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
|
||||||
|
# Logs in with your Azure credentials
|
||||||
|
- name: Azure login
|
||||||
|
uses: azure/[email protected]
|
||||||
|
with:
|
||||||
|
client-id: ${{ secrets.AZURE_CLIENT_ID }}
|
||||||
|
tenant-id: ${{ secrets.AZURE_TENANT_ID }}
|
||||||
|
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
|
||||||
|
|
||||||
# Retrieves your Azure Kubernetes Service cluster's kubeconfig file
|
# Retrieves your Azure Kubernetes Service cluster's kubeconfig file
|
||||||
- name: Get K8s context
|
- name: Get K8s context
|
||||||
uses: azure/[email protected]
|
uses: azure/[email protected]
|
||||||
@@ -83,7 +98,9 @@ jobs:
|
|||||||
az acr update -n ${{ env.AZURE_CONTAINER_REGISTRY }} -g ${{ env.RESOURCE_GROUP }} --admin-enabled true
|
az acr update -n ${{ env.AZURE_CONTAINER_REGISTRY }} -g ${{ env.RESOURCE_GROUP }} --admin-enabled true
|
||||||
ACR_USERNAME=$(az acr credential show -g ${{ env.RESOURCE_GROUP }} -n ${{ env.AZURE_CONTAINER_REGISTRY }} --query username -o tsv)
|
ACR_USERNAME=$(az acr credential show -g ${{ env.RESOURCE_GROUP }} -n ${{ env.AZURE_CONTAINER_REGISTRY }} --query username -o tsv)
|
||||||
ACR_PASSWORD=$(az acr credential show -g ${{ env.RESOURCE_GROUP }} -n ${{ env.AZURE_CONTAINER_REGISTRY }} --query passwords[0].value -o tsv)
|
ACR_PASSWORD=$(az acr credential show -g ${{ env.RESOURCE_GROUP }} -n ${{ env.AZURE_CONTAINER_REGISTRY }} --query passwords[0].value -o tsv)
|
||||||
|
echo "::add-mask::${ACR_USERNAME}"
|
||||||
echo "::set-output name=username::${ACR_USERNAME}"
|
echo "::set-output name=username::${ACR_USERNAME}"
|
||||||
|
echo "::add-mask::${ACR_PASSWORD}"
|
||||||
echo "::set-output name=password::${ACR_PASSWORD}"
|
echo "::set-output name=password::${ACR_PASSWORD}"
|
||||||
id: get-acr-creds
|
id: get-acr-creds
|
||||||
|
|
||||||
@@ -96,6 +113,32 @@ jobs:
|
|||||||
container-registry-password: ${{ steps.get-acr-creds.outputs.password }}
|
container-registry-password: ${{ steps.get-acr-creds.outputs.password }}
|
||||||
secret-name: ${{ env.IMAGE_PULL_SECRET_NAME }}
|
secret-name: ${{ env.IMAGE_PULL_SECRET_NAME }}
|
||||||
|
|
||||||
|
deploy:
|
||||||
|
permissions:
|
||||||
|
actions: read
|
||||||
|
contents: read
|
||||||
|
id-token: write
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
needs: [buildImage, createSecret]
|
||||||
|
steps:
|
||||||
|
# Checks out the repository this file is in
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
|
||||||
|
# Logs in with your Azure credentials
|
||||||
|
- name: Azure login
|
||||||
|
uses: azure/[email protected]
|
||||||
|
with:
|
||||||
|
client-id: ${{ secrets.AZURE_CLIENT_ID }}
|
||||||
|
tenant-id: ${{ secrets.AZURE_TENANT_ID }}
|
||||||
|
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
|
||||||
|
|
||||||
|
# Retrieves your Azure Kubernetes Service cluster's kubeconfig file
|
||||||
|
- name: Get K8s context
|
||||||
|
uses: azure/[email protected]
|
||||||
|
with:
|
||||||
|
resource-group: ${{ env.RESOURCE_GROUP }}
|
||||||
|
cluster-name: ${{ env.CLUSTER_NAME }}
|
||||||
|
|
||||||
# Runs Kustomize to create manifest files
|
# Runs Kustomize to create manifest files
|
||||||
- name: Bake deployment
|
- name: Bake deployment
|
||||||
uses: azure/[email protected]
|
uses: azure/[email protected]
|
||||||
@@ -107,7 +150,7 @@ jobs:
|
|||||||
|
|
||||||
# Deploys application based on manifest files from previous step
|
# Deploys application based on manifest files from previous step
|
||||||
- name: Deploy application
|
- name: Deploy application
|
||||||
uses: Azure/k8s-deploy@v3.0
|
uses: Azure/k8s-deploy@v3.1
|
||||||
with:
|
with:
|
||||||
action: deploy
|
action: deploy
|
||||||
manifests: ${{ steps.bake.outputs.manifestsBundle }}
|
manifests: ${{ steps.bake.outputs.manifestsBundle }}
|
||||||
|
|||||||
@@ -8,8 +8,7 @@
|
|||||||
#
|
#
|
||||||
# To configure this workflow:
|
# To configure this workflow:
|
||||||
#
|
#
|
||||||
# 1. Set the following secrets in your repository (instructions for getting these
|
# 1. Set the following secrets in your repository (instructions for getting these can be found at https://docs.microsoft.com/en-us/azure/developer/github/connect-from-azure?tabs=azure-cli%2Clinux):
|
||||||
# https://github.com/Azure/login#configure-a-service-principal-with-a-federated-credential-to-use-oidc-based-authentication):
|
|
||||||
# - AZURE_CLIENT_ID
|
# - AZURE_CLIENT_ID
|
||||||
# - AZURE_TENANT_ID
|
# - AZURE_TENANT_ID
|
||||||
# - AZURE_SUBSCRIPTION_ID
|
# - AZURE_SUBSCRIPTION_ID
|
||||||
@@ -19,7 +18,7 @@
|
|||||||
# - RESOURCE_GROUP (where your cluster is deployed)
|
# - RESOURCE_GROUP (where your cluster is deployed)
|
||||||
# - CLUSTER_NAME (name of your AKS cluster)
|
# - CLUSTER_NAME (name of your AKS cluster)
|
||||||
# - CONTAINER_NAME (name of the container image you would like to push up to your ACR)
|
# - CONTAINER_NAME (name of the container image you would like to push up to your ACR)
|
||||||
# - SECRET_NAME (name of the secret associated with pulling your ACR image)
|
# - IMAGE_PULL_SECRET_NAME (name of the ImagePullSecret that will be created to pull your ACR image)
|
||||||
# - DEPLOYMENT_MANIFEST_PATH (path to the manifest yaml for your deployment)
|
# - DEPLOYMENT_MANIFEST_PATH (path to the manifest yaml for your deployment)
|
||||||
#
|
#
|
||||||
# For more information on GitHub Actions for Azure, refer to https://github.com/Azure/Actions
|
# For more information on GitHub Actions for Azure, refer to https://github.com/Azure/Actions
|
||||||
@@ -43,12 +42,10 @@ env:
|
|||||||
DEPLOYMENT_MANIFEST_PATH: 'your-deployment-manifest-path'
|
DEPLOYMENT_MANIFEST_PATH: 'your-deployment-manifest-path'
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
buildImage:
|
||||||
permissions:
|
permissions:
|
||||||
actions: read
|
|
||||||
contents: read
|
contents: read
|
||||||
id-token: write
|
id-token: write
|
||||||
|
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
# Checks out the repository this file is in
|
# Checks out the repository this file is in
|
||||||
@@ -67,6 +64,20 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
az acr build --image ${{ env.AZURE_CONTAINER_REGISTRY }}.azurecr.io/${{ env.CONTAINER_NAME }}:${{ github.sha }} --registry ${{ env.AZURE_CONTAINER_REGISTRY }} -g ${{ env.RESOURCE_GROUP }} .
|
az acr build --image ${{ env.AZURE_CONTAINER_REGISTRY }}.azurecr.io/${{ env.CONTAINER_NAME }}:${{ github.sha }} --registry ${{ env.AZURE_CONTAINER_REGISTRY }} -g ${{ env.RESOURCE_GROUP }} .
|
||||||
|
|
||||||
|
createSecret:
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
id-token: write
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
# Logs in with your Azure credentials
|
||||||
|
- name: Azure login
|
||||||
|
uses: azure/[email protected]
|
||||||
|
with:
|
||||||
|
client-id: ${{ secrets.AZURE_CLIENT_ID }}
|
||||||
|
tenant-id: ${{ secrets.AZURE_TENANT_ID }}
|
||||||
|
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
|
||||||
|
|
||||||
# Retrieves your Azure Kubernetes Service cluster's kubeconfig file
|
# Retrieves your Azure Kubernetes Service cluster's kubeconfig file
|
||||||
- name: Get K8s context
|
- name: Get K8s context
|
||||||
uses: azure/[email protected]
|
uses: azure/[email protected]
|
||||||
@@ -80,7 +91,9 @@ jobs:
|
|||||||
az acr update -n ${{ env.AZURE_CONTAINER_REGISTRY }} -g ${{ env.RESOURCE_GROUP }} --admin-enabled true
|
az acr update -n ${{ env.AZURE_CONTAINER_REGISTRY }} -g ${{ env.RESOURCE_GROUP }} --admin-enabled true
|
||||||
ACR_USERNAME=$(az acr credential show -g ${{ env.RESOURCE_GROUP }} -n ${{ env.AZURE_CONTAINER_REGISTRY }} --query username -o tsv)
|
ACR_USERNAME=$(az acr credential show -g ${{ env.RESOURCE_GROUP }} -n ${{ env.AZURE_CONTAINER_REGISTRY }} --query username -o tsv)
|
||||||
ACR_PASSWORD=$(az acr credential show -g ${{ env.RESOURCE_GROUP }} -n ${{ env.AZURE_CONTAINER_REGISTRY }} --query passwords[0].value -o tsv)
|
ACR_PASSWORD=$(az acr credential show -g ${{ env.RESOURCE_GROUP }} -n ${{ env.AZURE_CONTAINER_REGISTRY }} --query passwords[0].value -o tsv)
|
||||||
|
echo "::add-mask::${ACR_USERNAME}"
|
||||||
echo "::set-output name=username::${ACR_USERNAME}"
|
echo "::set-output name=username::${ACR_USERNAME}"
|
||||||
|
echo "::add-mask::${ACR_PASSWORD}"
|
||||||
echo "::set-output name=password::${ACR_PASSWORD}"
|
echo "::set-output name=password::${ACR_PASSWORD}"
|
||||||
id: get-acr-creds
|
id: get-acr-creds
|
||||||
|
|
||||||
@@ -93,9 +106,35 @@ jobs:
|
|||||||
container-registry-password: ${{ steps.get-acr-creds.outputs.password }}
|
container-registry-password: ${{ steps.get-acr-creds.outputs.password }}
|
||||||
secret-name: ${{ env.IMAGE_PULL_SECRET_NAME }}
|
secret-name: ${{ env.IMAGE_PULL_SECRET_NAME }}
|
||||||
|
|
||||||
|
deploy:
|
||||||
|
permissions:
|
||||||
|
actions: read
|
||||||
|
contents: read
|
||||||
|
id-token: write
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
needs: [buildImage, createSecret]
|
||||||
|
steps:
|
||||||
|
# Checks out the repository this file is in
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
|
||||||
|
# Logs in with your Azure credentials
|
||||||
|
- name: Azure login
|
||||||
|
uses: azure/[email protected]
|
||||||
|
with:
|
||||||
|
client-id: ${{ secrets.AZURE_CLIENT_ID }}
|
||||||
|
tenant-id: ${{ secrets.AZURE_TENANT_ID }}
|
||||||
|
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
|
||||||
|
|
||||||
|
# Retrieves your Azure Kubernetes Service cluster's kubeconfig file
|
||||||
|
- name: Get K8s context
|
||||||
|
uses: azure/[email protected]
|
||||||
|
with:
|
||||||
|
resource-group: ${{ env.RESOURCE_GROUP }}
|
||||||
|
cluster-name: ${{ env.CLUSTER_NAME }}
|
||||||
|
|
||||||
# Deploys application based on given manifest file
|
# Deploys application based on given manifest file
|
||||||
- name: Deploys application
|
- name: Deploys application
|
||||||
uses: Azure/k8s-deploy@v3.0
|
uses: Azure/k8s-deploy@v3.1
|
||||||
with:
|
with:
|
||||||
action: deploy
|
action: deploy
|
||||||
manifests: ${{ env.DEPLOYMENT_MANIFEST_PATH }}
|
manifests: ${{ env.DEPLOYMENT_MANIFEST_PATH }}
|
||||||
|
|||||||
Reference in New Issue
Block a user