Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update deploy script to include at21,23,24 #64

Merged
merged 2 commits into from
Feb 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
110 changes: 107 additions & 3 deletions .github/workflows/build-deploy-functionapp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,46 @@ on:
#
# 2. Change these variables for your configuration:
env:
AZURE_FUNCTIONAPP_NAME: 'altinn-at22-auditlog-fa' # set this to your function app name on Azure
AZURE_FUNCTIONAPP_PACKAGE_PATH: './src/Functions/Altinn.Auth.AuditLog.Functions' # set this to the path to your function app project, defaults to the repository root
DOTNET_VERSION: '6.0.x' # set this to the dotnet version to use (e.g. '2.1.x', '3.1.x', '5.0.x')

jobs:
build-and-deploy:
deploy-at21:
runs-on: windows-latest
environment: AT21
permissions:
contents: read
id-token: write
steps:
- name: 'Checkout GitHub Action'
uses: actions/checkout@v3

- name: Azure Login
uses: azure/login@v1
with:
client-id: ${{ secrets.AZURE_CLIENT_ID }}
tenant-id: ${{ secrets.AZURE_TENANT_ID }}
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}

- name: Setup DotNet ${{ env.DOTNET_VERSION }} Environment
uses: actions/setup-dotnet@v3
with:
dotnet-version: ${{ env.DOTNET_VERSION }}

- name: 'Resolve Project Dependencies Using Dotnet'
shell: pwsh
run: |
pushd './${{ env.AZURE_FUNCTIONAPP_PACKAGE_PATH }}'
dotnet build --configuration Release --output ./output
popd

- name: 'Run Azure Functions Action'
uses: Azure/functions-action@v1
id: fa
with:
app-name: ${{ vars.AZURE_FUNCTIONAPP_NAME }}
package: '${{ env.AZURE_FUNCTIONAPP_PACKAGE_PATH }}/output'
deploy-at22:
runs-on: windows-latest
environment: AT22
permissions:
Expand Down Expand Up @@ -53,5 +87,75 @@ jobs:
uses: Azure/functions-action@v1
id: fa
with:
app-name: ${{ env.AZURE_FUNCTIONAPP_NAME }}
app-name: ${{ vars.AZURE_FUNCTIONAPP_NAME }}
package: '${{ env.AZURE_FUNCTIONAPP_PACKAGE_PATH }}/output'
deploy-at23:
runs-on: windows-latest
environment: AT23
permissions:
contents: read
id-token: write
steps:
- name: 'Checkout GitHub Action'
uses: actions/checkout@v3

- name: Azure Login
uses: azure/login@v1
with:
client-id: ${{ secrets.AZURE_CLIENT_ID }}
tenant-id: ${{ secrets.AZURE_TENANT_ID }}
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}

- name: Setup DotNet ${{ env.DOTNET_VERSION }} Environment
uses: actions/setup-dotnet@v3
with:
dotnet-version: ${{ env.DOTNET_VERSION }}

- name: 'Resolve Project Dependencies Using Dotnet'
shell: pwsh
run: |
pushd './${{ env.AZURE_FUNCTIONAPP_PACKAGE_PATH }}'
dotnet build --configuration Release --output ./output
popd

- name: 'Run Azure Functions Action'
uses: Azure/functions-action@v1
id: fa
with:
app-name: ${{ vars.AZURE_FUNCTIONAPP_NAME }}
package: '${{ env.AZURE_FUNCTIONAPP_PACKAGE_PATH }}/output'
deploy-at24:
runs-on: windows-latest
environment: AT24
permissions:
contents: read
id-token: write
steps:
- name: 'Checkout GitHub Action'
uses: actions/checkout@v3

- name: Azure Login
uses: azure/login@v1
with:
client-id: ${{ secrets.AZURE_CLIENT_ID }}
tenant-id: ${{ secrets.AZURE_TENANT_ID }}
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}

- name: Setup DotNet ${{ env.DOTNET_VERSION }} Environment
uses: actions/setup-dotnet@v3
with:
dotnet-version: ${{ env.DOTNET_VERSION }}

- name: 'Resolve Project Dependencies Using Dotnet'
shell: pwsh
run: |
pushd './${{ env.AZURE_FUNCTIONAPP_PACKAGE_PATH }}'
dotnet build --configuration Release --output ./output
popd

- name: 'Run Azure Functions Action'
uses: Azure/functions-action@v1
id: fa
with:
app-name: ${{ vars.AZURE_FUNCTIONAPP_NAME }}
package: '${{ env.AZURE_FUNCTIONAPP_PACKAGE_PATH }}/output'
94 changes: 92 additions & 2 deletions .github/workflows/build-publish-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ env:
jobs:
build-and-push-image:
runs-on: ubuntu-latest
environment: AT22
permissions:
contents: read
packages: write
Expand All @@ -42,6 +41,37 @@ jobs:
with:
push: true
tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ github.sha }}

deploy-at21:
environment: AT21
runs-on: ubuntu-latest
needs: build-and-push-image
permissions:
id-token: write
contents: read
packages: read
steps:
- name: Azure Login
uses: azure/login@v1
with:
client-id: ${{ secrets.AZURE_CLIENT_ID }}
tenant-id: ${{ secrets.AZURE_TENANT_ID }}
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
- name: Deploy to containerapp
uses: azure/CLI@v1
with:
inlineScript: >
az config set extension.use_dynamic_install=yes_without_prompt

az containerapp update \
--name ${{ vars.CONTAINER_APP_NAME }} \
--container-name ${{ env.CONTAINER_APP_CONTAINER_NAME }} \
--resource-group ${{ vars.CONTAINER_APP_RESOURCE_GROUP_NAME }} \
--image ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ github.sha }}
- name: logout
run: >
az logout

deploy-at22:
environment: AT22
runs-on: ubuntu-latest
Expand Down Expand Up @@ -70,4 +100,64 @@ jobs:
--image ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ github.sha }}
- name: logout
run: >
az logout
az logout

deploy-at23:
environment: AT23
runs-on: ubuntu-latest
needs: build-and-push-image
permissions:
id-token: write
contents: read
packages: read
steps:
- name: Azure Login
uses: azure/login@v1
with:
client-id: ${{ secrets.AZURE_CLIENT_ID }}
tenant-id: ${{ secrets.AZURE_TENANT_ID }}
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
- name: Deploy to containerapp
uses: azure/CLI@v1
with:
inlineScript: >
az config set extension.use_dynamic_install=yes_without_prompt

az containerapp update \
--name ${{ vars.CONTAINER_APP_NAME }} \
--container-name ${{ env.CONTAINER_APP_CONTAINER_NAME }} \
--resource-group ${{ vars.CONTAINER_APP_RESOURCE_GROUP_NAME }} \
--image ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ github.sha }}
- name: logout
run: >
az logout

deploy-at24:
environment: AT24
runs-on: ubuntu-latest
needs: build-and-push-image
permissions:
id-token: write
contents: read
packages: read
steps:
- name: Azure Login
uses: azure/login@v1
with:
client-id: ${{ secrets.AZURE_CLIENT_ID }}
tenant-id: ${{ secrets.AZURE_TENANT_ID }}
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
- name: Deploy to containerapp
uses: azure/CLI@v1
with:
inlineScript: >
az config set extension.use_dynamic_install=yes_without_prompt

az containerapp update \
--name ${{ vars.CONTAINER_APP_NAME }} \
--container-name ${{ env.CONTAINER_APP_CONTAINER_NAME }} \
--resource-group ${{ vars.CONTAINER_APP_RESOURCE_GROUP_NAME }} \
--image ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ github.sha }}
- name: logout
run: >
az logout
56 changes: 56 additions & 0 deletions .github/workflows/deploy-fa-to-environment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
name: Deploy DotNet project to Azure Function App

on:
workflow_dispatch:
inputs:
environment:
type: environment
description: Select the environment

# CONFIGURATION
# For help, go to https://github.com/Azure/Actions
#
# 1. Set up the following secrets in your repository:
# AZURE_FUNCTIONAPP_PUBLISH_PROFILE
#
# 2. Change these variables for your configuration:
env:
AZURE_FUNCTIONAPP_PACKAGE_PATH: './src/Functions/Altinn.Auth.AuditLog.Functions' # set this to the path to your function app project, defaults to the repository root
DOTNET_VERSION: '6.0.x' # set this to the dotnet version to use (e.g. '2.1.x', '3.1.x', '5.0.x')

jobs:
deploy-at21:
runs-on: windows-latest
environment: ${{ inputs.environment }}
permissions:
contents: read
id-token: write
steps:
- name: 'Checkout GitHub Action'
uses: actions/checkout@v3

- name: Azure Login
uses: azure/login@v1
with:
client-id: ${{ secrets.AZURE_CLIENT_ID }}
tenant-id: ${{ secrets.AZURE_TENANT_ID }}
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}

- name: Setup DotNet ${{ env.DOTNET_VERSION }} Environment
uses: actions/setup-dotnet@v3
with:
dotnet-version: ${{ env.DOTNET_VERSION }}

- name: 'Resolve Project Dependencies Using Dotnet'
shell: pwsh
run: |
pushd './${{ env.AZURE_FUNCTIONAPP_PACKAGE_PATH }}'
dotnet build --configuration Release --output ./output
popd

- name: 'Run Azure Functions Action'
uses: Azure/functions-action@v1
id: fa
with:
app-name: ${{ vars.AZURE_FUNCTIONAPP_NAME }}
package: '${{ env.AZURE_FUNCTIONAPP_PACKAGE_PATH }}/output'
52 changes: 52 additions & 0 deletions .github/workflows/deploy-to-environment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: Deploy to a specific environment
on:
workflow_dispatch:
inputs:
environment:
type: environment
description: Select the environment
version:
type: string
description: Enter the package version
required: true

env:
REGISTRY: ghcr.io
IMAGE_NAME: altinn/altinn-auth-audit-log
CONTAINER_APP_CONTAINER_NAME: auditlog

jobs:
deploy:
environment: ${{ inputs.environment }}
runs-on: ubuntu-latest
permissions:
id-token: write
contents: read
packages: read
steps:
- name: Log in to the Container registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Azure Login
uses: azure/login@v1
with:
client-id: ${{ secrets.AZURE_CLIENT_ID }}
tenant-id: ${{ secrets.AZURE_TENANT_ID }}
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
- name: Deploy to containerapp
uses: azure/CLI@v1
with:
inlineScript: >
az config set extension.use_dynamic_install=yes_without_prompt

az containerapp update \
--name ${{ vars.CONTAINER_APP_NAME }} \
--container-name ${{ env.CONTAINER_APP_CONTAINER_NAME }} \
--resource-group ${{ vars.CONTAINER_APP_RESOURCE_GROUP_NAME }} \
--image ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ inputs.version }}
- name: logout
run: >
az logout
Loading